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

Note: Uncommented delay loop at beginning because of
code size limit.
This commit is contained in:
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 ### Bootloader
* The bootloader is a standard Arduino bootloader with the following additions * 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 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` * 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 UCSRB = (1<<RXEN)|(1<<TXEN); // enable Rx & Tx
UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); // config USART; 8N1 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); _delay_loop_2(0);
} }*/
/* forever */ /* forever */
for (;;) { for (;;) {
@ -213,7 +213,7 @@ int main(void)
// and give the programmer 1 sec to react // and give the programmer 1 sec to react
} }
/* Loop UART until reset */ /* Set to bypass until restart */
else if (ch == 'X') { else if (ch == 'X') {
while (1) { while (1) {
if (UCSRA & (1 << RXC)) { 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 */ /* Start user code NOW */
else if (ch == 'Z') { else if (ch == 'Z') {
app_start(); app_start();