2013-12-02 06:39 PM
Hi All,
I need help on the following two questions. Thanks for your inputs.1. The Write Unprotect command described in the application note ''AN3154 CAN protocol used in STM32 bootloader'' doesn't work at all. Is there any other method to disable all write protection on the whole flash memory? Here are the steps I was taking: I first enabled write protection on a few sectors using command 0x63. After a system reset, I tried to issue 0x73 command to disable write protection. The device responded with the correct acknowledgement, but those sectors were still write protected.2. After those sector have been write-protected, I tried to erase the whole chip using Keil IDE, but it failed. My second question is how I can disable write protection under Keil? #can-bootloader-write-unprotect2013-12-03 06:41 AM
There are generally very few people here using the CAN boot loader, so the answers might not come quickly.
What specific STM32 part family are we talking about here, and what data patterns are you sending to the chip? With Keil, you might want to check if you have the ''STM32Fxx Options Bytes'' flash algorithm provided under the Flash configuration pane. Alternatively you could try the ST-Link and it's utilities, or the Flash Loader Demonstrator via a serial port. Finally these are also things your own code in the device could read or modify.2013-12-03 07:34 AM
Clive, thanks for your reply. I am using STM32F4Discovery board, so the MCU is STM32F407VGT6. The data pattern (command format) I sent to the bootloader was strictly following the application note. For example: once the communication with bootloader is built, I sent the first CAN message as following, CAN ID = 0x73, DLC=0x01, DATA[0]=0x00. Two CAN messages (acknowledgement from the bootloader) received: CAN ID=0x73, DLC=0x01, DATA[0]=0x79.
It seems everything goes smoothly as the application note states except the bootloader doesn't disable the write protection at all.2013-12-03 08:35 AM
Are you doing anything with the NRST pin? If you put it on a scope do you observe the board reset after you send the UNPROTECT?
2013-12-03 10:00 AM
No, I did nothing to NRST pin other than what the discovery board has. I haven't probed the pin, but I think it resets after UNPROTECT command because I have to send a CAN message to build communication with the bootloader after UNPROTECT command: CAN ID=0x79, DLC=0x00 and received an acknowledgement message from the bootloader: CAN ID=0x79, DLC=0x01, DATA[0]=0x79.
2013-12-03 10:26 AM
Ok, just checking a hunch.
How are you checking the write protection is still in effect, can you query the device using the ST-Link Utilities? One trap with the loader is that addresses are sent big-endian. You should also be able to output diagnostic data via the SWV mode supported by the ST-Link. You could dump out the option byte values.http://www.arm.com/files/pdf/mcbstm32c_lab.pdf
http://www.keil.com/download/files/labst.pdf
2013-12-03 11:34 AM
I didn't use ST-Utilities, but I read option bytes using the bootloader's READ MEMORY command. Since I didn't enable READOUT protection, I have no problem to read back the option bytes content. Yes, I am aware of big-endian numbers used in bootloader. And all data read back makes sense so I am quite sure the endianness I was using was right.
2013-12-04 10:25 AM
Any one encountered the same issue - WRITE UNPROTECT command doesn't work? I have two discovery boards and the same problem occurs on both boards.
I filed a support ticket and so far the answer I got from ST says ''I'm unaware of any errata related to the CAN bootloader. Please double-check the baudrates, command sequences and hardware connections.'' I am pretty sure there's a bug in the CAN bootloader, but I jsut need another person confirm this is the case.2013-12-04 05:55 PM
Finally my technical support ticket got updated, but anyone knows what it really means?
My tickets:
Request ID Creation Date Status
R13480085
12/2/2013 12:00:00 AM REJECTED