I am excited to know how Arduino UNO or nano differentiate between
program data that is to be burned into its flash when we press
Upload Sketch and
serial terminal data when we press
Send? Is there any special sequence to identify those? How it will be identified by Bootloader?
And I have this understanding can anyone correct if I am wrong or anything you want to add will be helpful:
- When we press Upload Sketch then a RST signal is sent.
- ATmega controller when it receives RST signal jumps to Bootloader section of flash and waits for a perticular sequence from UART
- If it receives then starts to write the data buffered from UART to flash. This process is handled by Bootloader.
- If it doesn't receive the sequence waits till timeout and then jumps to flash section and starts to execute from 0x0000