I'm trying to write some data to flash with a LPC55S69 (1B revision). I'm using mbed for the outer application and it doesn't seem to support the device well. I tried using fsl_iap.h API and also tried calling the ROM functions directly as per the UM, in both cases when I enter FLASH_Init I get a lockup of the device. I'm not doing anything advanced in particular, this this:
flash_config_t config;
config.modeConfig.sysFreqInMHz = SystemCoreClock / 1000000;
int r = FLASH_Init(&config);
This is enough for the device to crash and stop responding. I would appreciate any pointers on how to fix or at least debug and find the root cause of this.
Hello @Landswellsong
1) Recommend you first run flashiap demo under SDK on your board.
2) From Datasheet of lpc55s6x, "Flash operations (erase, blank check, program) and reading single word can only be performed for CPU frequencies of up to 100 MHz. Cannot be performed for frequencies above 100 MHz. "
BR
Alice
I'm struggling with LPC55S69 flash issues today myself. The first thing to check is your clock source - it won't work properly with a clock above 100 MHz.
There are references in the MCUXpresso SDK code that make it look like it's specifically expecting to be run from the FRO96 clock source. I don't think it's true that that's the only source you can use, but it's what all of the examples use, and if you check FLASH_Init() you see this as the first line:
/* Initialize the clock to 96MHz */
config->modeConfig.sysFreqInMHz = (uint32_t)kSysToFlashFreq_defaultInMHz;
And here kSysToFlashFreq_defaultInMHz = 96u so the driver seems to expect that to be the only configuration. The documentation is terribly inadequate so who knows what it's actually capable of. I'm writing a bootloader today and I'm just going to assume that the FRO96 is the only valid clock source. Thankfully the bootloader doesn't need to handle any other interfaces or anything with critical timing.
Scott