Issue Programming STM32F04 through SWD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-06-30 12:05 PM
Hi all, I am trying to program the flash memory in my STM32F04 processor. I am doing this over SWD from another processor. I can successfully read all the DAP IDs etc and I also have figured out how to read and write from registers inside the stm32. My issue arises when I try program a word to start of flash @0x08000000. Until this point in my sequence the DAP always responds with the correct ACK, erasing the flash works successfully. As soon as I do the flash programming procedure for writing this happens.
​
My flash write sequence is just as described in the flash write example from the datasheet but through SWD.
​
Write 0x08000000 to Address TAR register
Write my data to the data buffer​
The next transaction gives the ACK fault.
​
My flash is not write or read protected in the option bytes.
​
Any ideas?​
- Labels:
-
DEBUG
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-01 1:20 AM
You need to unlock the flash register. Loot at the reference manual e.g.rm0091 3.2.2 Flash program and erase operations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-07-01 2:30 AM
Of course I did not forget this step, I have fixed my issue in the meantime. The issue is that you can also access flash with 16-bit access not 32. When I changed the DAP CSW to give 16-bit access the problem goes away :)
