Hello everyone
First of all, thanks to Paul for his work, his support and the dynamism of the Teensy range and sorry for my very rough English and assisted by the translation tools.
I'm blocking on a problem in Teensy 3.2 + Arduino IDE 1.8.5 and Teensyduino 1.4.1 (and earlier)
I use the usbMidi to transfer a large volume of SysEx: from 100 to 400 pages of 300 or 400 bytes ...
I can not post the source code too much because it is very large. I will therefore be content with extracts. I hope they will suffice.
The blocks are 331 bytes with the headers and I send 100 to 400 blocks by Dump.
Basically, I have 0.5% of blocks that arrive with a wrong length. In this case, each time 3 bytes are missing. I get a block of 328 bytes instead of 331.
The first 11 bytes (the header of the SySex block ...) are always good, it is then that a frame of 3 bytes can be loose.
If I repeat the same transfer, the errors may be in different places. It happens a few times that the transfer is done without error. I tested other USB ports, other cables. I find the errors with both MIDI OX with a personal development fast (C# Api Windows etc ...)
I must presure that the Teensy is well solicited : Serial1 Serial2 and Serial 3 are open respectively to 210000, 115200, 1152000 ...
that Serial communications work perfectly and that there is no incoming or outgoing flow during these SysEx transfers.
I tried MIDI, SERIAL + MIDI, SERIAL + MIDI + AUDIO .... without change and other options like Fast, Faster, Faster With LTO link etc ...
I do not use hardware interrupts other than normal SPI, I2C, Serial and USB).
I tried to slow down the USB, to put delays in usb_midi_write_packed in usb_midi.c,
to change on
#define TX_TIMEOUT_MSEC 40 by testing the values from 10 to 200 ...
to change on
#define TX_PACKET_LIMIT 6 by testing the values from 1 (to avoid bufferization) to 20 ...
to change on
**#define MIDI_INTERFACE 2 // MIDI
**#define MIDI_NUM_CABLES 1
**#define MIDI_TX_ENDPOINT 4
**#define MIDI_TX_SIZE 64
**#define MIDI_RX_ENDPOINT 5
**#define MIDI_RX_SIZE 64
*in usb_desc.h
*
to create a function usb_midi_write_packed without queue ...
*
all without success.
That's it, hoping to find a solution other than getting back through a MIDI so slow
Best regards,
Laurent
First of all, thanks to Paul for his work, his support and the dynamism of the Teensy range and sorry for my very rough English and assisted by the translation tools.
I'm blocking on a problem in Teensy 3.2 + Arduino IDE 1.8.5 and Teensyduino 1.4.1 (and earlier)
I use the usbMidi to transfer a large volume of SysEx: from 100 to 400 pages of 300 or 400 bytes ...
I can not post the source code too much because it is very large. I will therefore be content with extracts. I hope they will suffice.
The blocks are 331 bytes with the headers and I send 100 to 400 blocks by Dump.
Basically, I have 0.5% of blocks that arrive with a wrong length. In this case, each time 3 bytes are missing. I get a block of 328 bytes instead of 331.
The first 11 bytes (the header of the SySex block ...) are always good, it is then that a frame of 3 bytes can be loose.
If I repeat the same transfer, the errors may be in different places. It happens a few times that the transfer is done without error. I tested other USB ports, other cables. I find the errors with both MIDI OX with a personal development fast (C# Api Windows etc ...)
I must presure that the Teensy is well solicited : Serial1 Serial2 and Serial 3 are open respectively to 210000, 115200, 1152000 ...
that Serial communications work perfectly and that there is no incoming or outgoing flow during these SysEx transfers.
I tried MIDI, SERIAL + MIDI, SERIAL + MIDI + AUDIO .... without change and other options like Fast, Faster, Faster With LTO link etc ...
I do not use hardware interrupts other than normal SPI, I2C, Serial and USB).
Code:
static uint8_t dataSys[_SIZEBUFMID];
static uint16_t maxSys=0;
...
void dataSysSend()
{
switch( sysDest )
{
case _USBMIDI:
usbMIDI.sendSysEx(maxSys, dataSys, true);
break;
case _RIVERKEYMIDI:
MID_IN.sendSysEx(maxSys, dataSys, true);
break;
case _BOARDMIDI:
MID_OUT.sendSysEx(maxSys, dataSys, true);
break;
}
maxSys=0;
delay(40);
}
void sysSYS(uint8_t value)
{
dataSys[maxSys++] = value;
if (value == 0xF7 ) dataSysSend();
}
void sysCC(uint8_t value)
{
static uint8_t data;
data = ( value & 0x007F );
dataSys[maxSys++] = data;
}
void sysNRPN(int16_t value)
{
static uint8_t data[2];
data[0] = ( ((uint16_t)(value) & 0x3F80) >> 7 ) & 0x007F;
data[1] = ((uint16_t)(value) & 0x007F);
dataSys[maxSys++] = data[0];
dataSys[maxSys++] = data[1];
}
#define NB_PATCH 200
void SendAllPatch(...)
{
for (int ct = 0; ct < NB_PATCH ; ct++)
{
sysSYS(0xF0);
...
sysCC(bytes_1);
...
sysCC(bytes_300);
...
sysSYS(0xF7); // With F7 , sysSYS call dataSysSend...
}
}
I tried to slow down the USB, to put delays in usb_midi_write_packed in usb_midi.c,
to change on
#define TX_TIMEOUT_MSEC 40 by testing the values from 10 to 200 ...
to change on
#define TX_PACKET_LIMIT 6 by testing the values from 1 (to avoid bufferization) to 20 ...
to change on
**#define MIDI_INTERFACE 2 // MIDI
**#define MIDI_NUM_CABLES 1
**#define MIDI_TX_ENDPOINT 4
**#define MIDI_TX_SIZE 64
**#define MIDI_RX_ENDPOINT 5
**#define MIDI_RX_SIZE 64
*in usb_desc.h
*
to create a function usb_midi_write_packed without queue ...
*
all without success.
That's it, hoping to find a solution other than getting back through a MIDI so slow
Best regards,
Laurent
Last edited: