xmc4400 flash "reading" problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User8819
Level 4
Level 4
Hello,

In my project on xmc4400-512 device, I use some flash sectors to store data. Now, I have end up in curious situation. It is not possible to read data from some sectors. In example sector starting at address 0x0c004000. All read accesses return 0. I am sure that there is data present because Segger programs Jmem/Jflash show correctly the content. The flash is in read mode. Flash registers seem OK. What could be wrong? Could that be the sign that flash has been used a lot? Also debugger memory window shows 0.
Thank you

rum
0 Likes
4 Replies
Not applicable
Hi,

If you able to read from Segger program, means the flash is able to read.
If the flash is unreadable, Segger program wont be able to read out any data too.
It could be the way you read the flash is incorrect.
Try to use pointer to the address and copy the data to a variable to see if you can read out anything.
0 Likes
User8819
Level 4
Level 4
Hi Rou,

I already access flash by pointer (first thing in the main just for test). If the problem would be so trivial I would not ask for help on forum. This code I have been using for months to access flash and has been working fine. The problem appeared only now for both code and debugger and only for some sectors. Only segger jmem shows correct data. I never locked any sector and flash registers appear correct. I don't know segger internals but maybe it accesses flash through SWD using some different wait state configuration which allows to view memory content (this is only supposition). I am open to any other suggestions to explain this phenomena.

rum
0 Likes
User6793
Level 4
Level 4
I'm on the XMC4500, and the wait states are set up in system_XMC4500.c:
/* Setup the Flash Wait State */
#if PMU_FLASH
temp = FLASH0->FCON;
temp &= ~FLASH_FCON_WSPFLASH_Msk;
temp |= PMU_FLASH_WS+3;
FLASH0->FCON = temp;
#endif

You could try to read the value of FCON to check how many wait states you are running with.
If it has been marginal, a slight raise in ambient temperature could have triggered your problem?
0 Likes
User8819
Level 4
Level 4
I am aware of this code. In my case, internal device flash, I am running with default wait states setting which satisfies processor specifications. My question was if flash is accessed internally through SWD somehow differently because debugger is able to read memory but code no. Anyway, I have changed new processor and everything is working fine now.
0 Likes