I am using an Arduino Due to collect a large amount of data from an encoder (about 1kb). Afterwards I need to send the collected data to a C# application I wrote over the serial port. I serialized my tx data into a byte buffer and simply used this code to transmit:
void sendEncoderData()
{
byte buffer[1024];
/*** some code that populates buffer ***/
int bytesToSend = 1024;
Serial.write(buffer, bytesToSend);
}
When I run the code, nothing seems to get received by the C# application. In fact, I never see the Tx LED light up. However, if I change bytesToSend
to a value smaller than 64 bytes everything works. Is this a limitation of Serial.write()
or is it something else? What are ways I can work around this limitation?
More information: sendEncoderData()
is called by an interrupt service routine. However prior to the call, I made sure to 'detachInterrupt()` on all pins including the pin associated with said ISR.
This only seems to work
- define "work". It hangs? Only 64 bytes are transmitted? If so, which? The first 64? The last 64?I(t) would be a snippet if ...
- OK, let's say you turned interrupts off. You may have, you may not have. With them off things would be different than if they were on. It may not seem important to you, but to us, it is. You are the one asking the question. It is up to you to supply as much information as you can to get a good answer.