thanks paul
thats very useful info
this usb stuff is a bit new to me and maybe i have my terminology wrong
would it make more sense for me to talk of a bulk transfer of 12008 bytes?
I know that we have a piece of hardware from which we receive a bulk transfer of 12008 bytes, maybe i am incorrect to refer to that as a 'packet'
I am trying to simulate that hardware with a teensy for testing purposes (i don't always have access to the hardware)
so far i have only been able to recieve a bulk transfer of exactly 64 bytes when using the teensy.
My host is an android smartphone with the teensy being the device (connected via OTG)
should i be able to get the teensy to transmit a bulk transfer containing 12008 bytes?
i am very new to the teensy/arduino so apologies in advance for any stupid questioins..
*update*
i've just tested this, bulk transfer read on the android side fails when trying to receive 12008 bytes, e.g. packetSize is set to 12008:
byte[] dataBytes = new byte[packetSize];
int read = deviceConnection.bulkTransfer(dataEndpoint, dataBytes,
dataBytes.length, BULK_RX_TIMEOUT);
works when packetSize is 64, fails when packet size is 12008, i.e. read returns -1 on fail as opposed to no. of bytes received
also works with packetSize is 128
I wonder if it is timing out? 12 MBit/s = 1.5 MByte/s, BULK_RX_TIMEOUT is 5000 ms
can 12008 bytes be transmitted in 5s? yes, we only need 2.4kbyte/s to get the data out in time so orders of magnitude within limits
code on teensy side is:
byte buf0[] = {
0x53, 0x78, 0xe8, 0x03, 0x96, 0x36, 0x07, 0x00,
0xee, 0x00, 0x81, 0xcd, 0xae, 0xab, 0xc6, 0x2f,
...
0x7b, 0xcd, 0x81, 0x30, 0x00, 0x40, 0x2a, 0x53,
};
a 12008 byte buffer
then:
void loop()
{
Serial.write(buf0, 12008);
}
couldn't be much simpler..
works when I only write 64 bytes of buf0, i.e.
Serial.write(buf0, 64);
but its not happy with 12008
update #2
maybe what i'm observing is a limit on arduino serial buffer size?