# din\_key\_offset not working on NG/KB?

**URL:** <https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519>\
**Category:** MIDIfication\
**Created:** [August 18, 2014, 4:38pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519 "2014-08-18T16:38:03Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 18, 2014, 4:38pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/1 "2014-08-18T16:38:03Z")

</div>

Hey people,

&nbsp;

I need to adjust the starting note of the right half of my keyboard. Here is the code from NG:  
&nbsp;

&nbsp;

> RESET\_HW
> 
> &nbsp;
> 
> LCD “%CKeyboard Mapped”
> 
> &nbsp;
> 
> # keyboard configuration
> 
> KEYBOARD n=1 &nbsp; rows=12 &nbsp;dout\_sr1=1 &nbsp;dout\_sr2=2 &nbsp;din\_sr1=1 &nbsp;din\_sr2=2 \
> 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;din\_inverted=0 &nbsp;break\_inverted=0 &nbsp;din\_key\_offset=64 \
> 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;scan\_velocity=1 &nbsp;scan\_optimized=0 &nbsp;note\_offset=21 \
> 
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;delay\_fastest=8 &nbsp;delay\_fastest\_black\_keys=0 &nbsp;delay\_slowest=100
> 
> &nbsp;
> 
> &nbsp;
> 
> EVENT\_KB id=1 &nbsp;type=NoteOn chn=1 key=any use\_key\_number=1 range=0:127 &nbsp;kb\_transpose=0 &nbsp;lcd\_pos=1:1:1 label=“Note %n”

&nbsp;

It seems, that the din\_key\_offset parameter is not working. It doesn’t matter which number I insert, the resulting key# is the same everytime. The right half is far too low. It starts at a-1 and not at C#-3.

&nbsp;

I first tried KB, but same here.&nbsp;

&nbsp;

Any tipps?  
&nbsp;

Thanks,

Chris

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [August 18, 2014, 8:27pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/2 "2014-08-18T20:27:54Z")

</div>

Hi Chris,

&nbsp;

did you enable the FANTOM\_XR\_VARIANT switch in keyboard.c?

&nbsp;

In fully customized variant the din\_key\_offset parameter isn’t considered.

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 18, 2014, 9:10pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/3 "2014-08-18T21:10:39Z")

</div>

Hi TK,

&nbsp;

thanks for getting back to me.

I used the original MB\_KB from [ucapps.de](http://ucapps.de)

So, if you didn’t activate it by default, it should be turned off.

---

<div class="post-metadata">

**Author:** ![T.K](https://forum.midibox.org/user_avatar/forum.midibox.org/t.k/32/7_2.png) [@T.K](https://forum.midibox.org/u/T.K)\
**Post date:** [August 18, 2014, 9:42pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/4 "2014-08-18T21:42:30Z")

</div>

Maybe the number is too high so that an overrun happens?

&nbsp;

Which note is played when you are using&nbsp;din\_key\_offset=1

which note when you are using&nbsp;din\_key\_offset=2

and 3… and 4… are you able to increase it until the expected note will be played?

&nbsp;

At which value an unexpected note will be played?

&nbsp;

Best Regards, Thorsten.

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 18, 2014, 11:19pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/5 "2014-08-18T23:19:03Z")

</div>

I tried different and random numbers from 0 to 32. Nothing is changing. It stays at a-1.

&nbsp;

Maybe something is swapped. I’ll try tomorrow, if the starting key of the left half changes by putting another number behind din\_key\_offset=x. But the left half is working perfectly… and the right half is working too, it’s just the wrong starting point 😉

&nbsp;

Do you may have an old revision of the KB-app? I could try to upload an old one.&nbsp;

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 19, 2014, 11:02am UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/6 "2014-08-19T11:02:10Z")

</div>

The result is:  
Changing&nbsp;din\_key\_offset=x doesn’t have any impact on the played notes. It stays with a-1.

&nbsp;

I will update my svn and check what you suggested. I will build an app with VARIANT=1 and =0 and try both.&nbsp;

&nbsp;

//edit: Okay: With VARIANT=1 I get absolutely no notes out of the keybed. With VARIANT=0 same thing as mentioned above (stays at a-1).

&nbsp;

//edit: BTW: It’s a TP/100 I’m checking with. But this shouldn’t be a problem. I have the diode-matrix-layout and build an adaptor. I doublechecked the connections… here should everything be fine.

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [August 19, 2014, 7:39pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/7 "2014-08-19T19:39:11Z")

</div>

Hi Christian,

&nbsp;

I just re-compiled the latest MIDIboxKB V1.013 out of my latest SVN Rev.2034 and installed it on my testbed LPC17 with the Fatar TP9 (88 keys) and it works as expected.

I checked all settings in MiosStudio -\> o.k.

I checked all 88 Keys about their correct notes -\> o.k.

&nbsp;

Maybe my project.hex will help. Settings are according to MiosStudio screenshot.

If this doesnÂ´t help then your TP100 scanmatrix or your DIN/DOUT connectiion is different from the one Thorsten proposed on his Keyboard project page.

&nbsp;

Good Luck!

Jo

[project.hex](\< _ **base\_url** _ \>/applications/core/interface/file/attachment.php?id=11551)

 ![post-6136-0-77908000-1408477132.jpg](https://forum.midibox.org/uploads/default/original/2X/a/a481388b3aeea33fab43d0963f2afee6650a2df9.jpeg)

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 19, 2014, 10:29pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/8 "2014-08-19T22:29:07Z")

</div>

Hey,

&nbsp;

I tried it with your project.hex. Same here.

&nbsp;

Mysterious… Why should it have something to do with the hardware connections, when the changes in the software don’t work. Hm… okay… I will check all connections again…&nbsp;

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 19, 2014, 11:50pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/9 "2014-08-19T23:50:45Z")

</div>

Okay! After some other tests I think, the diode-matrix-layout / pinout of the keybed that I have is not correct. I attached the layout and the pcb-layout I created to build an adaptor. Everything should be fine. but it isn’t.&nbsp;

&nbsp;

I experimented with single pin-to-pin connections. When I connect the 1st and the 3rd pin of the **left** side to O7 and O6, the 2nd pin to I0 of J3 and I play the lowest note MIOS Studio outputs the correct note which is a-1.

If I now do exactly the same connections with the **right** side and press the according key (which should be the black key right next to C-3) I would also expect, that MIOS Studio outputs a-1 but nothing happens. I tried other keys, but none of them are sending values.

&nbsp;

I think that my adaptor (pin 1 is most left) should work if the pinout in the schematic is correct. If you have time, maybe you can look over it…

 ![post-10331-0-58205000-1408492240.png](https://forum.midibox.org/uploads/default/original/2X/3/31ed59ee2b378955bc0041ad1449d3484512f86a.jpeg)

 ![post-10331-0-66779900-1408492243.png](https://forum.midibox.org/uploads/default/original/2X/6/64df89f85c69bfb0404828f8310bb24411a624ea.png)

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 20, 2014, 9:15am UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/10 "2014-08-20T09:15:49Z")

</div>

I disassembled the PCB from the keybed so I can see the connections and the traces on the pcb.

&nbsp;

Conclusion: I am right. The pinout of the right side is totally different. I will write it down and check the it again.&nbsp;

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [August 20, 2014, 9:59am UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/11 "2014-08-20T09:59:25Z")

</div>

Hi Christian,

&nbsp;

I checked your adapter PCB and it seems to be correct.

&nbsp;

2 possibilities, which can cause your troubles:

1. Fatar has changed the pinning of the right half of the scan matrix on the \_ **TP100** \_ keyboard  
The scan matrix schematic relates to \_ **TP/8/9.** \_
2. The top right ribbon cable Connector \_ **\_TO\_JP2** \_ is plugged in reverse order.  
(I know, it is a very stupid idea, but it may be worth for a try)

Best regards,

Jo

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 20, 2014, 11:44am UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/12 "2014-08-20T11:44:49Z")

</div>

Hi Jo!

&nbsp;

The schematic is from a 5-page-datasheet about the TP/100. I think it has more something to do that studiologic let fatar produce a specific design which fits their acuna electronis (my TP/100 is a sparepart from an acuna).&nbsp;

&nbsp;

I already checked it… the connections are wrong! It has nothing to do with reversed pins ;)&nbsp;

&nbsp;

As soon as I wrote it down correctly I will post the informations here.

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 20, 2014, 2:56pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/13 "2014-08-20T14:56:06Z")

</div>

New test results:

&nbsp;

I checked the pcb of the keybed. It seems that the pcb is prepared not to be used with the foil-cables only. Next to the foil-connector there are smd pads. I think, that I could add a standard micromatch-connector to the board. This made it easy to see, which pins are connected to something. Because I don’t have a micromatch-connector here, I added a standard 20pin ribbon cable.

I realized, that there are a lot of pins left open. As you can see in the pic the top row (which should normally contain the row-signals) has no traces except for the last two pins (pin 1 is most right).&nbsp;

I removed the rubber contacts to see where the traces are going to. The lower row of the connector leads to the makes and brakes, the top row to the diodes.

&nbsp;

I connected pin 1 and 3 of the right side (MK5 and BK5) directly to the DIO to O5 and O4 of J4. Result: I can get the first eight keys of the right half working with the correct note-output: C#3 - G#3.

But now I don’t know where to connect the other pins. I tried to connect MK6 and BK6 to MK0 and BK0. This leads to the problem mentioned above: The triggered notes are starting at a-1. So:

C#3, D3, D#3, E3, F3, F#3, G3, G#3, a-1, b-1, etc.

&nbsp;

Connecting MK6 and BK6 to O3 and O2 of J4 don’t have any effect. And again: Adjusting din\_key\_offset has also not effect.

&nbsp;

The fact, that I can trigger C#3-G#3 without connecting any rows of the right half leads to the assumption, that there this will might not function correctly without adjusting the firmware.

&nbsp;

Any tipps how to proceed?

Thanks!  
Chris

 ![post-10331-0-07993600-1408546564.jpg](https://forum.midibox.org/uploads/default/original/2X/8/87a9f9a68b6ddadc4728cf9692228b024c88a6c9.jpeg)

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 23, 2014, 9:54pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/14 "2014-08-23T21:54:13Z")

</div>

I attached the electrical schematic how I think it’s correct.

&nbsp;

Are there any chances to get it running with KB?

 ![post-10331-0-93816100-1408830836.jpg](https://forum.midibox.org/uploads/default/original/2X/0/045553d204b01c8e0bc8883de823477e2e1e2232.jpeg)

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [August 24, 2014, 11:03am UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/15 "2014-08-24T11:03:41Z")

</div>

Hi Christian

The connections Fatar (StudioLogic) uses, seems to be related to a 8-Bit microcontroller. E.g. BR0 & BR5 can not be scanned in the same scan run because L & R Return Lines (T0..7) are tied together. This doubles the scan runs.

Instead of BR0/5,…, BR4/9, BR10 and reading LH T0..7 & RH T0..7 as one 16-Bit value you have to scan BR0 and reading T0..7, BR1 and reading T0..7, etc.

If You see a chance to cut the connections between the LH and RH T0…7 in your recent schematic , you can use the DIO with the Connection scheme for the 88 Key TP8/9 keyboard. (Your adapter PCB shown at 2014-08-20)

Regards,

Jo

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 24, 2014, 5:17pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/16 "2014-08-24T17:17:39Z")

</div>

Hey Jo!

&nbsp;

Thanks!

I think, this would be possible. But this is a huge modification on the pcb. So… I would prefer a solution on the software-side 😉

But if this is not possible, of course I would modify the pcb.

&nbsp;

Thanks,

Chris

---

<div class="post-metadata">

**Author:** ![nlate](https://forum.midibox.org/letter_avatar_proxy/v4/letter/n/d26b3c/32.png) [@nlate](https://forum.midibox.org/u/nlate)\
**Post date:** [August 24, 2014, 6:17pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/17 "2014-08-24T18:17:08Z")

</div>

Christian,

It is not only SW you also need additional HW (HC595) because you have to scan BR0..10 and MK0..10 = 22 scan lines.

This means 3 Shift registers. This can’t be done with 1DIO Module.

On my TP9 there are a lot of bridging wires (Loetbruecken), may be the bridging on TP100 between LH and RH T0..7 is also achieved in the same manor.

Regards,

Jo

---

<div class="post-metadata">

**Author:** ![FantomXR](https://forum.midibox.org/letter_avatar_proxy/v4/letter/f/3d9bf3/32.png) [@FantomXR](https://forum.midibox.org/u/FantomXR)\
**Post date:** [August 24, 2014, 7:13pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/18 "2014-08-24T19:13:28Z")

</div>

Okay, I see your point!

&nbsp;

I tested with a multimeter. My assumption is correct. Both sides share T0-T7. So the only solution is what you already suggested.

Good to know 🙂 I will go into it in the upcoming week.&nbsp;

&nbsp;

Thanks for your help!

&nbsp;

BTW: Here is a build recently finished!

\<\_\_\_base\_url\_\_\_\>/gallery/image/2472-10632811-1484848078428423-8171946334922042106-n/?do=embed

&nbsp;

---

<div class="post-metadata">

**Author:** ![Shuriken](https://forum.midibox.org/user_avatar/forum.midibox.org/shuriken/32/149_2.png) [@Shuriken](https://forum.midibox.org/u/Shuriken)\
**Post date:** [August 25, 2014, 3:27pm UTC](https://forum.midibox.org/t/din-key-offset-not-working-on-ng-kb/18519/19 "2014-08-25T15:27:33Z")

</div>

Looks very very good, nice job!
