1 Bootloader introduction
Table 1. STM8 groups featuring a bootloader
Table 2. STM8 groups without bootloader
1.1 Bootloader activation
Table 3. Bootloader versions for which bootloader activation flowchart is valid
Figure 1. Bootloader activation flowchart
Table 4. Initial checking
2 Peripheral settings
Table 5. Serial interfaces associated with STM8 devices
2.1 USART/UARTs settings
2.1.1 LINUART/UARTs in “reply” mode settings
2.2 SPI settings
2.3 CAN settings
Figure 2. CAN frame
3 Bootloader command set
Table 6. Bootloader commands
Table 7. Bootloader codes
3.1 Get command
3.1.1 Get command via USART/LINUART/UART1/ UART2/UART3
Figure 3. Get command via USART/LINUART/UART1/UART2/UART3 - host side
Figure 4. Get command via USART/LINUART/UART1/UART2/UART3 - device side
3.1.2 Get command via SPI
Figure 5. Get command via SPI - host side
Figure 6. Get command via SPI - device side
3.1.3 Get command via CAN
Figure 7. Get command via CAN - host side
Figure 8. Get command via CAN - device side
3.2 Read memory command
3.2.1 Read memory command via USART/LINUART/UART1/2/3
Figure 9. Read memory command via USART/LINUART/UART1/UART2/UART3 - host side
Figure 10. Read memory command via USART/LINUART/UART1/UART2/UART3 - device side
3.2.2 Read memory command via SPI
Figure 11. Read memory command via SPI - host side
Figure 12. Read memory command via SPI - device side
3.2.3 Read memory command via CAN
Figure 13. Read memory command via CAN - host side
Figure 14. Read memory command via CAN - device side
3.3 Erase memory command
3.3.1 Erase memory command via USART/LINUART/UART1/2/3
Figure 15. Erase memory command via USART/LINUART/UART1/2/3 - host side
Figure 16. Erase memory command via USART/LINUART/UART1/2/3 - device side
3.3.2 Erase memory command via SPI
Figure 17. Erase memory command via SPI - host side
Figure 18. Erase memory command via SPI - device side
3.3.3 Erase memory command via CAN
Figure 19. Erase memory command via CAN - host side
Figure 20. Erase memory command via CAN - device side
3.4 Write memory command
3.4.1 Write memory command via USART/LINUART/UART1/2/3
Figure 21. Write memory command via USART/LINUART/UART1/UART2/UART3 - host side
Figure 22. Write memory command via USART/LINUART/UART1/2/3 - device side
3.4.2 Write memory command via SPI
Figure 23. Write memory command via SPI - host side
Table 8. Examples of delay
Figure 24. Write memory command via SPI - device side
3.4.3 Write memory command via CAN
Figure 25. Write memory command via CAN - host side
Figure 26. Write memory command via CAN - device side
3.5 Speed command
3.5.1 Speed command via CAN
Figure 27. Speed command via CAN - host side
Figure 28. Speed command via CAN - device side
3.6 Go command
3.6.1 Go command via USART/LINUART/UART1/UART2/UART3
Figure 29. Go command via USART/LINUART/UART1/UART2/UART3 - host side
Figure 30. Go command via USART/LINUART/UART1/UART2/UART3 - device side
3.6.2 Go command via SPI
Figure 31. Go command via SPI - host side
Figure 32. Go command via SPI - device side
3.6.3 Go command via CAN
Figure 33. Go command via CAN - host side
Figure 34. Go command via CAN - device side
3.7 Sector codes
Table 9. STM8 sector codes
3.8 Software model (STM8AF, STM8AL, STM8L and STM8S Series)
3.8.1 RAM erase/write routines
4 Error management
Table 10. Error table
5 Programming time
Table 11. USART/LINUART/UART1/UART2/UART3 programming times
Table 12. SPI programming time
Table 13. CAN programming time
Appendix A How to upgrade ROP protected device
A.1 Rules for upgrading ROP protected devices
Appendix B Bootloader entry points
Table 14. Bootloader entry points
Appendix C SPI peripheral timing options
C.1 SPI with busy state checking
C.2 Modified erase/write RAM routines
Figure 35. Delay elimination in modified RAM routines
Appendix D PC software support
Figure 36. "Flash loader demonstrator" software
Appendix E Bootloader UART limitation
E.1 Description
E.1.1 UART automatic baudrate calculation
E.1.2 Description of UART limitation
E.2 Workaround for UART limitation
Appendix F Limitations and improvements versus bootloader versions
Table 15. Description of limitation, improvements and added features
Revision history
Table 16. Document revision history