write flash fail via i2c bootloader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-24 10:44 PM - edited ‎2023-11-20 07:14 AM
Recently I'm using STM32G051 and try to write flash via i2c bootloader.
Below are my steps:
- Use STM32CubeProgrammer to set nBOOT0_SEL = 1 / nBoot0 = 0 /nBoot1 = 1 to enter BL mode
- Disconnect ST link, and use i2c host tool (Aardvark) to send i2c write (no-stretch) command 0x32, 0xcd
- Read 1 byte, get ACK (0x79) frame successfully.
- Send 5 bytes start address(0x08000000) with XOR checksum (0x08)
- Read 1 byte, get ACK (0x79) frame successfully.
- send 10 bytes writeLength(0x08), data(0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88), checksum (0x80)
- Problem here!! read 1 byte and expect to get ACK(0x79) or BUSY(0x76), but I saw CLK is stretched at 9th bit of address phase:
I've checked all read/write protection are disabled via STM32Programmer, and I can access read flash and erase flash successfully, only write process fail. Is any one have encounter similar issue and tell me if my procedure is not correct?
Many thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-25 01:07 AM - edited ‎2023-11-20 07:14 AM
Hi,
flash memory start form address 0x0800 0000 not 0x0008 0000. You passed addres that is marked as reserved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-25 01:20 AM
Hi Kamil,
Sorry for my typo, I've written the start address with 0x08000000 and the XOR checksum (0x08)
And still have the issue.
Thanks.
YenLu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-25 02:24 AM - edited ‎2023-11-20 07:14 AM
Ok :) Next question, were you send bootloader address ? in application note i see other adressess than yours. What is this sequention 0x32 0xcd?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-25 05:51 AM - edited ‎2023-11-20 07:14 AM
Hi Kamil,
I omitted the i2c address byte when I described the step above. I've read/write the address 0x62 and everything is fine until waiting the ack response for data written. The sequence (0x32, 0xcd) is No-Stretch Write Memory command which is described in AN4221:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-27 01:45 AM
@YLU.2​ did you resolve problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-04-27 08:25 PM
Yes,
for 8 byte write, I should send 0x07, 0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88, 0x8f
after correct the format, I get ack and write the memory successfully.
