2013-06-12 03:24 PM
Hello,
I'm trying to use the STM32F107VCT6 system memory boot loader on remapped USART2. I can perform bootloader operations successfully but I'm having trouble writing to the flash. The write memory commands execute successfully initially (from address 0x08000000 to 0x08000140) but as soon as I reach 0x08000150, the address sends successfully but I get a NACK when I try to send the data with checksum (0xAD). First I send N (the number of data bytes - 1) which is 0x0F. Then I send data bytes: 0x00,0xF0,0x02,0xF8, 0x00,0xF0,0xB8,0xF8, 0x0A,0xA0,0x90,0xE8, 0x00,0x0C,0x82,0x44 then I send the checksum 0xAD then I get NACK! The interesting thing is that this address is also the start address of my application. My hex file looks something like this: :020000040800F2 //upper 16 bits address is 0800 ... write commands to 0x08000000 to 0x08000140 ... :1001500000F002F800F0B8F80AA090E8000C824421 //the offending line, writing to 0x08000150 gives a NACK ... remaining write commands ... :04000005080001519D //the GO! command starting at 0x08000151, the next address up from the offending address 0150! The comms seems fine since the bootloader starts running and gets some way through. The code seems fine for the same reason and upon inspection it seems to generate all correct checksum and data values. Why does it fail at this point? What's special about that location? Thanks for any help. #stm32f107-bootloader-nack2013-06-12 05:02 PM
A quick sanity check of what gets sent
0x31,0xCE ; Write Cmd
0x08,0x00,0x01,0x50,0x59 ; Addr
0x0F ; Len
0x00,0xF0,0x02,0xF8,0x00,0xF0,0xB8,0xF8,0x0A,0xA0,0x90,0xE8,0x00,0x0C,0x82,0x44 ; Data
0xAD ; Sum
I guess my concern would be what is being sent immediately prior, and if there is the possibility that the location had already been written. I would look to read back the memory and check. I might try to write some bytes or words at the location, and also continue writing the rest of the file and see if other locations threw up issues.
2013-06-13 04:47 AM
Yes, your sanity is confirmed. Unlike mine which is getting worse by the minute.
..so I tried to read some memory locations before doing any writes (expecting to see all 0xFF's since I erased the flash). Some locations read fine, others return NACK's. The strange thing is, it follows a pattern. Could this be a clue? It doesn't like reading 0x08000002 It doesn't like reading 0x08000003 and then every 257 from there, so 0x08000104, 0x08000205, 0x08000306, 0x08000407 etc. I tested up to 0x0800FFFF. Now I'm more confused than before!