The MIDI Forum

  1. Matthias
  2. MIDI Specifications
  3. Thursday, 17 September 2020
  4.  Subscribe via email
Hi,
I created a small add-on board for a Raspberry Pi Zero W. The initial goal was to convert OSC and Bluetooth MIDI to i2c, this part works well but on a later revision of the board I decided to add a Serial MIDI header for both input and output.

I must have made a newbie mistake because I can't get Serial MIDI IN and OUT to work simultaneously. At first I tested the Input and the output separately and they seemed to work, it's when I tested the input and output together that I noticed something must be wrong with my circuit.
I don't have an oscilloscope so it's quite hard to troubleshoot. For testing, I'm sending Midi notes from Max/MSP and the Node.js script on the Raspberry Pi is supposed to pass the MIDI messages to the serial MIDI output. I also have another test function in my script that just sends a note message to the output whenever it receives an OSC message. TTYmidi logs the serial input and the messages supposed to go to the output but these messages are never sent from the RPI. It used to work without any MIDI in connected to the PI but now I can't get the serial midi out to work anymore...

There's also a THRU (4, 5) on my header and I suspect this might be the cause of the whole issue but I'm not sure. Anyway, I don't think this THRU output is working properly either, it should replicate any MIDI message sent to MIDI IN, am I correct ? I need to test this again but I don't think it does.

In Idle state, I measure 4.980V at pins OUT4 and OUT5, this is the normal behavior, right ? I havent measured the current loop yet. I used the 5V specification for the output and aSN74HCT14PWR and now I'm wondering if I was right to do that. I sometimes see MIDI circuits not using an hexinverter at all and connecting the PIN5 directly, through a resistor to the TX line of the processor but I wanted to protect the GPIO of the Raspberry Pi (they can't handle 5V) in case of a wrong connection. Maybe the hexinverter/Schmitt trigger I chose is wrong ? I was really looking for a small part because there ain't much space on the PCB... The optoisolator on the input is an ACPL for the same reason, it's really small :)

Well, here's the schematic of my MIDI circuit, I would really appreciate if someone more experienced than me could have a look at it and tell me if I messed up something on the hardware side, otherwise I should try to search on the software side, but appart from ttymidi and the basic changes made in config.txt, I'm not sure there's much to change.

Thanks.


Capture d’écran 2020-09-17 à 13.08.14.png

P.S: There's no issue with USB MIDI and Bluetooth MIDI, only with the serial output apparently.
Attachments (1)
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Following your recommendation I've modified my schematic...

I think the "Thru" output is not really necessary for my project so I went with the single IO buffer version (that would be the SN74LVC1G34DBVR If I'm correct) of the one you recommended. I might modify it again for the dual buffer in case I chose to add a LED for monitoring the midi traffic; not decided yet ;) The package and footprint is the same after all.

I have a question regarding the 1k resistor that should be added in parallel to the 1N4148 diode. Could you confirm that it needs to go between the diode and the ACPL-M61L please ?

Thank you very much.

Capture d’écran 2020-09-19 à 17.59.33.png
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. MIDI Specifications
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Thanks for your reply and for confirming that the circuit is apparently correct.

I just did the test by plugging RX to TX directly (without the board, only the RPI) and sending an OSC message via Max to run my test function.
This function only sends a dummy "note on" when triggered via OSC but I forgot to remove another Midi "pass-thru" function present in the same script so this created a huge loop but yes it seems to be working just fine :D

Capture d’écran 2020-09-17 à 19.32.58.png

It's probably not a software issue then and the GPIO are not damaged. I also did more tests with the Midi input circuit earlier today, it seems to work consistently, unlike the Midi output. The output was sometimes working yesterday but not anymore. The soldering looks correct, I have no idea what's wrong.

I was just reading the datasheet and the suggested schematic of the component that you mentioned, the SN74LVC2G07 and I think I will just make a new revision of the board using this Non-Inverting buffer and the 3.3V (modifying the resistors value accordingly). It will probably be simpler than using two pairs of IO on the hexinverter.
I will also add the parallel 1k resistor to the input circuit as you suggest ;)


Thanks again.
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. MIDI Specifications
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
There appears to be nothing wrong with this circuit. If you ignore this board and just connect TX to RX at the RPi, is it able to receive what it sends out?

The original MIDI specification used a hex inverter because that was all that was available then. If you want to save space, use an SN74LVC2G07 running at 3.3 V (both inputs and outputs are 5 V tolerant).

The typical switching threshold of this optocoupler is 0.7 mA. To increase the noise margin, add an 1 kΩ resistor in parallel with D2.
Comment
There are no comments made yet.
  1. more than a month ago
  2. MIDI Specifications
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!