cancel
Showing results for 
Search instead for 
Did you mean: 

Can not flash in STM32F429i_Disco

Linda
Associate II
Posted on March 08, 2015 at 04:10

I need to read the flash, add 1 then flash back to same address, so that I can keep track how many time the user use the device, I use:

~~~~~~~~

 FLASH_Unlock();

  FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |

                  FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR|FLASH_FLAG_PGSERR); 

TimeUse= *(__IO uint32_t*)(0x04FFF3325)+1;

            if (FLASH_ProgramWord(0x04FFF3325,TimeUse) == FLASH_COMPLETE)

                {

                uwAddress = uwAddress + 4;

                }

~~~~~~~~~

It seems the program can not write anything. Then I try:

TimeUse= *(vu uint32_t*)(0x04FFF3325)+1;

still the same problem.

Why the program can write it?

Thanks

2 REPLIES 2
Posted on March 08, 2015 at 14:43

Couple of observations

The address 0x04FFF3325 is not a valid flash address.

To write you must enable programming mode.

You may write data to an address only once.

Incrementing a value in flash is not a good plan.

Suggest you erase a whole sector and then write a use flag to an incrementing ADDRESS, and where you need to check the number of usages, counts the number marked.

Use OTP if the count is fairly limited.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Linda
Associate II
Posted on March 10, 2015 at 02:11

Thanks. This problem seems fix now.