cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 Flash page capacity and reading from Flash

dooz
Associate II
Posted on August 04, 2015 at 13:24

Hello,

Lately I've been trying to save some data on flash in my STM32F3 discovery board.

Saving data was succesful but I have a little problem in reading from this memory.

Function I'm using to check my data is:

 uint32_t dana=0x00A98AC7;

.

.

.

  __IO uint32_t data32;

  uint32_t AddressCheck = PageTable[PageNumber];

  while (AddressCheck < PageTable[PageNumber+1])

   {

     data32 = *(__IO uint32_t*)AddressCheck;

     if (data32 != dana)

     {

         HAL_GPIO_WritePin(GPIOE, GPIO_PIN_13, GPIO_PIN_SET);

     }

     Address = Address + 4;

   }

dana is a value I'm writing to flash. When I'm checking flash registers (in debug window) it is saved there correctly.

When I use the above function all the flash memo registers are reported to have multiple errors.

I guess the problem is in here:   data32 = *(__IO uint32_t*)AddressCheck;

Can anyone please tell me why?

 Oh and the post question: each of my flash pages has 2kb memory  (0x800)

how many uint32_t variables can I store in one page?  is it 512?

I'm asking because when I look on flash memory registers I can easly count exactly 240 variables on one page.

Regards

Dominik O.

4 REPLIES 4
Posted on August 04, 2015 at 15:23

Address = Address + 4;  // AddressCheck ??

A 2K page would hold 512 32-bit variables, for a 1K page 256

Is it failing to write, is there an error related to that. Each word can be written once, and then would need to be erased.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dooz
Associate II
Posted on August 05, 2015 at 16:24

That's wright, I'm able to fill one 2kb flash page with 512 variables uint23_t.

Program is now working fine. I can read data from flash which is the same as  a data written to it.

I can do it just by refering exactly to the flash register:

uint32_t data32 = *(uint32_t*)register;

 I guess the main problem lies just in displaying those variables in a debug window. I'm talking about an optimization level. Sorry about that mistake in naming a variable (AddressCheck). I found it a while after sending my post.

Is it the optimization level that result in such a message like below in the 'expression value' window?

Error: Multiple errors reported.\ Failed to execute MI command: -var-create - * tim_trigger Error message from debugger back end: -var-create: unable to create variable object\ Unable to create variable object    

Posted on August 05, 2015 at 18:58

I'm not familiar with the tools you are using.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dooz
Associate II
Posted on August 06, 2015 at 15:32

It is System Workbench for STM32, a debug window looks exactly the same as in CodeWarrior 10.6 for Freescale microcontrollers. I guess You know it but I probably didn't describe it correctly.