EEPROM for Cube MX STM32F301C8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-07 12:13 AM
Hi,
I would like to used EEPROM for STM32F301C8. I am used code below
uint32_t READ_FLASH(
uint32_t
DataAdr){ return *(int32u *)DataAdr;}void WRITE_FLASH(
uint32_t
DataAdr,uint32_t
Data){ erase_pages.PageAddress=DataAdr; erase_pages.NbPages=4; erase_pages.TypeErase=TYPEERASE_PAGES; HAL_FLASH_Unlock(); HAL_FLASHEx_Erase(&erase_pages, Error); HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, DataAdr, Data); HAL_FLASH_Lock();}It's not working. Please tell me about EEPROM or How I can learning if I am used to HAL library.
#stm #cube-mx #stm32-f3 #hal- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-07 6:27 AM
Hi,
As far as I know, there is no EEPROM in STM32F301x6/8 MCUs. EEPROM feature is available on STM32L0 and STM32L1 families. An EEPROM emulation feature is also available on STM32L4 (see
).In your code, the WRITE_FLASH() procedure will erase 4 pages of FLASH memory, i.e. 4 * 2048 bytes which is probably not what you want if trying to emulate EEPROM. See
for information about FLASH memory organization in STM32F301x6/8 MCUs.Examples of FLASH programming can be found in STM32Cube_FW_F3_V1.9.0\Projects folder for various STM32F3 MCU:
- FLASH_EraseProgram: this example describes how to configure and use the FLASH HAL API to erase and program the internal Flash memory.
FLASH_WriteProtection: this example describes how to configure and use the FLASH HAL API to enable and disable the write protection of the internal Flash memory.
When using the HAL API in your code, make sure to deal with the return code of the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-07 8:19 PM
If I am used to IAP function. Where can I find an example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-07 10:23 PM
I try do it and debug in Keil program. The command message show ' Cannot access Memory'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-07 10:25 PM
Thank you very much. I found
Examples of FLASH programming can be found in STM32Cube_FW_F3_V1.9.0\Projects folder for various STM32F3 MCU:
- FLASH_EraseProgram: this example describes how to configure and use the FLASH HAL API to erase and program the internal Flash memory.
FLASH_WriteProtection: this example describes how to configure and use the FLASH HAL API to enable and disable the write protection of the internal Flash memory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-08 3:12 AM
Hi,
please describe the environment being used:
- board (custom board or ST nucleo/disco/eval, precise reference of the board). As far as I know, ST does not provide Nucleo board nor Discovery board with STM32F301C8. Can you double check which STM32F3 is being used on your board?
- debug probe (ULINK2, I-Jet, onboard ST-LINK or external ST-LINK V2 probe, etc.). Make sure not to use a clone probe (i.e. non-genuine probe). Make sure to have the latest probe firmware
- probe connection mode: JTAG or SW
- Keil uVision version
Check that the project configuration is aligned with HW configuration (e.g. JTAG or SW configuration)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-08-08 4:53 AM
Thank you.
