Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Serial MIDI #20

Closed
probonopd opened this issue Feb 20, 2022 · 13 comments
Closed

Support Serial MIDI #20

probonopd opened this issue Feb 20, 2022 · 13 comments
Labels
enhancement New feature or request

Comments

@probonopd
Copy link
Owner

probonopd commented Feb 20, 2022

Currently we can play notes on a MIDI controller (keyboard) and (for testing and debugging) USB (QWERTY) keyboards.

In addition, we would like to support Serial MIDI, to connect older MIDI keyboards that don't come with USB using a circuit like this:

image

Image Source: https://hackaday.com/tag/6n137/

Connect the wire labeled "RX" to GPIO15 on the Raspberry Pi. This is a SoC number, not the position on the header (see this).

@probonopd probonopd added the enhancement New feature or request label Feb 20, 2022
@probonopd
Copy link
Owner Author

probonopd commented Feb 20, 2022

We need to use m_Serial (pInterrupt, TRUE, 5) as discussed here.

@dcoredump, it looks like the code for this would need to be added to Synth_Dexed next to m_pMIDIDevice as pointed out by @rsta2. If you can add it, I will be able to test it.

@rsta2
Copy link
Contributor

rsta2 commented Feb 20, 2022

Attached the patches for serial MIDI (tested). The UART input (RX) is at GPIO15 now, not 13 any more!!! This has changed, because the RPi 3 does not has an UART at GPIO13.

serial_midi_patch.zip

probonopd added a commit to probonopd/Synth_Dexed that referenced this issue Feb 20, 2022
probonopd added a commit that referenced this issue Feb 20, 2022
@probonopd
Copy link
Owner Author

Thanks @rsta2.

Getting

kernel.cpp: In member function 'virtual bool CKernel::Initialize()':
kernel.cpp:41:15: error: 'class AudioSynthDexed' has no member named 'Initialize'
   41 |  if (!m_Dexed.Initialize ())
      |               ^~~~~~~~~~
make: *** [../circle-stdlib/libs/circle/Rules.mk:143: kernel.o] Error 1
make: *** Waiting for unfinished jobs....

Did I do something wrong?

@rsta2
Copy link
Contributor

rsta2 commented Feb 20, 2022

@probonopd Can it be, that you haven't updated the Synth_Dexed submodule reference to the new master? It still points to a commit from 5 days ago.

@probonopd
Copy link
Owner Author

D'oh!

@probonopd
Copy link
Owner Author

probonopd commented Feb 20, 2022

Build succeeded but I can't get sound via serial on the RPi 3. Possibly it is the wiring on my side. What exact circuit are you using?

The UART input (RX) is at GPIO15 now, not 13 any more!!!

Out of curiosity, where was this changed in the code?

@rsta2
Copy link
Contributor

rsta2 commented Feb 20, 2022

I tested this with a normal USB-to-serial-adapter with PC Linux and a small C program as MIDI sender. For this test I modified the serial baud rate in MiniDexed to 38400, because 31250 cannot be selected on the PC (at least I do not know how). The adapter provides 3.3V signals, so I can connect it directly to GPIO14/15.

The UART GPIO mapping is here. That is the magic "5" in m_Serial (pInterrupt, TRUE, 5), which was there on the RPi 4 to select the device 5 (GPIO12/13) and is now gone, what means that the default value 0 is used. Device 0 is the standard UART available on all RPis via GPIO14/15.

@rsta2
Copy link
Contributor

rsta2 commented Feb 21, 2022

@probonopd One hint: The serial MIDI will only work, when USB MIDI is disconnected. You have to remove your USB MIDI keyboard for a test.

If you have a free Raspberry Pi Pico, you could use this project to connect a sequencer program, running on a PC, to MiniDexed.

@probonopd
Copy link
Owner Author

The serial MIDI will only work, when USB MIDI is disconnected. You have to remove your USB MIDI keyboard for a test.

Great hint, sure enough I had the USB MIDI connected in addition to Serial MIDI. It is still not working though, but most likely my selfmade MIDI Serial circuit to be the culprit. Will redo it with the help of an oscilloscope and logic analyzer once I find the time for it (might take a while). If anyone is faster and is successful in e.g., using a Serial MIDI keyboard, please let me know!

@probonopd
Copy link
Owner Author

Note to self: Retest this, then close.

@probonopd
Copy link
Owner Author

Device 0 is the standard UART available on all RPis via GPIO14/15.

@rsta2 are you saying we have bidirectional serial MIDI even?

@rsta2
Copy link
Contributor

rsta2 commented Mar 21, 2022

The UART driver is bidirectional, but it is currently not used in TX direction.

@probonopd
Copy link
Owner Author

probonopd commented Apr 5, 2022

Tested, Serial MIDI using a Raspberry Pi Pico sending MIDI notes to MiniDexed over serial; working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants