Issue in buffer to write before programming external flash
Hi everyone,
I've a strange problem when I write to an external flash memory (S29GL512T) throught a STM32F767 MCU and a custom external loader loaded in the STM32CubeProgrammer.
After debugging the external loader several times, I've found that the contents of the buffer that CubeProgrammer gives me for the write operation has partially invalid data. I have done this test in 2 contexts:
- Using FMC to programm external flash. In this context I have invalid data before programming the external flash.
- Without using FMC. This context is only for check the content of buffer without FMC interfere and the content matches.
So I don't understand why, when you use FMC to program the external flash, the contents of the given buffer are manipulated.
This follows shows the original data I want program at address 0x60060000 and the log generated during the programm procedure.
# Sector erase 0
Init...<LF>
S29GL512T11 found!<LF>
Read mode<LF>
Sector erase at 0x0<LF>
Sector erase done!<LF>
# Sector erase 1, 2, 3
Init...<LF>
S29GL512T11 found!<LF>
Read mode<LF>
Sector erase at 0x20000<LF>
Sector erase done!<LF>
Sector erase at 0x40000<LF>
Sector erase done!<LF>
Sector erase at 0x60000<LF>
Sector erase done!<LF>
# Programm 16 bytes at 0x60000000
Init...<LF>
S29GL512T11 found!<LF>
Programming at 0x60000000<LF>
Programming size:16<LF>
Pointer Buffer 0x20004f00<LF>
# Programm 16 bytes at 0x60000000
# I think in this scenario the whole of data to program is loaded in RAM and splitted in 2 consecutive buffers (one with 149044 bytes and the other 149040 bytes). Then I can check a knowed position of this buffer if it matches with a original data (In this case, I use the 0x60060000 addres beacuse never matches with betwen buffer and the original content).
Init...<LF>
S29GL512T11 found!<LF>
Programming at 0x60020000<LF>
Programming size:149044<LF>
Pointer Buffer 0x20004f00<LF>
# Check the content of buffer where represents the content of 0x60060000. Has an invalid data 0x997dccd9b != 0x00000000.
0x20044f00: 0x997dcd9b<LF>
Programming at 0x60044634<LF>
Programming size:149040<LF>
Pointer Buffer 0x20029534<LF>
# Check again the content of buffer where represents the content of 0x60060000. Has an invalid data 0x997dccd9b != 0x00000000.
0x20044f00: 0x997dcd9b<LF>