8000 Sync issue when host sends multiple signon requests · f34rdotcom/Arduino@4d469a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d469a6

Browse files
authored
Sync issue when host sends multiple signon requests
If the host sends a signon but does not get a SYNC response it will send again. This will lead to being out of sync with data in the rx buffer that is not consumed. To avoid this we consume all extra host bytes before sending a INSYNC reply.
1 parent db2dd8f commit 4d469a6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

build/shared/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ uint8_t spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
331331

332332
void empty_reply() {
333333
if (CRC_EOP == getch()) {
334+
// clear RX buffer. No more host data expected until after SYNC.
335+
while(SERIAL.available())
336+
SERIAL.read();
334337
SERIAL.print((char)STK_INSYNC);
335338
SERIAL.print((char)STK_OK);
336339
} else {

0 commit comments

Comments
 (0)
0