My project requires that I be able to program my boards from both UART0 and UART1. I know that Optiboot allows me to specify which of these to use, but I do not think it will monitor multiple and auto-select whichever one it first receives serial data from. Is there an easy way to implement this?
I did attempt to implement it with the following changes:
- Add new definitions for ‘SECONDARY_UART’ in pins_def.h
- Add code to monitor both secondary and primary uart
- Store which UART received the first STK_GET_PARAMETER in a global variable
- Use the global variable to only send/receive from the selected UART for future communication
However, when programming on UART0 avrdude freezes just after it starts writing flash with the error:
avrdude.exe: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
I’ve attached the code. Any advice would be greatly appreciated!
optiboot.c (31.9 KB)
pin_defs.h (17.1 KB)