cancel
Showing results for 
Search instead for 
Did you mean: 

Std Periphal Libs f2/f4 - Flash Example

estersci2
Associate III
Posted on September 27, 2015 at 16:43

I tried the std peripheral library Flash example where you store variables in flash sectors 2 - 5. When set up as per the instructions in the read me file - it didn't work (no effect on MemoryProgramStatus, which signifies success).

Anyway - I tried various things including:

Setting IROM1 (default + startup selected)  Start: 0x8000000    Size: 0x7999

           IROM2 (default selected)             Start: 0x8040000   Size: 0x9FFFC

 

The reason I focused on the above as most likely to succeed is that the example 

writes to sectors 2 to 5, so the area for the virtual eeprom needs to starts at 0x08008000 inclusive and runs to 0x08040000 non-inclusive. So the IROMs above poke that hole in the flash, don't they?

Still no success. 

Shouldn't this example just run out of the box? Did it for other people?

I have an f417igh6 on an geval board. 

All help gratefully received!

6 REPLIES 6
Posted on September 27, 2015 at 17:57

This example?

stm32f4_dsp_stdperiph_lib_v1.5.0\Project\STM32F4xx_StdPeriph_Examples\FLASH\FLASH_Program\main.h

Though I think they keep the app code below 0x08010000 so it doesn't stomp on itself. It's erasing 4 thru 11, ie 0x08010000..0x080FFFFF

0x8000-1 is 0x7FFF, an area spanning 0x08000000..0x08007FFF has 0x8000 bytes in it.

Let's confirm what board you're taking about rather than invent new names for it,

http://www.mouser.com/ProductDetail/STMicroelectronics/STM3241G-EVAL/?qs=IiiHj%252bH2fep/UdvsZuJ/PQ%3D%3D

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
estersci2
Associate III
Posted on September 27, 2015 at 18:13

Hi,

Yes that is the model board I have....but I am using Std Peripheral FW library STM32F2 (yes f2 not f4) V1.1.0 / 13 April 2012. 

I tried to get started with the later FW but I had some problem with it - can't remember what it was now. 

Anyway, here are the sectors it is set up with:

#define FLASH_USER_START_ADDR   ADDR_FLASH_SECTOR_2   /* Start @ of user Flash area */

#define FLASH_USER_END_ADDR     ADDR_FLASH_SECTOR_5   /* End @ of user Flash area */

/* Base address of the Flash sectors */

#define ADDR_FLASH_SECTOR_0     ((uint32_t)0x08000000) /* Base @ of Sector 0, 16 Kbytes */

#define ADDR_FLASH_SECTOR_1     ((uint32_t)0x08004000) /* Base @ of Sector 1, 16 Kbytes */

#define ADDR_FLASH_SECTOR_2     ((uint32_t)0x08008000) /* Base @ of Sector 2, 16 Kbytes */

#define ADDR_FLASH_SECTOR_3     ((uint32_t)0x0800C000) /* Base @ of Sector 3, 16 Kbytes */

#define ADDR_FLASH_SECTOR_4     ((uint32_t)0x08010000) /* Base @ of Sector 4, 64 Kbytes */

#define ADDR_FLASH_SECTOR_5     ((uint32_t)0x08020000) /* Base @ of Sector 5, 128 Kbytes */

#define ADDR_FLASH_SECTOR_6     ((uint32_t)0x08040000) /* Base @ of Sector 6, 128 Kbytes */

#define ADDR_FLASH_SECTOR_7     ((uint32_t)0x08060000) /* Base @ of Sector 7, 128 Kbytes */

#define ADDR_FLASH_SECTOR_8     ((uint32_t)0x08080000) /* Base @ of Sector 8, 128 Kbytes */

#define ADDR_FLASH_SECTOR_9     ((uint32_t)0x080A0000) /* Base @ of Sector 9, 128 Kbytes */

#define ADDR_FLASH_SECTOR_10    ((uint32_t)0x080C0000) /* Base @ of Sector 10, 128 Kbytes */

#define ADDR_FLASH_SECTOR_11    ((uint32_t)0x080E0000) /* Base @ of Sector 11, 128 Kbytes */

Posted on September 27, 2015 at 18:23

Shouldn't this example just run out of the box? Did it for other people?

There aren't many people here, and the subset with your specific board probably even smaller, tending to zero.

The code (from the ST DSP FW library release) looks like it should work out of the box.

From the description I'm not even sure what's failing. The sectors should erase, and then you get one shot at writing to each word.

Another example

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/stm32f4xx%20FLASH_ProgramWord%20error%2c%20FLASH_ERROR_PROGRAM&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD0...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
estersci2
Associate III
Posted on September 27, 2015 at 18:33

FYI, this is what I get when I try to build the latest V5 library example, having selected ''STM32F40_41xxx'' in project options

linking...

STM32F40_41xxx\STM32F40_41xxx.axf: Error: L6218E: Undefined symbol STM_EVAL_LEDInit (referred from main.o).

STM32F40_41xxx\STM32F40_41xxx.axf: Error: L6218E: Undefined symbol STM_EVAL_LEDOn (referred from main.o).

Not enough information to list image symbols.

Finished: 1 information, 0 warning and 2 error messages.

''STM32F40_41xxx\STM32F40_41xxx.axf'' - 2 Error(s), 0 Warning(s).

Target not created.

Build Time Elapsed:  00:05:17

estersci2
Associate III
Posted on September 27, 2015 at 18:45

I updated my pack descriptions, made no difference.

Do I need to do something to keil to work with the latest firmware?
Amel NASRI
ST Employee
Posted on September 28, 2015 at 16:17

Hi new guy,

To avoid the error message, please follow recommendation provided in the readme.txt file of the used example:

- If ''STM32F40_41xxx'' is selected as default project Add the following file in the project source list: Utilities\STM32_EVAL\STM3240_41_G_EVAL\stm324xg_eval.c

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.