Troubleshooting a MIDI controller keyboard - Page 1
Forum section: electronics / beginners

author: paul49
author_rank: Contributor
timestamp: June 02, 2013, 01:56:03 am
content: Hi All,My first post here.I'm troubleshooting a Roland A-30 MIDI controller keyboard which I bought in the early 90's. It hasn't been used for almost 20 years. I bought one of the cheap MIDI-USB interfaces (which apparently vary considerably in quality) and loaded various software packages to test the configuration.The keyboard appears to be only sending occasional messages to the PC. It seems reasonable that the key contacts would need cleaning after years of lying around but it's also equally possible that I've bought one of the less reliable USB interfaces.So in order to remove some of the unknowns (PC and USB interface), I breadboarded one of the common opto-isolator circuits, connected it to MIDI-Out on the keyboard and connected my scope (DS1102E) to the output of the 6N138. (The Roland uses a 6N137 internally for its MIDI-In circuit but I could only buy a 6N138 locally).The first thing I noticed is a negative-going pulse 128 µS wide occurring every 20mS when the keyboard is powered on but sitting idle. It's nice and square except for the last 80mV or so on the positive edge. (This rounding might result from the breadboard or the 6N138?) There are also apparently random transients occurring at other intervals as well.When I press keys, I can sometimes see message data on the display - there should be a Note-On and a Note-Off message every time I press and release a key and I'm not seeing this most of the time.Unfortunately, the scope is doing its best to sync to the 50Hz edge and I don't know if it's possible to get it to ignore this and capture the message data instead - seems unlikely. It's "somewhat" more complex than my old 15MHz analog CRO.I did quite a bit of serial comms programming in assembly in the late 70's and early 80's and built some serial hardware to interface to the microcomputers of the time but I really can't remember any regularmarkpulse happening. The Roland manual talks about transmitting a time signal or F8 clock but I would assume that it would be a complete message and not just a single pulse.I suspect that the 50Hz waveform shouldn't be happening and especially nor should the random transients. The MIDI transport layer is asynchronous, I believe, and 50Hz doesn't meaningfully relate to 31250bps anyway. Perhaps someone can enlighten me?Since Roland has been kind enough to supply schematics and circuit diagrams, and since I'm resigned to stripping it down to clean the contacts, I can have a look at the power supply electrolytics and do some probing.I'm hoping that someone can offer some guidance and where to proceed from here. I've ordered some 6N137s but I don't think they will materially alter the symptoms I'm seeing.I was planning to connect the opto-isolator circuit to a microcontroller and write some code to analyse the messages but I don't think it would be very meaningful at the moment.Thanks,Paul.

author: David_AVD
author_rank: Super Contributor
timestamp: June 02, 2013, 04:36:27 am
content: Oxidised keyboard contacts would be the first thing to check / rule out I'd say. Just don't get too aggressive and end up removing the contact plating.

author: paul49
author_rank: Contributor
timestamp: June 02, 2013, 04:50:17 am
content: Thanks David,There's a nice photo essay on another site showing how to disassemble and clean a Roland D-50. It's probably essentially similar to the A-30.There's "only" 76 sets to clean.

author: SeanB
author_rank: Super Contributor
timestamp: June 02, 2013, 05:49:11 am
content: Can you find a plain old UART and breadboard it up and set it up and feed it with the required 2MHz clock to recover the data. A 6850? UART is hard wireable for baud rates, and will make a good data recovery device as well as giving error outputs. I have a whole lot of old UART chips that would do the job, from old terminals.

author: AndreasF
author_rank: Frequent Contributor
timestamp: June 02, 2013, 06:28:28 am
content: How accurate is your measurement of the 128us? Not all MIDI messages require several bytes. The MIDI clock signal you mention (0xF8) is part of the "System Real Time" messages that only have a single status byte. And if you think about what such a message would look like on a scope, it would be a negative going pulse for 192us (1 start bit + 5 logic one bits). The frequency of these is dependent on tempo:Quote from: Lehrman&Tully, MIDI for the ProfessionalI would think those can either be turned off completely (setting the device as slave), or changed in frequency (changing tempo). If we assume the signals you see are MIDI clock signals, then a 50Hz frequency corresponds to a tempo of 125bpm, a fairly normal tempo (120 is often a standard starting value).This of course doesn't explain why it's too short (128us instead of 192us). Assuming your measurement is accurate, maybe the baud generator on the Roland is off by a bit (too fast)? I would try measuring the distance between status and data bytes to see if it's in the right region. Easiest way to generate very frequent MIDI messages is via pitch-bend or the mod-wheel.(I recently built-up a simple MIDI input to my STM32F4-Discovery board and was seeing weird 1-byte messages, which I also thought must be wrong, but it turns out the MIDI controller I was using, an Evolution MK225C, was also sending "System Real Time" messages, in my case "Active sensing (0xFE)". I'm also using the 6N138 and it's working fine.)

author: Unknown
author_rank: Unknown
timestamp: June 02, 2013, 07:29:27 am
content: After 20 years... yeah, you should do some maintenance on it. Personally, I'd crack it open and check to make sure all the caps are still in spec. That's a long time to be sitting idle.If I were you (and you should be glad this is not the case) I'd probably be considering stripping the guts out and replacing them with something like an arduino, connecting to all of the existing controls and keys. I bet you could get more functionality out of it that way, and it'd be a fun project. But, not for everyone.(I'm a musician too so that kind of thing is near and dear to my heart)

author: David_AVD
author_rank: Super Contributor
timestamp: June 02, 2013, 12:13:46 pm
content: Also clean and reseat all connectors as that's also a leading cause of intermittent nonsense.

author: paul49
author_rank: Contributor
timestamp: June 02, 2013, 11:48:36 pm
content: Thanks everyone for the excellent advice.SeanB, A 6850? Now you're taking me back. I threw out boxes of hardware from the 70's, 80's and 90's a few years ago. Bound to be some old UARTs there. But AVR's/Arduinos have good USARTS if I get to that stage.duskglow, That was my Plan B if the electronics were dead. Perhaps even use a Beaglebone and get USB support as well. But it's already jumped my queue of projects so it'll have to wait.AndreasF, Thank you for pointing me in the right direction (and for restoring some memories from 30+ years ago). Now it's starting to make some sense.Assuming what I'm seeing every 20ms is the Timing Clock - 0xf8, then:-At 31250bps, 1 bit is 32µS wide.In this configuration, the MIDI data stream idles at 5V or Logic 1. The Start bit is 0V or Logic 0. It had slipped my memory but the bits are sent from LSB to MSB so we need to reverse the 0xf8 from 11111000 to 00011111 which means the Start bit is followed by 3 Logic 0 bits and then goes back to 5V for the 5 Logic 1 bits and the (Logic 1) Stop bit. The Start bit and 3 Logic 0 bits total 128µS which is exactly what I'm seeing on the scope.I had already tried to turn off the Time clock with no success. Either I'm not following the instructions correctly or the Roland expects to get an external Time clock as suggested in the manual and sends one anyway if it doesn't see one?You also mentioned Active Sensing which is a 0xfe byte. Apparently a few earlier MIDI devices implemented this (in particular, Roland). Roland admits that the A-30 sends Active Sensing messages and it can't be turned off. Depending on who you listen to, it is sent every 250 or 300 mS. Perhaps these are the spurious signals I mentioned in my first post. If I can learn how to configure the Rigol to look at them, it should be obvious as they will be 64µS wide. Maybe I should actually read the manual for the scope.I've been using a program called MIDI-OX on the PC which decodes and displays the MIDI messages. I've just noticed that it filters out System Real Time messages by default. So, if I can get the cheap USB interface to work, I'll turn Timing Clock and Active Sensing back on and see what it comes up with. At 50Hz, it will likely get swamped but it should be fun briefly.So I think with all your valuable help, I'm getting somewhere. The ugly part will be cleaning the key contacts.Any assistance from Rigol experts with the procedure for storing a trace would be greatly appreciated. (I know - Read the Manual...)Many Thanks again.

author: dentaku
author_rank: Frequent Contributor
timestamp: June 03, 2013, 02:16:30 am
content: Yup, MIDI-OX is quite useful for analysing everything MIDI.

author: paul49
author_rank: Contributor
timestamp: June 03, 2013, 03:46:52 am
content: Quote from: David_AVD on June 02, 2013, 12:13:46 pmI like that, David. Covers a multitude of situations.

author: David_AVD
author_rank: Super Contributor
timestamp: June 03, 2013, 03:52:12 am
content: Quote from: paul49 on June 03, 2013, 03:46:52 amYou'd be surprised the number of times I've seen a bunch of bat shit weird symptoms in equipment caused by simple corrosion in connectors.

author: paul49
author_rank: Contributor
timestamp: June 03, 2013, 11:39:11 am
content: Quote from: paul49 on June 02, 2013, 11:48:36 pmAfter much plugging and un-plugging, disabling and enabling drivers, the MIDI-USB interface was finally kind enough to start working (for a short time).I removed the filters on System Realtime Messages and MIDI-OX started displaying lots of Timing Clock messages, somewhat fewer Active Sensing messages and occasional batches of Start messages.Then the messages began slowing down and eventually stopped.Oh well, at least we know we're on the right track.Time for a tear-down.

author: paul49
author_rank: Contributor
timestamp: June 09, 2013, 09:02:41 am
content: This "little" project/journey is becoming increasingly interesting and frustrating...I had the screwdriver ready to pull the keyboard apart and thought I'd just try one more thing. After downloading and perusing the manual for a later but similar Roland keyboard, it became apparent that the manual for mine left out one important step. So now I can disable the Timing Clock messages every 20ms.Hooked up the opto-isolator and scope and now it's syncing on the Active Sensing messages which, as predicted, go to 0V for 64µS. However, Active Sensing isonlysent when there is no activity on the bus. So as soon as I pressed one of the keys, Active Sensing messages stopped and the scope synced on the Note On message and then on the Note Off message. After 15 minutes of poking at keys, it appears (at least as far as I can tell from the scope display) that, after 20 years of inactivity, the keyboard is working correctly.Unfortunately, the garbage $5 MIDI to USB interface now won't talk to the PC at all.The frustrating part is that, after spending hours searching musical instrument forums, it's not obvious that buying a more expensive MIDI to USB interface would actually let me play it. There are a number of unknowns on theotherside of the USB port.I didn't think it was going to be easy...