Skip to content

Commit e9a0a91

Browse files
committed
fixed F051 and F031 ack/receive
we should skip the stop bit and do it in sendString(), Alka was right :-)
1 parent 71f55e0 commit e9a0a91

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bootloader/main.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,22 @@ static void serialwriteChar(uint8_t data)
608608

609609
// send stop bit
610610
gpio_set(input_pin);
611-
delayMicroseconds(BITTIME);
611+
612+
/*
613+
note that we skip the delay by BITTIME for the full stop bit and
614+
do it in sendString() instead to ensure when sending an ACK
615+
immediately followed by a setReceive() on a slow MCU that we
616+
start on the receive as soon as possible.
617+
*/
612618
}
613619

614620

615621
static void sendString(uint8_t *data, int len)
616622
{
617623
for(int i = 0; i < len; i++){
618-
serialwriteChar(data[i]);
624+
serialwriteChar(data[i]);
625+
// for multi-byte writes we add the stop bit delay
626+
delayMicroseconds(BITTIME);
619627
}
620628
}
621629

0 commit comments

Comments
 (0)