2020-01-18 07:43 AM
Hello
i want to write some variable data on internal flash using HAL library but it not writing.
I am using blow code to write data to flash.
can you please tell what am i doing wrong.
#define FLASH_ADDRS 0x081E002A
#define FLASH_DATA_W 0x093
void FLASH_WRITE_DATA()
{
HAL_FLASH_Unlock();
FLASH_Erase_Sector(FLASH_SECTOR_7, FLASH_BANK_2, FLASH_VOLTAGE_RANGE_3);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD,FLASH_ADDRS,FLASH_DATA_W);
HAL_FLASH_Lock();
}
2020-01-18 08:50 AM
Instrument the code, report status/errors
Write to a WORD aligned address.
2020-01-18 02:47 PM
For the H7 write have to be 32 byte aligned and you write in chunks of 32 bytes, from my code:
int64_t initoptions[4] __attribute__ ((aligned (32)))
int64_t* volatile test;
test=(int64_t* volatile)initoptions;
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, (uint32_t)test, (uint64_t)((uint32_t)i64))
2020-01-19 02:35 AM
thanks for reply.
i will try it