2014-07-01 08:44 AM
Hi,
a colleague and I have the order to implement a CAN bootloader to our application. We are using the STM32F207ZG and we would like to use the internal CAN bootloader.After a lot of starting problems we've managed to enter the bootloader mode. Read and write to the flash is also working. But we have problems with the some of the commands, described in AN3154 (Rev. 5). Maybe somebody can help.
1. With the ''Get Version & Read Protection Status command'' (Section 3.2) we get back two messages. The first one with the version of the bootloader and the second with two dummy bytes (always 0x00). How can we get the real read protection status, when the answer always is 0x00? 2. Erase Memory command: The global erase is working, but how can I manage to erase only specific sectors? In figure 18 a ''sector code'' is mentioned, is that the starting address of the sector? In the text below, there is the Line: ''Erase sector by sector message: Std ID = 0x43, DLC = 0x01 to 0x08, data = see product datasheet.
'' Why is the DLC variable from 0x01 to 0x08? And also, what data should I see in the datasheet? 3. Similar to the last command I have problems to understand the description of the '' Write Protect command '' (Section 3.9) The host messages are describe with:Command message: Std ID = 0x63, DLC = 0x01, data[0] = N (where 0 < N ≤ 255).
Command message: Std ID = 0x63, DLC = 0x01..08, data[0] = N (where 0 < N ≤ 255). Can someone explain what ''N'' stands for in both cases?2014-07-01 09:18 AM
The DLC is variable because you can specify a list of multiple PAGEs or BLOCKs you want to erase.
The bytes passed represent a memory region(s) you want to erase, with 0xFF being everything. I'd assume 0x00 is 0x08000000..0x08003FFF, 0x01 is 0x08004000..0x08007FFF, 0x05 is 0x80020000..0x0803FFFF, etc. Review the non-uniform flash regions described in the manual. You might want to review how the USART based Flash Demonstrator application (w/source) functions, because the CAN implementation is fashioned after that, but with the more restricted payload afforded by CAN.