How do you program One-time-programmable (OTP) Flash on Apollo MCUs? Where can I find information about it? Are there HAL functions in the AmbiqSuite SDK for programming and reading the OTP Flash?
The OTP Flash on Apollo2 and Apollo3 is 16KB (2 pages) in size. Only one page called Customer Info Space, or INFO0, is for customer use. It also contains Flash protection fields. "OTP", "INFO0" and "INFO space" are used interchangeably in most documentation and code. The "OTP" reference to this space is really a legacy term and a misnomer, as the INFO0 page is customer reprogrammable.
Please refer to the following sections in the Apollo2 and Apollo3 Datasheets for information about the Flash OTP on the these MCUs.
- Chapter 3. MCU Core Details, Section "Memory Subsystem"
- Appendix 1. Flash OTP 0 Customer Info Space (Info)
In the AmbiqSuite SDK, there are HAL functions for reading, programming and erasing OTP/INFO0 in am_hal_flash.c.
Additionally there is an addendum for both the Apollo2 and Apollo3 Datasheets called "Flash Programming Helper Functions", which describe program and erase helper functions for the main Flash and OTP/INFO0 Flash.