nrf52480 Feather: Can only send 4 byte MIDI SysEx messages

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
queenmaev
 
Posts: 2
Joined: Tue Mar 26, 2019 7:14 pm

nrf52480 Feather: Can only send 4 byte MIDI SysEx messages

Post by queenmaev »

Hi!

I have been working on a project where I am required to send several floating point numbers via MIDI over BLE. I decided to use real-time sysex messages as no other message within in the MIDI v1.0 spec would contain the 7 plus floating point numbers I need to receive from the feather.

However, I am finding that when sending them as raw bytes, I am only receiving a four byte message consisting of the sysex start byte (0xF0), two bytes of the data, then the sysex end byte (0xF7). The rest of the data is then interpreted as whatever either the MIDI.h or BLEMidi.h libraries interpret the rest of the bytes of data to be.

I have tried to use both versions of the MIDI.sendSysEx() function but whether I provide the start and end bytes or not, the message data is still reduced to two bytes with the start/end bytes on either side. Digging through the source code of both FourtySevenEffects MIDI and the Adafruit BLE MIDI libraries has me wondering if there is something I am not setting up properly in MIDI.h or a problem with how the BLEMidi.h send functions detect sysex messages and tries to terminate them properly. Either way, my eyeballs are bleeding and I am frustrated.

For simplicity, I reduced my code and placed it in the blemidi example for testing. I removed the scale playback and inserted this:

Code: Select all

union DataArray {
    float values[2];
    uint8_t bytes[8];
  } data;

  data.bytes[0] = 0x7f; // id = real-time message
  data.bytes[1] = 0x00; // dev id
  data.bytes[2] = 0x01; // sub id #1
  data.bytes[3] = 0x02; // sub id #2

  data.values[1] = 22.7;

  uint8_t test[10] = {0xf0, 0x7f, 0x00, 0x01, 0x02, 0xff, 0xff, 0xff, 0xff, 0xf7};

  //MIDI.sendSysEx(10, data.bytes);
  MIDI.sendSysEx(10, test, true); 
Here is the output from Snoize's MIDI Monitor:

Code: Select all

21:16:49.944	From Feather nRF52840 Express Bluetooth	SysEx		Universal Real Time 4 bytes	F0 7F 00 F7
21:16:50.002	From Feather nRF52840 Express Bluetooth	Reset		
21:16:50.002	From Feather nRF52840 Express Bluetooth	Reset		
21:16:50.004	From Feather nRF52840 Express Bluetooth	Reset		
... [repeats indefinitely]
Thanks in advance for the help! Even if you can point me in the right direction or tell me how to just bit bang the stuff over, I will super grateful!

User avatar
queenmaev
 
Posts: 2
Joined: Tue Mar 26, 2019 7:14 pm

Re: nrf52480 Feather: Can only send 4 byte MIDI SysEx messages

Post by queenmaev »

I posted this problem in FortySevenEffect's MIDI library discussion page:

https://github.com/FortySevenEffects/ar ... ssions/316

It appears that I am not using the BLE transport that is included in the MIDI.h but Adafruit's? I saw that the code in BLEMidi.cpp detects if there is 0xF7 byte and attempts to close off the communication in the transport layer. Is it possible that the 0xF7 byte is automatically being sent early somehow? Anyone?

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”