1

I am currently looking at using an Arduino Mega to build a MIDI Receive box that will then pump the data over USB, but am having design issues/uncertainties with the Arduino's receiving end.

I am looking to having (hopefully) 16 MIDI (as 5-pin DINs) inputs on this build, with no outputs other than the USB. The Mega has the 4 Rx pins, which still leaves me with 12 to create in software. From what I've read it appears that SoftwareSerial will not support simultaneous reads from different inputs, while AlftSofSerial does. However, it also appears (at least from what I've gathered) that AltSoftSerial is not supported on as many pins as I would need to make this work.

With my setup up, not all 16 MIDI devices would be sending data into the Arduino at once, but only 2 - 4; these would be operating at the same time though (i.e. a Keyboard note along with a volume fader), so I don't believe SoftwareSerial would work well for what I need.

Is it possible to work out what I need with SoftwareSerial/AltSoftSerial and the physical UARTs? If there's any necessary info that seems to be missing or I seem to be misunderstanding something, please let me know. Thanks!

  • It seems altsoftserial only supports one instance. Do you only need RX for MIDI? What baudrate? – Gerben May 11 '18 at 18:37
  • For such a specialized application, you probably cannot rely on a library and have to program the hardware directly. – CL. May 11 '18 at 18:38
  • @Gerben I do only need it for MIDI. I was using 9600 in my hardware "tests" with only one device and it seemed to be working fine. – som3oneMw May 11 '18 at 22:01
  • @CL I'll have to look up how to do this. Any helpful links to point me in the right direction? – som3oneMw May 11 '18 at 22:06
  • AVR304 might be a start. But you need enough knowledge and experience to write your own AltSoftSerial library and to improve on that. – CL. May 12 '18 at 6:53
0

From what I've read it appears that SoftwareSerial will not support simultaneous reads from different inputs

Correct. You can only listen() on one instance at a time.

AltSoftSerial can only support 1 instance, but allows simultaneous transmit and receive, and doesn't block the whole system while either transmitting or receiving.

So the best you can hope for is 4 hardware UART and one AltSoftSerial for 5 ports.

I would suggest looking into the possibility of using multiple Arduino Mega boards with 4 ports on each (4 boards would give 16 ports in total) and have them communicate with each other through some other protocol (SPI or I2C for instance).

  • I had initially considered a setup similar to this, but had shrugged it off in an attempt to cut down costs, but looks like that may be the route to travel. Do you happen to know if there is another device with more UARTs? I was looking at the newest version of the Teensy, but it still only has 6. – som3oneMw May 11 '18 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.