cancel
Showing results for 
Search instead for 
Did you mean: 

writing half word 16 bits on flash stm32f429ZI

TARHAN SAMAH
Senior
Posted on May 23, 2018 at 10:05

Hello evry body , i can write a byte on flash of stm32f429ZI WÄ°TH success . for info i use nucleo 144 and sector 23 the last sector .

for example :

with these adresses 

uint32_t locip1_adress=0x081E0001;//LAST sector for STM32429ZI sector 23

uint32_t locip2_adress=0x081E0002;//LAST sector for STM32429ZI sector 23

uint32_t locip3_adress=0x081E0003;//LAST sector for STM32429ZI sector 23

uint32_t locip4_adress=0x081E0004;//LAST sector for STM32429ZI sector 23

uint32_t remip1_adress=0x081E0005;//LAST sector for STM32429ZI sector 23

uint32_t remip2_adress=0x081E0006;//LAST sector for STM32429ZI sector 23

uint32_t remip3_adress=0x081E0007;//LAST sector for STM32429ZI sector 23

uint32_t remip4_adress=0x081E0008;//LAST sector for STM32429ZI sector 23

uint32_t ROV_min_adress=0x081E0009;//LAST sector for STM32429ZI sector 23 this data needs two bytes

uint32_t ROV_max_adress=0x081E00B;//LAST sector for STM32429ZI sector 23 this data needs two bytes

/* Unlock the Flash to enable the flash control register access *************/

HAL_FLASH_Unlock();

/* Fill EraseInit structure*/

EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;

EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;

EraseInitStruct.Sector = FLASH_SECTOR_23;

EraseInitStruct.NbSectors = 1;

//you need to erase entire sector before write anything

HAL_FLASHEx_Erase(&EraseInitStruct, &SECTORError);//we need to erase the sector before write

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, locip1_adress,locip1);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, locip2_adress,locip2);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, locip3_adress,locip3);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, locip4_adress,locip4);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, remip1_adress,remip1);//write one byte// we need to write also all other parameter because we delete all sector 23

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, remip2_adress,remip2);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, remip3_adress,remip3);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, remip4_adress,remip4);//write one byte

HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD,ROV_min_adress,Rover_ID_min[0]);//write one 16 bit

HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD,ROV_max_adress,Rover_ID_max[0]);//write one 16 bit

HAL_FLASH_Lock();

But in THE HALFWORD writing i have prblm with 16 bit writing looks these adresses are not accepted 

uint32_t ROV_min_adress=0x081E0009;  ----> in my idea for one word ill use 0x081E0009+ 0x081E000A Two bytes --->is it right

uint32_t ROV_max_adress=0x081E00B;-----> WÄ°LL use 0x081E000B+0x081E000C  two bytes 

but the data at the reading of  ROV_max_adress are wrong strangely ??

how should i select the adresses separation between them for writing half word can someone give me an example . thanks 

could not find detail about mem data adresses in detail .

13 REPLIES 13
Posted on May 24, 2018 at 14:51

TARHAN SAMAH wrote:

much much cleaaaaaaaaaaaaaar thanks much 

https://community.st.com/0D50X00009bMM5DSAW

 
Posted on May 24, 2018 at 16:17

Thank you madame nesrine )))

Anyone done with STM32F429ZI LwIP_TFTP_Server application ?

Using Ethernet i want to transfer file on host server to target board memory or USB.

I'm using Linux with eclipse IDE, USB with OTG.

How to done this ?

Thanks in advance

chum
Associate II

Anyone done with STM32F429ZI LwIP_TFTP_Server application ?

Using Ethernet i want to transfer file on host server to target board memory or USB.

I'm using Linux with eclipse IDE, USB with OTG.

How to done this ?