MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
IAP: In Application Programming Driver

Overview

The MCUXpresso SDK provides a driver for the In Application Programming (IAP) module of MCUXpresso SDK devices.

Function groups

The driver provides a set of functions to call the on-chip in application programming interface. User code executing from on-chip RAM can call these functions to read information like part id; read and write flash, EEPROM and FAIM.

Basic operations

The function IAP_ReadPartID() reads the part id of the board.

The function IAP_ReadBootCodeVersion() reads the boot code Version.

The function IAP_ReadUniqueID() reads the unique id of the boards.

The function IAP_ReinvokeISP() reinvokes the ISP mode.

The function IAP_ReadFactorySettings() reads the factory settings.

Flash operations

The function IAP_PrepareSectorForWrite() prepares a sector for write or erase operation. Then, the function IAP_CopyRamToFlash() programs the flash memory.

The function IAP_EraseSector() erases a flash sector while the function IAP_ErasePage() erases a flash page.

The function IAP_BlankCheckSector() is used to blank check a sector or multiple sectors of on-chip flash memory.

The function IAP_Compare() is used to compare the memory contents at two locations. The user can compare several bytes (must be a multiple of 4) content in two different flash locations.

The function IAP_ReadFlashSignature() can get the 32-bits signature of the entire flash and the function IAP_ExtendedFlashSignatureRead() can calculate the signature of one or more flash pages.

EEPROM operations

The function IAP_ReadEEPROMPage() reads the 128 bytes content of an EEPROM page and IAP_WriteEEPROMPage() writes 128 bytes content in an EEPROM page

FAIM operations

The function IAP_ReadEEPROMPage() reads the 32 bits content of an FAIM page and IAP_WriteEEPROMPage() writes 32 bits content in an FAIM page

Typical use case

IAP Basic Operations

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/iap/iap_basic/

IAP Flash Operations

Refer to the driver example codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/iap/iap_flash/

IAP EEPROM Operations

Refer to the driver example codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/iap/iap_eeprom/

IAP FAIM Operations

Refer to the driver example codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/iap/iap_faim/

Files

file  fsl_iap.h
 

Enumerations

enum  {
  kStatus_IAP_Success = kStatus_Success,
  kStatus_IAP_InvalidCommand = MAKE_STATUS(kStatusGroup_IAP, 1U),
  kStatus_IAP_SrcAddrError = MAKE_STATUS(kStatusGroup_IAP, 2U),
  kStatus_IAP_DstAddrError,
  kStatus_IAP_SrcAddrNotMapped,
  kStatus_IAP_DstAddrNotMapped,
  kStatus_IAP_CountError,
  kStatus_IAP_InvalidSector,
  kStatus_IAP_SectorNotblank = MAKE_STATUS(kStatusGroup_IAP, 8U),
  kStatus_IAP_NotPrepared,
  kStatus_IAP_CompareError,
  kStatus_IAP_Busy = MAKE_STATUS(kStatusGroup_IAP, 11U),
  kStatus_IAP_ParamError,
  kStatus_IAP_AddrError = MAKE_STATUS(kStatusGroup_IAP, 13U),
  kStatus_IAP_AddrNotMapped = MAKE_STATUS(kStatusGroup_IAP, 14U),
  kStatus_IAP_NoPower = MAKE_STATUS(kStatusGroup_IAP, 24U),
  kStatus_IAP_NoClock = MAKE_STATUS(kStatusGroup_IAP, 27U),
  kStatus_IAP_ReinvokeISPConfig = MAKE_STATUS(kStatusGroup_IAP, 0x1CU)
}
 iap status codes. More...
 
enum  _iap_commands {
  kIapCmd_IAP_ReadFactorySettings = 40U,
  kIapCmd_IAP_PrepareSectorforWrite = 50U,
  kIapCmd_IAP_CopyRamToFlash = 51U,
  kIapCmd_IAP_EraseSector = 52U,
  kIapCmd_IAP_BlankCheckSector = 53U,
  kIapCmd_IAP_ReadPartId = 54U,
  kIapCmd_IAP_Read_BootromVersion = 55U,
  kIapCmd_IAP_Compare = 56U,
  kIapCmd_IAP_ReinvokeISP = 57U,
  kIapCmd_IAP_ReadUid = 58U,
  kIapCmd_IAP_ErasePage = 59U,
  kIapCmd_IAP_ReadSignature = 70U,
  kIapCmd_IAP_ExtendedReadSignature = 73U,
  kIapCmd_IAP_ReadEEPROMPage = 80U,
  kIapCmd_IAP_WriteEEPROMPage = 81U
}
 iap command codes. More...
 

Driver version

#define FSL_IAP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 4))
 Version 2.0.4. More...
 

Basic operations

status_t IAP_ReadPartID (uint32_t *partID)
 Read part identification number. More...
 
status_t IAP_ReadBootCodeVersion (uint32_t *bootCodeVersion)
 Read boot code version number. More...
 
void IAP_ReinvokeISP (uint8_t ispType, uint32_t *status)
 Reinvoke ISP. More...
 
status_t IAP_ReadUniqueID (uint32_t *uniqueID)
 Read unique identification. More...
 

Macro Definition Documentation

#define FSL_IAP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 4))

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_IAP_Success 

Api is executed successfully.

kStatus_IAP_InvalidCommand 

Invalid command.

kStatus_IAP_SrcAddrError 

Source address is not on word boundary.

kStatus_IAP_DstAddrError 

Destination address is not on a correct boundary.

kStatus_IAP_SrcAddrNotMapped 

Source address is not mapped in the memory map.

kStatus_IAP_DstAddrNotMapped 

Destination address is not mapped in the memory map.

kStatus_IAP_CountError 

Byte count is not multiple of 4 or is not a permitted value.

kStatus_IAP_InvalidSector 

Sector/page number is invalid or end sector/page number is greater than start sector/page number.

kStatus_IAP_SectorNotblank 

One or more sectors are not blank.

kStatus_IAP_NotPrepared 

Command to prepare sector for write operation has not been executed.

kStatus_IAP_CompareError 

Destination and source memory contents do not match.

kStatus_IAP_Busy 

Flash programming hardware interface is busy.

kStatus_IAP_ParamError 

Insufficient number of parameters or invalid parameter.

kStatus_IAP_AddrError 

Address is not on word boundary.

kStatus_IAP_AddrNotMapped 

Address is not mapped in the memory map.

kStatus_IAP_NoPower 

Flash memory block is powered down.

kStatus_IAP_NoClock 

Flash memory block or controller is not clocked.

kStatus_IAP_ReinvokeISPConfig 

Reinvoke configuration error.

Enumerator
kIapCmd_IAP_ReadFactorySettings 

Read the factory settings.

kIapCmd_IAP_PrepareSectorforWrite 

Prepare Sector for write.

kIapCmd_IAP_CopyRamToFlash 

Copy RAM to flash.

kIapCmd_IAP_EraseSector 

Erase Sector.

kIapCmd_IAP_BlankCheckSector 

Blank check sector.

kIapCmd_IAP_ReadPartId 

Read part id.

kIapCmd_IAP_Read_BootromVersion 

Read bootrom version.

kIapCmd_IAP_Compare 

Compare.

kIapCmd_IAP_ReinvokeISP 

Reinvoke ISP.

kIapCmd_IAP_ReadUid 

Read Uid.

kIapCmd_IAP_ErasePage 

Erase Page.

kIapCmd_IAP_ReadSignature 

Read Signature.

kIapCmd_IAP_ExtendedReadSignature 

Extended Read Signature.

kIapCmd_IAP_ReadEEPROMPage 

Read EEPROM page.

kIapCmd_IAP_WriteEEPROMPage 

Write EEPROM page.

Function Documentation

status_t IAP_ReadPartID ( uint32_t *  partID)

This function is used to read the part identification number.

Parameters
partIDAddress to store the part identification number.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
status_t IAP_ReadBootCodeVersion ( uint32_t *  bootCodeVersion)

This function is used to read the boot code version number.

Parameters
bootCodeVersionAddress to store the boot code version.
Return values
kStatus_IAP_SuccessApi has been executed successfully.

note Boot code version is two 32-bit words. Word 0 is the major version, word 1 is the minor version.

void IAP_ReinvokeISP ( uint8_t  ispType,
uint32_t *  status 
)

This function is used to invoke the boot loader in ISP mode. It maps boot vectors and configures the peripherals for ISP.

Parameters
ispTypeISP type selection.
statusstore the possible status.
Return values
kStatus_IAP_ReinvokeISPConfigreinvoke configuration error.

note The error response will be returned when IAP is disabled or an invalid ISP type selection appears. The call won't return unless an error occurs, so there can be no status code.

status_t IAP_ReadUniqueID ( uint32_t *  uniqueID)

This function is used to read the unique id.

Parameters
uniqueIDstore the uniqueID.
Return values
kStatus_IAP_SuccessApi has been executed successfully.