Converting a Yamaha keyboard assembly with a Teensy to a MIDI controller

Status
Not open for further replies.

ptran3014

Member
Hello all,

I have a spare Yamaha keyboard assembly part #WH757100. This keyboard is used on Yamaha CVP-409 and CVP-509 digital piano. I need to convert this keyboard to a MIDI controller.
There are three microcontroller chips on this keyboard: PD780031AYGK-N06 (X2599200) E-TKS.
The output connector of this keyboard has two signal pins: SDA0 and SCL0 which are come out from pin 13 & 14 of the micro controllers PD780031AYGK-N06. I need to know the output of this keyboard which is compatible with a UART so that I can use the Teensy to make it works.

I need more information of the controller chip PD780031AYGK-N06. I cannot locate the datasheet of this chip. Does anyone have it? I need to know the description of the pins: 13 & 14 of this chip.

Please help.

Thank you,

Peter
 
Last edited:
Good luck!!

SDA0 and SCL0 are traditionally 2 wire i2c names.... data and clock.
 
Thank you for your feedback. I think the Teensy board will work but really don't know the function of those pins of the PD780031AYGK-N06 (X2599200) E-TKS microcontroller. The 2 output signals are fed to an AND gate chip 7408 then goes to a main processor.
 
Thank you for your feedback. I think the Teensy board will work but really don't know the function of those pins of the PD780031AYGK-N06 (X2599200) E-TKS microcontroller. The 2 output signals are fed to an AND gate chip 7408 then goes to a main processor.

I can guess that the PD chips are part of the keyboard matrix and the 7408 is some kind of shift register maybe and the main processor is the .... main processor ..... maybe you would be best to create your own key matrix and feed a teensy .... teensy's are cheap and plentiful, so maybe you could use several of them to feed another teensy ... in other words use the key bed only, wire it up to teensys and bypass all the current electronics.

EDIT: ages ago I saw a project online where a guy took a toy keyboard and an arduino and created a midi controller!! So it can be done ... I will find the post somewhere ...

EDIT EDITHere is the project .... he is using the built in matrix .... your keyboard might be organised differently ..... Anyway, the point is to find the digital ons and offs of the keys and then hook a teensy or two or a shiftregister or whatever up, to then get your data to a central teensy ...
 
Last edited:
I know what I am looking for now. I need to interface this keyboard with a Teensy by a I2C bus. Can you tell me where I can learn this?
 
I know what I am looking for now. I need to interface this keyboard with a Teensy by a I2C bus. Can you tell me where I can learn this?

The teensy 3.x has a hardware i2c port .... the wire library supports it. *google* is your friend and there are many experts on this forum who can help with i2c ...I am not one of them.
 
Pictures of the board would be a good start.

Is this part of a keyboard? What is this 'assembly' part I can't find a reference to it

If the device is an I2C slave things will be more tricky if you do want to reverse engineer the I2C protocol
 
Do you, by any chance, also have a fully assembled Yamaha piano available? Probing an existing known-good bus helps a lot in reverse engineering.

Reverse engineering can be an ambitious project. Take your time learning about the I2C bus and the basics, break all task down into smaller unis that you can work on one at a time. And post some pictures, that always helps (us) :D
 
This keyboard has 3 circuit boards on the bottom. They are connected by the same bus. The output connector has 7 pins:

Connector: CN2 7-pins
1: E-IC - Reset the 3 microcontrollers - Active low
2: GND
3: SDA
4: GND
5: SCL
6: +5V
7: +5V

This is what I think it should be done:
Connect the Bus Pirate into this connector to sniff the data send out for each key. From the collected data, writing a code for Teensy to send out MIDI to the USB port. I know reverse engineer will be the pain and challenging task. I really don't know it is slave(a) or master(s) on the I2C bus however this is the piano keyboard and always waiting for users to press then it will send the data out to the main CPU. I would assume three microcontrollers on the keyboard are masters. The three microcontrollers receive keys press or release actions, they will send an interrupt signal to the main CPU to indicate there are data. In this case, the three controllers are slaves.
Can you tell by looking at the circuit diagram? There is an AND gate output names Ebus-Data which is sent to an input of the main CPU.
Keyboard Block Diagram.jpgConnector (2).jpgEbus-Data.jpg
 
Last edited:
Two general notes about i2c:

1) Your i2c board lists 5v. The Teensy runs at 3.3v. You will need to do voltage level shifting between the Teensy and your devices. The Teensy 3.2 is tolerant of digital input pins receiving 5v, but it will only send out 3.3v signals.

2) A Teensy needs external pull-up resistors between each of the two pins (A4/18 and A5/19) and 3.3v. Typical values for the resistors run from 2.2K to 4.7K.

The Wire library (which is the standard i2c library on the Teensy) has an example Scanner.ino which you can download to your Teensy, and it will show all of the i2c devices that are connected to your system on the serial output monitor.
 
Two general notes about i2c:

1) Your i2c board lists 5v. The Teensy runs at 3.3v. You will need to do voltage level shifting between the Teensy and your devices. The Teensy 3.2 is tolerant of digital input pins receiving 5v, but it will only send out 3.3v signals.

2) A Teensy needs external pull-up resistors between each of the two pins (A4/18 and A5/19) and 3.3v. Typical values for the resistors run from 2.2K to 4.7K.

The Wire library (which is the standard i2c library on the Teensy) has an example Scanner.ino which you can download to your Teensy, and it will show all of the i2c devices that are connected to your system on the serial output monitor.

Thank you for your information.
Based on the AND gate circuit, I believe the micro-controllers on the keyboard are set as masters. Because every time a key is pressed or released, the info are sent to the main CPU.
I need to ask you questions about the Teensy:
1. Can I set the I2C port of the Teensy to be a slave one?
2. How can I set the address of this Teensy I2C address? In the eeprom?

Thank you,

Peter
 
Last edited:
When you call the Wire.begin function, if you don't pass an argument, the Teensy will be the master. If you pass an argument, the Teensy will be the slave. http://www.pjrc.com/teensy/td_libs_Wire.html.

Since you are programming the Teensy, you can change the code to use whatever address you want. You can use EEPROM if the address is variable, and you want to save it from session to session: http://www.pjrc.com/teensy/td_libs_EEPROM.html.
Thank you, I understand now. I need to have a Bus Pirate device to read the keyboard for the slave address when a key is pressed or released. I think the Yamaha keyboard controllers are the masters, I need to know what address they send the data to.

By the way, because the I2C bus is used for MIDI, is it possible for the controllers on Yamaha keyboard transmitted data at a different frequency rather 9600 as the default speed for MIDI?
Or when the Teensy is set as a slave, I don't need to set the speed for it?
 
By the way, because the I2C bus is used for MIDI, is it possible for the controllers on Yamaha keyboard transmitted data at a different frequency rather 9600 as the default speed for MIDI?
Or when the Teensy is set as a slave, I don't need to set the speed for it?

I could guess that the i2c buss is at full(ish) speed (by the way, I suspect that the controllers are slaves, since multiple masters doesn't sound right to me, but I am no expert, as I have said).

those signals are probably briefly buffered or queued for processing, by the host...

*Serial* midi is at 331250.

if you are using USB, then just go fullspeed ... you may not need buffering .... and is it that likely that all keys will be pressed all at once??
 
Well, I think it over and agree with you at some points.

I look at the bottom of the keyboard, three circuit boards named as:

HIGH: GH3-A88-H X2179
MIDLE: GH3-A88-M X2178
LOW: GH3-A88-L X2177

If all three controller chips are slave then the main CPU must be in polling mode to look at the keyboard buffer so often. This scheme will reduce the performance of the whole piano. The reason I say this because I don't see any interrupt signal come out from the board except the above 7 pin connector. And a pianist can press many keys simultaneously, all controller chips cannot be masters because only one can send data out at one time. With this condition in mind, one of the three controllers is master, the other two are slave. I would say this:
1. The I2C port of the main CPU is master, the I2C ports of keyboard controllers are slave. The main CPU needs to communicate with the keyboard so often, I think it is so busy by polling the keyboard buffer.
2. One of controller on the keyboard is master, the others are slave, including the main CPU. When a user presses keys on the keyboard, the master controller will send the data out to the main CPU.
Do you agree with me about this? By the way, do you see the AND gate circuit above? The inputs are SDA and SCL go through this AND gate, the output names EBUS-DATA is connected to the main CPU. It looks like the main CPU does not care the I2C bus signal, it only needs this EBUS-DATA line. I don't see the I2C bus is connected directly to the main CPU.
 
Last edited:
I have no idea!!

I think the EN -IC line is a reset enable line ... I have one i2c device (a screen) that uses a reset line ... not compulsory ...

I am guessing that all three are slaves and the central controller is the master ....

if you think about it, the i2c buss can run pretty fast 400k -1 Meg???

You might be right about i2c polling .... but 400k is pretty fast!! we are talking 40 monkeys hitting 400 keys for 10 millisecond ... so really its not a problem ...

you can barely hit a key for 10milliseconds .... the *rising edge* of a key is in the order of 1.5 millis ... And in any case the teensy processes instructions in MICROseconds

on the other hand maybe each microcontroller goes into master mode to send .... I don't know.

I guess this is the joy of reverse engineering!!?!

there is a sniffer program available, and maybe an oscilloscope is called for!!!
 
I have no idea!!

I think the EN -IC line is a reset enable line ... I have one i2c device (a screen) that uses a reset line ... not compulsory ...

I am guessing that all three are slaves and the central controller is the master ....

if you think about it, the i2c buss can run pretty fast 400k -1 Meg???

You might be right about i2c polling .... but 400k is pretty fast!! we are talking 40 monkeys hitting 400 keys for 10 millisecond ... so really its not a problem ...

you can barely hit a key for 10milliseconds .... the *rising edge* of a key is in the order of 1.5 millis ... And in any case the teensy processes instructions in MICROseconds

on the other hand maybe each microcontroller goes into master mode to send .... I don't know.

I guess this is the joy of reverse engineering!!?!

there is a sniffer program available, and maybe an oscilloscope is called for!!!

The EN-IC line connected the RESET inputs of three microcontrollers on the keyboard. This line goes low to reset the controllers on the keyboard.
Well, I read the specification of the I2C again. I2C allows up to 127 devices connected together, the bus is bi-directional but only half duplex (either transmitting or receiving but not both). It does allow multiple masters on the same bus. The way it works is the low start bit signal will determine to control the BUS at that time (will not create a collision like Ethernet hub). Like I said, there is an AND gate which combines both SDA and SCL signals together and the output is fed to the input of the main CPU. Yamaha called this signal: EBUS-DATA. I need your inputs about this line. How does the CPU read data of this line?

I will buy a BUS PIRATE device to sniff the signal. I will post the results for you all later.


Keyboard Controller.jpg
 
Last edited:
The EN-IC line connected the RESET inputs of three microcontrollers on the keyboard. This line goes low to reset the controllers on the keyboard.
Well, I read the specification of the I2C again. I2C allows up to 127 devices connected together, the bus is bi-directional but only half duplex (either transmitting or receiving but not both). It does allow multiple masters on the same bus. The way it works is the low start bit signal will determine to control the BUS at that time (will not create a collision like Ethernet hub). Like I said, there is an AND gate which combines both SDA and SCL signals together and the output is fed to the input of the main CPU. Yamaha called this signal: EBUS-DATA. I need your inputs about this line. How does the CPU read data of this line?

I will buy a BUS PIRATE device to sniff the signal. I will post the results for you all later.


View attachment 7828

It looks from the schematic that you can take the i2c without clock and data being anded together.. quite how this works is not immediately apparent to me ...
 
I have a Yamaha CLP-110 here, I'm tempted to open it up and take a look if it's similar...
 
I have a Yamaha CLP-110 here, I'm tempted to open it up and take a look if it's similar...

Great, what is the production year of the Yamaha CLP-110? I hope you have the same keyboard as mine.
The keyboard was used in CVP-409, CVP-509... These pianos were manufactured in 2008, 2009.
 
Last edited:
It looks from the schematic that you can take the i2c without clock and data being anded together.. quite how this works is not immediately apparent to me ...

Here is some information of the main CPU:
HD6417727F160
Hitachi / Renesas
Renesas 32-Bit RISC
Microcomputer
SuperH™ RISC engine Family/
SH7700 Series

The output of the AND gate called EBUS-DATA is fed to the input pin 149 of the main CPU above: Pin 149, IOIS16/PTG[7] - PCMCIA. Inside the CPU chip has register(s) to read the data come in from this pin. As you know, PCMCIA is an old technology. Maybe the data format is similar with the I2C bus.
 
Great, what is the production year of the Yamaha CLP-110? I hope you have the same keyboard as mine.
The keyboard was used in CVP-409, CVP-509... These pianos were manufactured in 2008, 2009.

I *think* its from 2001 or 2002, not sure. But definitely older than the models you mentioned.
 
Status
Not open for further replies.
Back
Top