2024-07-24 12:37 AM
It has worked at times but at others is becoming all 0xFFFF or whatever values become written into unused areas.
Currently it loses memory every time.
My code reads a block of settings and looks at one location to check if it's zero, which indicates no 'priming' of the settings is required. If not zero the settings are primed with default values with that bit cleared to zero. All locations are written to in the block, zero if not used. They are uint64_t values. Changes to settings all include that bit as zero, so the priming won't occur again. But on each startup that location is above zero.
I've tried adding __NOP() lines and delays immediately after writing also.
While the device is operating the settings are saved, but at power down they become overwritten.
The flash writing code is
Solved! Go to Solution.
2024-07-24 02:36 AM
One last post but I will wait for comments:
The locations either side of the primer variable are unused. I wrote 7 and 8 to these. I could see those numbers in Cube Programmer. It now seems to work OK! Does it need extra work if data zero is being written anywhere?
2024-07-24 01:10 AM
I will add, it must be a firmware issue because one board has been in the development rig and the others were programmed with slightly earlier code. They are fairing better or working. When I've programmed one of those with the latest code it suffers also.
The default settings are fine. It's the triggering every time of these which is happening, showing the flash routine is somehow not working
2024-07-24 02:18 AM
The settings block is 50 locations of 64 bit = 3200 bits, and the block written to that I can see in Cube Programmer is 25 x 4 x 8 = 800 bits. I copied a code example and it seemed to work, I didn't check this mismatch. Should I decrease the read/write variables to uint16_t size? Still I don't know how it worked before whatever change happened.
At 0x0801D000 in Cube Programmer all are 0xFFFF... so that shows the flash isn't being overwritten by program code.
2024-07-24 02:36 AM
One last post but I will wait for comments:
The locations either side of the primer variable are unused. I wrote 7 and 8 to these. I could see those numbers in Cube Programmer. It now seems to work OK! Does it need extra work if data zero is being written anywhere?
2024-08-14 02:42 AM
No posts from anyone!