I'm running on our custom LPC55S69 board. I'm trying to access the UUID in the protected flash region. After reading the Flash_ifr_driver section of the SDK API Reference Manual, I added the "IAP1" driver in MCUXpresso and added this code to my project:
#include "fsl_iap_ffr.h"...
flash_config_t flash_config; uint8_t uuid_buf[16]; printf("FFR_Init: %d\n", FFR_Init(&flash_config)); printf("FFR_GetUUID: %d\n", FFR_GetUUID(&flash_config, uuid_buf)); printf("uuid_buf: %02X %02X %02X %02X %02X %02X %02X %02X\n", uuid_buf[0], uuid_buf[1], uuid_buf[2], uuid_buf[3], uuid_buf[4], uuid_buf[5], uuid_buf[6], uuid_buf[7]); printf(" %02X %02X %02X %02X %02X %02X %02X %02X\n", uuid_buf[8], uuid_buf[9], uuid_buf[10], uuid_buf[11], uuid_buf[12], uuid_buf[13], uuid_buf[14], uuid_buf[15]);
The code compiles and the functions return success (0) but the data is all 0xFF.
Why isn't it working?
Mike
Hello Mike,
I just add your code into "flashiap" demo under SDK, it can work well:
What about the version of your chip ? You can get it from the masking of chip.
And how about use the latest SDK v2.8 and latest MCUXpresso IDE v11.2.0.
Regards,
Alice
On further analysis, if I update the ConfigTools Clocks settings to enable the FRO 96M clock, then the MCUXpresso-generated code (clock_config.c) is sufficient and I don't need to copy the BOARD_BootClockFROHF96M function from the example. I also don't seem to need to call FLASH_Init any more, just calling FFR_Init is sufficient.
I noticed that after I've successfully called FFR_Init and FFR_GetUUID, I can't free/re-use the memory where the flash_config_t object was stored because it continues to be referenced by some sort of interrupt handler, even though I am not calling any FFR or flash functions. The SDK API reference manual mentions a function FFR_Deinit, but this function doesn't exist in the SDK header files. I made the object static/global to get around this.
This is working well enough for me now, thanks for the help.
OK, thanks for your sharing.
Alice,
Thanks, I tried the flashiap1 demo and it works, so I investigated what the demo had that my project was missing. It turned out I needed two things:
Copy the BOARD_BootClockFROHF96M function from the example and call it.
Call FLASH_Init.
Now I can read the UUID.
I will study the BOARD_BootClockFROHF96M function; I assume it is doing things that really should be done in the IDE Clocks tool.
Thanks,
Mike