ioc: avr-bootloader: Add Y command to bypass the subsequent device to bypass

Note: Uncommented delay loop at beginning because of
code size limit.
master
Markus Koch 2019-11-11 16:46:59 +01:00
parent 9a896c3314
commit 14216b3888
2 changed files with 11 additions and 4 deletions

View File

@ -6,6 +6,7 @@
### Bootloader
* The bootloader is a standard Arduino bootloader with the following additions
* Use ASCII command 'X' to enable loop-through mode. Everything received on UART RX will be forwarded to UART TX until the next reset.
* Use ASCII command 'X' to enable byass mode. Everything received on UART RX will be forwarded to UART TX until the next reset.
* Use ASCII command 'Y' to set the next unit in the chain into bypass mode.
* Use ASCII command 'Z' to immediately launch into the user firmware
* Use the following avrdude command to program: `avrdude -p m8 -P /dev/ttyUSBx -c arduino -b 19200 -U flash:w:$(TARGET).hex`

View File

@ -133,9 +133,9 @@ int main(void)
UCSRB = (1<<RXEN)|(1<<TXEN); // enable Rx & Tx
UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); // config USART; 8N1
for (i = 0; i < 16; i++) {
/*for (i = 0; i < 16; i++) {
_delay_loop_2(0);
}
}*/
/* forever */
for (;;) {
@ -213,7 +213,7 @@ int main(void)
// and give the programmer 1 sec to react
}
/* Loop UART until reset */
/* Set to bypass until restart */
else if (ch == 'X') {
while (1) {
if (UCSRA & (1 << RXC)) {
@ -222,6 +222,12 @@ int main(void)
}
}
/* Send 'X' via UART TX (set next unit to bypass) */
else if (ch == 'Y') {
putch('X');
continue;
}
/* Start user code NOW */
else if (ch == 'Z') {
app_start();