Hi,
I'm trying to program and read from the Flash with no success. I'm using the fsl drivers:
fsl_flashiap.h
fsl_flashiap.c
from the project_template_mc56f83xxx
this is what I'm doing:
#define DATA_FLASH_START 0x20000
#define FLASH_SECTOR_SIZE 0x800
status_t fstatus;
uint8_t test_program_buffer[8] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
uint8_t readresource_ifr[64];
flash_config_t sFlashConfig[] = {
{ 0 }
};
FLASH_Init(sFlashConfig);
fstatus = FLASH_Erase(sFlashConfig, DATA_FLASH_START, FLASH_SECTOR_SIZE, kFLASH_ApiEraseKey);
fstatus = FLASH_ProgramSection(sFlashConfig, (uint32_t)DATA_FLASH_START, (uint8_t *)test_program_buffer, (uint32_t)8);
fstatus = FLASH_ReadResource(sFlashConfig, (uint32_t)DATA_FLASH_START, (uint8_t *)readresource_ifr, (uint32_t)8, kFLASH_ResourceOptionFlashIfr);
I'm getting 0xFF on all the bytes in readresource_ifr[] which I expected to read back the programmed data bytes
I imagine that the problem is that the bytes are not programmed into the Flash, but why ?
Thanks