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:
...flash_config_t flash_config; uint8_t uuid_buf; 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, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf); printf(" %02X %02X %02X %02X %02X %02X %02X %02X\n", uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf, uuid_buf);
The code compiles and the functions return success (0) but the data is all 0xFF.
Why isn't it working?
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.
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.
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.
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.