Tuesday 3 April 2012

Decoding the PG-200

Just did something cool - I used a logic probe and decoded the PG-200 protocol :) I've identified the address of every switch, button and potmeter. However, since two of the rotary switch shafts on my PG-200 are loose, I have to get the multimeter out and do some measuring of the various position to verify that some of the logic measurements are correct.

So far I can tell the following about the PG-200 (partially from the service manual, partially from my research.

The manual says that the dataformat is asyncronous serial start-and-stop. The PG uses a 0 as a start bit and 1 as a stop bit (or stop period, as it runs untill a new start bit is encountered).

The data format is 9 data bits, no parity. The 8 first bits are address or data bits, the 9th selects either data or address. 1 is address, 0 is data.

Each potmeter sends two frames, one with the address and the second with the value
Switches are sent as three frames and are grouped as they only require 1 bit per state (or two for up to four states as is the case with the rotary switches). The first frame is the address of the group, the second is a bitmask saying which bits in the third frame to look at, the third frame is the state of all switches within that group.

From experimenting I've figured out the following:
The output from the PG is inverted, 0 is high and 1 is low
The bitrate is 31.5kb/s, which makes sense since the transfer line is connected to the same data RX line as the MIDI in (which of course is also 31.5kb/s

There are three switch groups, with addresses 1-3
There are 18 potmeters with addresses from 16 to 33

I will add the addresses and bits in groups for all controllers as soon as I have decoded the last rotary switches.

11 comments:

Unknown said...

Yes man, thats great! I´m searching for this. Did you find out all parametres?

Unknown said...

do you mean the roland controller? I´m searching for this data, would be great if you can analyse it! Looking forward

Joakim said...

Yeah, it's the Roland controller. I have most of it done, but as I'm moving house at the moment all of my stuff is packed in various boxes :-)

I will try to find it as soon as possible. I remember having a bit of a challenge with the rotary switches, as I cannot quite get the readings from the probes to match what is described in the manual, but I could still provide the preliminary results of course :)

Unknown said...

ok, great. Do you think it might be possible to access the synth with a modified cable (midi to 6-pin)? My plan was to make a max4live patch using the pg200 protocol and to send the messages from pc (mididevice) to the JX3P. I´m not sure if it´s possible..

Joakim said...

Unfortunately I doubt that just modifying a cable does the trick - the problem is that MIDI uses an 8 bit data format (1 bit to indicate if the byte is control or data, and 7 bit for the value), whereas the PG-200 uses 9 bits for each block (8 data bits tailed by 1 bit to indicate if the address or data). Even if you could make the cable/voltages/signaling rate compatible, I don't think your software could generate the necessary messages as they are not MIDI-compatible. I could be wrong however, it all depends on the flexibility of the PC software.

If it is NOT possible, it wouldn't be too hard to make a tiny hardware device to plug between the midi cable and the PG-200 input on the JX-3P, one that translates midi into PG-200 signals. As the JX-3P already provides power to the PG-200, no additional power supply would be necessary.

Unknown said...

yes you are right for sure with the bits. max could generate any kind of protocol data, but it´s not sure if a midi-device could transmit these strange pg-200 language. I agree, a hardware translator would be necessary. There is a modified chip for the JX3P from Kiwitechincs wich will allow the midi ports to accept CC control data. That solves the problem and costs 200€. Maybe I get that for now, but I´d still like to work on this attempt. So keep me updated plz!

Joakim said...

The Kiwitechnics mod is sweet, but a tad pricy - but I would love to have it on my JX-3P in any case (but my bad habit of buying new synths on the spur of the moment means I never get around to buying upgrades for the ones I already have ;-))

I'll keep you posted on what happens with the PG-200 research.

Joakim said...

I created a schematic for the necessary hardware converter yesterday, but I need some feedback on how to make the software work with any controller or dav out there. My initial thought is to assign each parameter a custom sysex value (and possibly make this user configurable).

I am also considering whether to include a 6 pole socket for the device-to-jx3p cable, or to just solder a 6 pole cable directly to the device. Very few people have a 6 pole cable laying around anyway, so it may be better to just have a cable. It also means I can make the device quite a bit smaller, maybe as small as 3 x 3 x 6 cm.

Considering the inflated price of the PG-200, how much do you think people would be willing to pay for such a converter?

If you are interested in helping me out with some ideas for the design of the box and what params to use for controlling the Jx3p, I'll send you a prototype :) Just send me a private message or comment here (I will not approve the comment, so your email address will be hidden) if you are interested.

lematt said...

I'm quite interested by this idea.

wouldn't an arduino be able to emulate a PG200 ?

what are the messages sent by the PG 200 ? is that sysex ?

Joakim said...

I assume an Arduino would be able to do it, as long as it is capable to generate 9 bit serial async signals - you just have to wire it up correctly to generate the inverted signal the JX-3P requires.

The protocol is unfortunately not sysex, it is proprietory. The format is described in the JX-3P service manual but the values to send are not.

I have made a prototype that takes midi in and outputs midi AND PG-200 data on separate cables. The problem with the JX-3P however is that it cannot receive both PG-200 and midi note on/off messages at the same time. I have made a fix for this that require you to solder a cable between two points on the input board of the JX-3P, but even with this you cannot do both at the same time - you have to wait for a fraction of a second between sends as the JX-3P's internal processor needs to detect the change.

The two common kits out there, Kiwitech and the other one, supply a new ROM (containing modified software) to get around this, but that also means that it is much more invasive than just doing conversion between midi and PG-200 formats...

Joakim said...

Check this post for more info: http://atosynth.blogspot.no/2013/03/stand-alone-prototype-finished.html