Recieving Midi Sysex Comands

15 views
Skip to first unread message

Alexander

unread,
Mar 21, 2020, 2:18:00 AM3/21/20
to LUFA Library Support List
Hey everyone,

i am trying to recieve midi sysex data over USB. I can succesfully recieve midi note on messages and tried to modify the code, so midi sysex messages get recieved.
Unfortunately i have no luck in getting it to work. Maybe someone has an idea.

recieve_usb() {
    MIDI_EventPacket_t
ReceivedMIDIEvent;
   
while(MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent)) {
       
// check if its a note on event
       
if(ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_NOTE_ON)) {

           
//do stuff
                       
       
}
       
//check if its a one byte sysex event with content 0x01
       
if(ReceivedMIDIEvent.Event == MIDI_EVENT(0, MIDI_COMMAND_SYSEX_1BYTE)){
           
if(ReceivedMIDIEvent.Data1 == 0x01){

           
//do stuff

           
}

From the PC i tried to send: F7 00 01 F0

Maybe i am missunderstanding something.

Best regards Alexander

Dean Camera

unread,
Apr 15, 2020, 5:48:06 AM4/15/20
to lufa-s...@googlegroups.com, Alexander
Whoops, late to this one.

It's possible that it's being encoded and sent as a different mesage code, for example as a MIDI_COMMAND_SYSEX_2BYTE, MIDI_COMMAND_SYSEX_3BYTE etc. - might be worth dumping out the packet Event codes for all recieved events via the serial port, LEDs or some other mechanism to determine what's actually being sent from the host to the device.

- Dean
--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lufa-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lufa-support/8bd4efc9-e7e9-42ff-843f-32d4610d1a6c%40googlegroups.com.

Alexander

unread,
Apr 15, 2020, 5:55:13 AM4/15/20
to LUFA Library Support List
Hey Dean,

no problem! I got it to work. It was a misunderstanding on my part how the sysex over USB works in comparisson to regular UART Mid. I got it to work by using a USB sniffer to see how the packets send by the host actually look and than i understood how to use the LUFA functions to recieve it.

USB Midi Sysex is always three bytes at a time no matter if the sysex is actually longer. So for longer messages you'd have to recieve it in 3 bytes chunks and than reassemble it again.


-Alex
To unsubscribe from this group and stop receiving emails from it, send an email to lufa-s...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages