You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description:
I am encountering an issue with Serial1.write(buf, len) where the number of bytes received does not match the expected length during Serial1 communication between two Arduino devices with TX and RX pins cross-connected.
Setup for Arduino 1:
Initialized a buffer "uint8_t au8Buffer[64]" and assigned values to the first eight elements.
Attempted to send the first eight elements via "Serial1.write(au8Buffer, 8)", expecting to transmit 8 bytes.
Setup for Arduino 2:
Configured to listen for incoming Serial1 communication.
Expected behavior:
Arduino 2 should receive exactly 8 elements when Arduino 1 sends a length of 8.
Observed behavior (See figures below):
When sending with "len = 8", Arduino 2 receives only 7 elements.
Increasing the send length to "len = 9" results in the correct reception of 8 elements.
This behavior is not consistent with my understanding of the Serial.write() documentation and intended functionality.
Additional:
Arduino IDE version: 2.3.1
Code for Arduino 1:
uint8_t au8Buffer[64];
voidsetup() {
Serial.begin(9600);
Serial1.begin(9600);
au8Buffer[0] = 1;
au8Buffer[1] = 3;
au8Buffer[2] = 0;
au8Buffer[3] = 1;
au8Buffer[4] = 0;
au8Buffer[5] = 4;
au8Buffer[6] = 21;
au8Buffer[7] = 22;
}
voidloop() {
Serial1.write(au8Buffer, 8); // len = 8 only sent first 7 elements ...???
}
Problem description:
I am encountering an issue with Serial1.write(buf, len) where the number of bytes received does not match the expected length during Serial1 communication between two Arduino devices with TX and RX pins cross-connected.
Setup for Arduino 1:
Setup for Arduino 2:
Expected behavior:
Arduino 2 should receive exactly 8 elements when Arduino 1 sends a length of 8.
Observed behavior (See figures below):
When sending with "len = 8", Arduino 2 receives only 7 elements.
Increasing the send length to "len = 9" results in the correct reception of 8 elements.
This behavior is not consistent with my understanding of the Serial.write() documentation and intended functionality.
Additional:
Arduino IDE version: 2.3.1
Code for Arduino 1:
Code for Arduino 2:
The text was updated successfully, but these errors were encountered: