Serial port configuration is 115200 baud 8N1.
One page is 64 bytes.
PROG is active high. It is actually the DTR line on the serial port.
Host | Target | |
---|---|---|
Drive PROG active | ||
Reset: Bootloader begins execution | ||
PROG is active so bootloader continues (if PROG is inactive then user code is executed) | ||
Send 54 31 to host | ||
Read 54 31 from target | ||
Send 48 01 to target | ||
Read 48 01 from host | ||
Send page of data to target | Loop until all data is transferred | |
Read page of data from host | ||
Write data to flash | ||
Send checksum to host | ||
Read checksum from target | ||
Verify checksum | ||
Drive PROG inactive | ||
Detect PROG is inactive and execute user code (this is actually the error-detecting case for waiting for another page of data from the host). |
If the host detects an error, it informs the user, drives PROG inactive, and performs no further communication with the target.
If the target detects an error, it executes the user code. The host causes an error condition intentionally to stop downloading data and cause the user code to be executed.