2015-08-04 04:24 AM
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.2015-08-04 06:23 AM
Address = Address + 4; // AddressCheck ??
A 2K page would hold 512 32-bit variables, for a 1K page 256Is it failing to write, is there an error related to that. Each word can be written once, and then would need to be erased.2015-08-05 07:24 AM
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 object2015-08-05 09:58 AM
I'm not familiar with the tools you are using.
2015-08-06 06:32 AM
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.