I am having trouble storing incoming serial data in a Teensy 3.2 (coming from another Teensy 3.2.) in a buffer at 115200 baud.
In this code, w_time is a elapsed time variable, allowing it to time out kills the process. The incoming data length is unknown, and there is no "end of transmission" character so with this I have to have a way to exit the process.
rx_buff is a byte array ,1500 elements, I dont expect more data than about 512 bytes
cntr is the buffer pointer.
I blast in the data and only receive anywhaere from 167 to 470 bytes, its inconsistent.
This code appears to work better with Serial1, but I need both ports
I did find a post about changing the serial buffer size in Serial.c, and I increased it to 512 from 64. Any help would be appreciated.
code fragment:
[/CODE]if( Serial2.available() ) {
w_time = 0;
while( w_time < 100 ) {
while ( Serial2.available() ) {
rx_buf[cntr] = Serial2.read();
++cntr;
w_time = 0; // reset timer since data arrived
}
}
}
[[CODE/]
In this code, w_time is a elapsed time variable, allowing it to time out kills the process. The incoming data length is unknown, and there is no "end of transmission" character so with this I have to have a way to exit the process.
rx_buff is a byte array ,1500 elements, I dont expect more data than about 512 bytes
cntr is the buffer pointer.
I blast in the data and only receive anywhaere from 167 to 470 bytes, its inconsistent.
This code appears to work better with Serial1, but I need both ports
I did find a post about changing the serial buffer size in Serial.c, and I increased it to 512 from 64. Any help would be appreciated.
code fragment:
[/CODE]if( Serial2.available() ) {
w_time = 0;
while( w_time < 100 ) {
while ( Serial2.available() ) {
rx_buf[cntr] = Serial2.read();
++cntr;
w_time = 0; // reset timer since data arrived
}
}
}
[[CODE/]
Last edited: