Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
C90TFS Flash Driver

Overview

The Kinetis SDK provides the C90TFS Flash driver of Kinetis devices with the C90TFS Flash module inside. The C90TFS/FTFx SSD provides general APIs to handle specific operations on C90TFS/FTFx Flash module. The user can use those APIs directly in the application. In addition, it provides internal functions called by the driver. Although these functions are not meant to be called from the user's application directly, the APIs can still be used.

The C90TFS/FTFx SSD provides the following features:

  1. Drivers released in source code format to provide compiler-independent supporting for non-debug-mode embedded applications.
  2. Each driver function is independent. Therefore, the end user can choose the function subset to meet their particular needs.
  3. Position-independent and ROM-able.
  4. Concurrency support via callback.

Important Note

  1. The DebugEnable field of FLASH_SSD_CONFIG structure allows the user to use this driver in the background debug mode without returning to the caller function, but returning to debug mode instead. To enable this feature, DebugEnable must be set to TRUE and macro C90TFS_ENABLE_DEBUG must be set to 1.
  2. To use callback in the application, this callback function must not be placed in the same Flash block in which a program/erase operation occurs to avoid the RWW error.
  3. To suspend the sector erase operation for a simple method, invoke the FlashEraseSuspend function within callback of FlashEraseSector. In this case, the FlashEraseSuspend must not be placed in the same block in which the Flash erase sector command is going on.
  4. FlashCommandSequence, FlashSuspend and FlashResume should be executed from RAM or different Flash blocks which are targeted for writing to avoid the RWW error.
  5. To guarantee the correct execution of this driver, the Flash cache in the Flash memory controller module should be disabled before invoking any API. The standard demo included in the release package provides the code section to disable/enable the Flash cache.

Data Structures

struct  PFLASH_SSD_CONFIG
 Flash SSD Configuration Structure. More...
 

Macros

#define SET_FLASH_INT_BITS(ftfxRegBase, value)
 Sets the Flash interrupt enable bits in the FCNFG register. More...
 
#define GET_FLASH_INT_BITS(ftfxRegBase)
 Returns the Flash interrupt enable bits in the FCNFG register. More...
 

C90TFS Flash configuration

#define ENDIANNESS   LITTLE_ENDIAN
 Endianness.
 
#define CPU_CORE   ARM_CORTEX_M
 CPU core.
 
#define FTFx_PSECTOR_SIZE   FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE
 P-Flash sector size.
 
#define FTFx_DSECTOR_SIZE   FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_SECTOR_SIZE
 D-Flash sector size.
 
#define DEBLOCK_SIZE   (FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_SIZE * FSL_FEATURE_FLASH_FLEX_NVM_BLOCK_COUNT)
 FlexNVM block size.
 
#define EEESIZE_0000   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0000
 Emulated EEPROM size code 0000 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0001   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0001
 Emulated EEPROM size code 0001 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0010   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0010
 Emulated EEPROM size code 0010 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0011   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0011
 Emulated EEPROM size code 0011 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0100   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0100
 Emulated EEPROM size code 0100 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0101   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0101
 Emulated EEPROM size code 0101 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0110   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0110
 Emulated EEPROM size code 0110 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_0111   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_0111
 Emulated EEPROM size code 0111 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1000   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1000
 Emulated EEPROM size code 1000 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1001   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1001
 Emulated EEPROM size code 1001 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1010   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1010
 Emulated EEPROM size code 1010 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1011   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1011
 Emulated EEPROM size code 1011 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1100   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1100
 Emulated EEPROM size code 1100 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1101   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1101
 Emulated EEPROM size code 1101 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1110   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1110
 Emulated EEPROM size code 1110 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define EEESIZE_1111   FSL_FEATURE_FLASH_FLEX_NVM_EEPROM_SIZE_FOR_EEESIZE_1111
 Emulated EEPROM size code 1111 mapping to emulated EEPROM size in bytes (0xFFFF = reserved)
 
#define DEPART_0000   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0000
 FlexNVM partition code 0000 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0001   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0001
 FlexNVM partition code 0001 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0010   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0010
 FlexNVM partition code 0010 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0011   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0011
 FlexNVM partition code 0011 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0100   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0100
 FlexNVM partition code 0100 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0101   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0101
 FlexNVM partition code 0101 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0110   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0110
 FlexNVM partition code 0110 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_0111   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_0111
 FlexNVM partition code 0111 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1000   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1000
 FlexNVM partition code 1000 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1001   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1001
 FlexNVM partition code 1001 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1010   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1010
 FlexNVM partition code 1010 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1011   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1011
 FlexNVM partition code 1011 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1100   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1100
 FlexNVM partition code 1100 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1101   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1101
 FlexNVM partition code 1101 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1110   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1110
 FlexNVM partition code 1110 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DEPART_1111   FSL_FEATURE_FLASH_FLEX_NVM_DFLASH_SIZE_FOR_DEPART_1111
 FlexNVM partition code 1111 mapping to data flash size in bytes (0xFFFFFFFF = reserved)
 
#define DFLASH_IFR_READRESOURCE_ADDRESS   0x8000FCU
 Data flash IFR map.
 
#define PGMCHK_ALIGN_SIZE   FSL_FEATURE_FLASH_PFLASH_CHECK_CMD_ADDRESS_ALIGMENT
 P-Flash Program check command address alignment.
 
#define PGM_SIZE_BYTE   FSL_FEATURE_FLASH_PFLASH_BLOCK_WRITE_UNIT_SIZE
 P-Flash write unit size.
 
#define RESUME_WAIT_CNT   0x20U
 Resume wait count used in FlashResume function.
 
#define PFLASH_FAC_PRESENCE   FSL_FEATURE_FLASH_HAS_ACCESS_CONTROL
 PFlash FAC presence.
 

Address convert macros

#define BYTE2WORD(x)   (x)
 Convert from byte address to word(2 bytes) address. More...
 
#define WORD2BYTE(x)   (x)
 Convert from word(2 bytes) address to byte address. More...
 

PFlash swap control codes

#define FTFx_SWAP_SET_INDICATOR_ADDR   0x01U
 Initialize Swap System control code.
 
#define FTFx_SWAP_SET_IN_PREPARE   0x02U
 Set Swap in Update State.
 
#define FTFx_SWAP_SET_IN_COMPLETE   0x04U
 Set Swap in Complete State.
 
#define FTFx_SWAP_REPORT_STATUS   0x08U
 Report Swap Status.
 

PFlash swap states

#define FTFx_SWAP_UNINIT   0x00U
 Uninitialized swap mode.
 
#define FTFx_SWAP_READY   0x01U
 Ready swap mode.
 
#define FTFx_SWAP_UPDATE   0x02U
 Update swap mode.
 
#define FTFx_SWAP_UPDATE_ERASED   0x03U
 Update-Erased swap mode.
 
#define FTFx_SWAP_COMPLETE   0x04U
 Complete swap mode.
 

C90TFS Flash driver APIs

uint32_t RelocateFunction (uint32_t dest, uint32_t size, uint32_t src)
 Relocates a function to RAM address. More...
 
uint32_t FlashInit (PFLASH_SSD_CONFIG pSSDConfig)
 Initializes Flash. More...
 
uint32_t FlashCommandSequence (PFLASH_SSD_CONFIG pSSDConfig)
 Flash command sequence. More...
 
uint32_t PFlashGetProtection (PFLASH_SSD_CONFIG pSSDConfig, uint32_t *protectStatus)
 P-Flash get protection. More...
 
uint32_t PFlashSetProtection (PFLASH_SSD_CONFIG pSSDConfig, uint32_t protectStatus)
 P-Flash set protection. More...
 
uint32_t FlashGetSecurityState (PFLASH_SSD_CONFIG pSSDConfig, uint8_t *securityState)
 Flash get security state. More...
 
uint32_t FlashSecurityBypass (PFLASH_SSD_CONFIG pSSDConfig, uint8_t *keyBuffer, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash security bypass. More...
 
uint32_t FlashEraseAllBlock (PFLASH_SSD_CONFIG pSSDConfig, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash erase all Blocks. More...
 
uint32_t FlashEraseAllBlockUnsecure (PFLASH_SSD_CONFIG pSSDConfig, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash erase all Blocks unsecure. More...
 
uint32_t FlashVerifyAllBlock (PFLASH_SSD_CONFIG pSSDConfig, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash verify all Blocks. More...
 
uint32_t FlashEraseSector (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash erase sector. More...
 
uint32_t FlashVerifySection (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint16_t number, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash verify sector. More...
 
uint32_t FlashEraseSuspend (PFLASH_SSD_CONFIG pSSDConfig)
 Flash erase suspend. More...
 
uint32_t FlashEraseResume (PFLASH_SSD_CONFIG pSSDConfig)
 Flash erase resume. More...
 
uint32_t FlashReadOnce (PFLASH_SSD_CONFIG pSSDConfig, uint8_t recordIndex, uint8_t *pDataArray, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash read once. More...
 
uint32_t FlashProgramOnce (PFLASH_SSD_CONFIG pSSDConfig, uint8_t recordIndex, uint8_t *pDataArray, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash program once. More...
 
uint32_t FlashReadResource (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint8_t *pDataArray, uint8_t resourceSelectCode, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash read resource. More...
 
uint32_t FlashProgram (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint8_t *pData, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash program. More...
 
uint32_t FlashProgramCheck (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint8_t *pExpectedData, uint32_t *pFailAddr, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash program check. More...
 
uint32_t FlashCheckSum (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint32_t *pSum)
 Calculates check sum. More...
 
uint32_t FlashProgramSection (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint16_t number, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash program section. More...
 
uint32_t FlashEraseBlock (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash erase block. More...
 
uint32_t FlashVerifyBlock (PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash verify block. More...
 

Return Code Definition for FTFx SSD

#define FTFx_OK   0x0000U
 Function executes successfully.
 
#define FTFx_ERR_MGSTAT0   0x0001U
 MGSTAT0 bit is set in the FSTAT register. More...
 
#define FTFx_ERR_PVIOL   0x0010U
 Protection violation is set in FSTAT register. More...
 
#define FTFx_ERR_ACCERR   0x0020U
 Access error is set in the FSTAT register. More...
 
#define FTFx_ERR_CHANGEPROT   0x0100U
 Cannot change protection status. More...
 
#define FTFx_ERR_NOEEE   0x0200U
 FlexRAM is not set for EEPROM use. More...
 
#define FTFx_ERR_EFLASHONLY   0x0400U
 FlexNVM is set for full EEPROM backup. More...
 
#define FTFx_ERR_RAMRDY   0x0800U
 Programming acceleration RAM is not available. More...
 
#define FTFx_ERR_RANGE   0x1000U
 Address is out of the valid range. More...
 
#define FTFx_ERR_SIZE   0x2000U
 Misaligned size. More...
 
#define FTFx_ERR_NOFAC   0x4000U
 No FAC feature More...
 

Flash security status

#define FLASH_NOT_SECURE   0x01U
 Flash currently not in secure state.
 
#define FLASH_SECURE_BACKDOOR_ENABLED   0x02U
 Flash is secured and backdoor key access enabled.
 
#define FLASH_SECURE_BACKDOOR_DISABLED   0x04U
 Flash is secured and backdoor key access disabled.
 

Null Callback function definition

#define NULL_CALLBACK   ((PCALLBACK)0xFFFFFFFF)
 Null callback.
 
#define NULL_SWAP_CALLBACK   ((PFLASH_SWAP_CALLBACK)0xFFFFFFFF)
 Null swap callback.
 

Type definition for flash driver

typedef void(* PCALLBACK )(void)
 Call back function pointer data type.
 
typedef bool(* PFLASH_SWAP_CALLBACK )(uint8_t function)
 Swap call back function pointer data type.
 
typedef uint32_t(* pFLASHCOMMANDSEQUENCE )(PFLASH_SSD_CONFIG pSSDConfig)
 FlashCommandSequence function pointer.
 
typedef uint32_t(* pFLASHINIT )(PFLASH_SSD_CONFIG pSSDConfig)
 FlashInit function pointer.
 
typedef uint32_t(* pPFLASHGETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t *protectStatus)
 PFlashGetProtection function pointer.
 
typedef uint32_t(* pPFLASHSETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t protectStatus)
 PFlashSetProtection function pointer.
 
typedef uint32_t(* pPFLASHFACGETXAPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *protectStatus, uint8_t *numberOfSegments, uint32_t *segmentSize)
 PFlashFacGetXAProtection function pointer.
 
typedef uint32_t(* pPFLASHFACGETSAPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *protectStatus, uint8_t *numberOfSegments, uint32_t *segmentSize)
 PFlashFacGetSAProtection function pointer.
 
typedef uint32_t(* pFLASHGETSECURITYSTATE )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *securityState)
 FlashGetSecurityState function pointer.
 
typedef uint32_t(* pFLASHSECURITYBYPASS )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *keyBuffer, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashSecurityByPass function pointer.
 
typedef uint32_t(* pFLASHERASEALLBLOCK )(PFLASH_SSD_CONFIG pSSDConfig, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashEraseAllBlock function pointer.
 
typedef uint32_t(* pFLASHERASEALLBLOCKUNSECURE )(PFLASH_SSD_CONFIG pSSDConfig, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashEraseAllBlockUnsecure function pointer.
 
typedef uint32_t(* pFLASHERASEBLOCK )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashEraseBlock function pointer.
 
typedef uint32_t(* pFLASHERASESECTOR )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashEraseSector function pointer.
 
typedef uint32_t(* pFLASHERASESUSPEND )(PFLASH_SSD_CONFIG pSSDConfig)
 FlashEraseSuspend function pointer.
 
typedef uint32_t(* pFLASHERASERESUME )(PFLASH_SSD_CONFIG pSSDConfig)
 FlashEraseResume function pointer.
 
typedef uint32_t(* pFLASHPROGRAMSECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint16_t number, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashProgramSection function pointer.
 
typedef uint32_t(* pFLASHCHECKSUM )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint32_t *pSum)
 FlashChecksum function pointer.
 
typedef uint32_t(* pFLASHVERIFYALLBLOCK )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashVerifyAllBlock function pointer.
 
typedef uint32_t(* pFLASHVERIFYBLOCK )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 Flash verify block.
 
typedef uint32_t(* pFLASHVERIFYSECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint16_t number, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashVerifySection function pointer.
 
typedef uint32_t(* pFLASHREADONCE )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *pDataArray, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashReadOnce function pointer.
 
typedef uint32_t(* pFLASHPROGRAMONCE )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *pDataArray, uint32_t size, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashProgramOnce function pointer.
 
typedef uint32_t(* pFLASHPROGRAMCHECK )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint8_t *pExpectedData, uint32_t *pFailAddr, uint8_t marginLevel, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashProgramCheck function pointer.
 
typedef uint32_t(* pFLASHREADRESOURCE )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint8_t *pDataArray, uint8_t resourceSelectCode, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashReadResource function pointer.
 
typedef uint32_t(* pFLASHPROGRAM )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint8_t *pData, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 FlashProgram function pointer.
 
typedef uint32_t(* pPFLASHSWAPCTRL )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t addr, uint8_t swapcmd, uint8_t *pCurrentSwapMode, uint8_t *pCurrentSwapBlockStatus, uint8_t *pNextSwapBlockStatus, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 PFlashSwapCtrl function pointer.
 
typedef uint32_t(* pFLASHSWAP )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t flashAddress, PFLASH_SWAP_CALLBACK pSwapCallback, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 PFlashSwap function pointer.
 
typedef uint32_t(* pDFLASHGETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *protectStatus)
 DFlashGetProtection function pointer.
 
typedef uint32_t(* pDFLASHSETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t protectStatus)
 DFlashSetProtection function pointer.
 
typedef uint32_t(* pEERAMGETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t *protectStatus)
 EERAMGetProtection function pointer.
 
typedef uint32_t(* pEERAMSETPROTECTION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t protectStatus)
 EERAMSetProtection function pointer.
 
typedef uint32_t(* pDEFLASHPARTITION )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t EEEDataSizeCode, uint8_t DEPartitionCode, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 DEFlashParition function pointer.
 
typedef uint32_t(* pSETEEEENABLE )(PFLASH_SSD_CONFIG pSSDConfig, uint8_t EEEEnable, pFLASHCOMMANDSEQUENCE pFlashCommandSequence)
 SetEEEEnable function pointer.
 
typedef uint32_t(* pEEEWRITE )(PFLASH_SSD_CONFIG pSSDConfig, uint32_t dest, uint32_t size, uint8_t *pData)
 EEEWrite function pointer.
 

Data Structure Documentation

struct FLASH_SSD_CONFIG

The structure includes the static parameters for C90TFS/FTFx which are device-dependent. The user should correctly initialize the fields including ftfxRegBase, PFlashBlockBase, PFlashBlockSize, DFlashBlockBase, EERAMBlockBase, DebugEnable and CallBack before passing the structure to SSD functions. The rest of parameters such as DFlashBlockSize, and EEEBlockSize will be initialized in FlashInit() automatically. The pointer to CallBack has to be initialized either for null callback or a valid call back function.

Data Fields

uint32_t ftfxRegBase
 The register base address of C90TFS/FTFx.
 
uint32_t PFlashBase
 The base address of P-Flash memory.
 
uint32_t PFlashSize
 The size in byte of P-Flash memory.
 
uint32_t DFlashBase
 For FlexNVM device, this is the base address of D-Flash memory (FlexNVM memory); For non-FlexNVM device, this field is unused.
 
uint32_t DFlashSize
 For FlexNVM device, this is the size in byte of area which is used as D-Flash from FlexNVM memory; For non-FlexNVM device, this field is unused.
 
uint32_t EERAMBase
 The base address of FlexRAM (for FlexNVM device) or acceleration RAM memory (for non-FlexNVM device)
 
uint32_t EEESize
 For FlexNVM device, this is the size in byte of EEPROM area which was partitioned from FlexRAM; For non-FlexNVM device, this field is unused.
 
bool DebugEnable
 Background debug mode enable.
 
PCALLBACK CallBack
 Call back function to service the time critical events.
 

Macro Definition Documentation

#define BYTE2WORD (   x)    (x)

Two address types are only different in DSC devices. In Kinstis devices, they are the same

#define WORD2BYTE (   x)    (x)

Two address types are only different in DSC devices. In Kinstis devices, they are the same

#define SET_FLASH_INT_BITS (   ftfxRegBase,
  value 
)
Value:
REG_WRITE((ftfxRegBase) + FTFx_SSD_FCNFG_OFFSET,\
((value)&(FTFx_SSD_FCNFG_CCIE | FTFx_SSD_FCNFG_RDCOLLIE)))
Parameters
ftfxRegBaseSpecifies register base address of the Flash module
valueThe bit map value ( 0: disabled, 1 enabled) . The numbering is marked from 0 to 7 where bit 0 is the least significant bit. Bit 7 is corresponding to command complete interrupt. Bit 6 is corresponding to read collision error interrupt.
#define GET_FLASH_INT_BITS (   ftfxRegBase)
Value:
REG_READ((ftfxRegBase) + FTFx_SSD_FCNFG_OFFSET) &\
(FTFx_SSD_FCNFG_CCIE | FTFx_SSD_FCNFG_RDCOLLIE)
Parameters
ftfxRegBaseSpecifies register base address of the Flash module.
#define FTFx_ERR_MGSTAT0   0x0001U

Possible causes:

MGSTAT0 bit in FSTAT register is set. Refer to corresponding command description of each API on reference manual to get detail reasons

Solution:

Hardware error

#define FTFx_ERR_PVIOL   0x0010U

Possible causes:

FPVIOL bit in FSTAT register is set. Refer to corresponding command description of each API on reference manual to get detail reasons

Solution:

The flash location targeted to program/erase operation must be unprotected. Swap indicator must not be programmed/erased except in Update or Update-Erase state.

#define FTFx_ERR_ACCERR   0x0020U

Possible causes:

ACCERR bit in FSTAT register is set. Refer to corresponding command description of each API on reference manual to get detail reasons.

Solution:

Provide valid input parameters for each API according to specific flash module.

#define FTFx_ERR_CHANGEPROT   0x0100U

Possible causes:

Violates protection transition.

Solution:

In NVM normal mode, protection size cannot be decreased. Therefore, the only increasing protection size is permitted if the device is operating in this mode.

#define FTFx_ERR_NOEEE   0x0200U

Possible causes:

User accesses to EEPROM operation but there is no EEPROM backup enabled.

Solution:

Need to enable EEPROM by partitioning FlexNVM to have EEPROM backup and/or enable it by SetEEEnable API.

#define FTFx_ERR_EFLASHONLY   0x0400U

Possible causes:

User accesses to D-Flash operation but there is no D-Flash on FlexNVM.

Solution:

Need to partition FlexNVM to have D-Flash.

#define FTFx_ERR_RAMRDY   0x0800U

Possible causes:

User invokes flash program section command but FlexRam is being set for EEPROM emulation.

Solution:

Need to set FlexRam as traditional Ram by SetEEEnable API.

#define FTFx_ERR_RANGE   0x1000U

Possible causes:

The size or destination provided by user makes start address or end address out of valid range.

Solution:

Make sure the destination and (destination + size) within valid address range.

#define FTFx_ERR_SIZE   0x2000U

Possible causes:

The size provided by user is misaligned.

Solution:

Size must be an aligned value according to specific constrain of each API.

#define FTFx_ERR_NOFAC   0x4000U

Possible causes:

User invokes get FAC XA or SA protection command but there is not FAC on FTFA/FTFE/FTFL modules.

Solution:

Do not invoke FAC related APIs when it is unavailable.

Function Documentation

uint32_t RelocateFunction ( uint32_t  dest,
uint32_t  size,
uint32_t  src 
)

This function provides a facility to relocate a function in RAM.

Parameters
destDestination address where you want to place the function.
sizeSize of the function
srcAddress of the function will be relocated
Returns
Relocated address of the function .
uint32_t FlashInit ( PFLASH_SSD_CONFIG  pSSDConfig)

This API initializes Flash module by clearing status error bit and reporting the memory configuration via SSD configuration structure.

Parameters
pSSDConfigThe SSD configuration structure pointer.
Returns
Successful completion (FTFx_OK)
uint32_t FlashCommandSequence ( PFLASH_SSD_CONFIG  pSSDConfig)

This API is used to perform command write sequence on Flash. It is internal function, called by driver APIs only.

Parameters
pSSDConfigThe SSD configuration structure pointer.
Returns
Successful completion (FTFx_OK)
Failed in Flash command execution (FTFx_ERR_ACCERR, FTFx_ERR_PVIOL, FTFx_ERR_MGSTAT0)
uint32_t PFlashGetProtection ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t *  protectStatus 
)

This API retrieves the current P-Flash protection status. Considering the time consumption for getting protection is very low and even can be ignored. It is not necessary to utilize the Callback function to support the time-critical events.

Parameters
pSSDConfigThe SSD configuration structure pointer.
protectStatusTo return the current value of the P-Flash Protection. Each bit is corresponding to protection of 1/32 of the total P-Flash. The least significant bit is corresponding to the lowest address area of P-Flash. The most significant bit is corresponding to the highest address area of P- Flash and so on. There are two possible cases as below:
  • 0: this area is protected.
  • 1: this area is unprotected.
Returns
Successful completion (FTFx_OK)
uint32_t PFlashSetProtection ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  protectStatus 
)

This API sets the P-Flash protection to the intended protection status. Setting P-Flash protection status is subject to a protection transition restriction. If there is a setting violation, it returns an error code and the current protection status won’t be changed.

Parameters
pSSDConfigThe SSD configuration structure pointer.
protectStatusThe expected protect status user wants to set to P-Flash protection register. Each bit is corresponding to protection of 1/32 of the total P-Flash. The least significant bit is corresponding to the lowest address area of P-Flash. The most significant bit is corresponding to the highest address area of P- Flash, and so on. There are two possible cases as shown below:
  • 0: this area is protected.
  • 1: this area is unprotected.
Returns
Successful completion (FTFx_OK )
Error value (FTFx_ERR_CHANGEPROT)
uint32_t FlashGetSecurityState ( PFLASH_SSD_CONFIG  pSSDConfig,
uint8_t *  securityState 
)

This API retrieves the current Flash security status, including the security enabling state and the back door key enabling state.

Parameters
pSSDConfigThe SSD configuration structure pointer.
securityStateTo return the current security status code. FLASH_NOT_SECURE (0x01): Flash currently not in secure state; FLASH_SECURE_BACKDOOR_ENABLED (0x02): Flash is secured and back door key access enabled; FLASH_SECURE_BACKDOOR_DISABLED (0x04): Flash is secured and back door key access disabled.
Returns
Successful completion (FTFx_OK)
uint32_t FlashSecurityBypass ( PFLASH_SSD_CONFIG  pSSDConfig,
uint8_t *  keyBuffer,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API un-secures the device by comparing the user's provided back door key with the ones in the Flash Configuration Field. If they are matched, the security is released. Otherwise, an error code is returned.

Parameters
pSSDConfigThe SSD configuration structure pointer.
keyBufferPoint to the user buffer containing the back door key.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR)
uint32_t FlashEraseAllBlock ( PFLASH_SSD_CONFIG  pSSDConfig,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API erases all Flash memory, initializes the FlexRAM, verifies all memory contents, and then releases the MCU security.

Parameters
pSSDConfigThe SSD configuration structure pointer.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_PVIOL, FTFx_ERR_MGSTAT0, FTFx_ERR_ACCERR)
uint32_t FlashEraseAllBlockUnsecure ( PFLASH_SSD_CONFIG  pSSDConfig,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API erases all Flash memory, initializes the FlexRAM, verifies all memory contents, program security byte to unsecure state, and then releases MCU security. Note: This API only applies to limited targets, please refer to FTFA/FTFE/FTFL chapter and check the validity of this API.

Parameters
pSSDConfigThe SSD configuration structure pointer.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_MGSTAT0, FTFx_ERR_ACCERR)
uint32_t FlashVerifyAllBlock ( PFLASH_SSD_CONFIG  pSSDConfig,
uint8_t  marginLevel,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This function checks to see if the P-Flash and/or D-Flash, EEPROM backup area, and D-Flash IFR have been erased to the specified read margin level, if applicable, and releases security if the readout passes.

Parameters
pSSDConfigThe SSD configuration structure pointer.
marginLevelRead Margin Choice as follows: marginLevel = 0x0: use the Normal read level marginLevel = 0x1: use the User read marginLevel = 0x2: use the Factory read
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_MGSTAT0, FTFx_ERR_ACCERR)
uint32_t FlashEraseSector ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint32_t  size,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API erases one or more sectors in P-Flash or D-Flash memory. This API always returns FTFx_OK if size provided by the user is zero regardless of the input validation.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destAddress in the first sector to be erased.
sizeSize to be erased in bytes. It is used to determine number of sectors to be erased.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_MGSTAT0, FTFx_ERR_ACCERR, FTFx_ERR_PVIOL,FTFx_ERR_SIZE)
uint32_t FlashVerifySection ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint16_t  number,
uint8_t  marginLevel,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API checks if a section of the P-Flash or the D-Flash memory is erased to the specified read margin level.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended verify operation.
numberNumber of alignment unit to be verified. Refer to corresponding reference manual to get correct information of alignment constrain.
marginLevelRead Margin Choice as follows: marginLevel = 0x0: use Normal read level marginLevel = 0x1: use the User read marginLevel = 0x2: use the Factory read
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_MGSTAT0, FTFx_ERR_ACCERR)
uint32_t FlashEraseSuspend ( PFLASH_SSD_CONFIG  pSSDConfig)

This API is used to suspend a current operation of Flash erase sector command. This function must be located in RAM memory or different Flash blocks which are targeted for writing to avoid the RWW error.

Parameters
pSSDConfigThe SSD configuration structure pointer.
Returns
Successful completion (FTFx_OK)
uint32_t FlashEraseResume ( PFLASH_SSD_CONFIG  pSSDConfig)

This API is used to resume a previous suspended operation of Flash erase sector command This function must be located in RAM memory or different Flash blocks which are targeted for writing to avoid RWW error.

Parameters
pSSDConfigThe SSD configuration structure pointer.
Returns
Successful completion (FTFx_OK)
uint32_t FlashReadOnce ( PFLASH_SSD_CONFIG  pSSDConfig,
uint8_t  recordIndex,
uint8_t *  pDataArray,
uint32_t  size,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API is used to read out a reserved 64 byte field located in the P-Flash IFR via given number of record. See the corresponding reference manual to get the correct value of this number.

Parameters
pSSDConfigThe SSD configuration structure pointer.
recordIndexThe record index will be read. It can be from 0x0 to 0x7 or other range according to specific derivative.
sizeByte count of data to be read. The value of size should be 4 or 8 according to specific derivative.
pDataArrayPointer to the array to return the data read by the read once command.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR)
uint32_t FlashProgramOnce ( PFLASH_SSD_CONFIG  pSSDConfig,
uint8_t  recordIndex,
uint8_t *  pDataArray,
uint32_t  size,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API is used to program to a reserved 64 byte field located in the P-Flash IFR via given number of record. See the corresponding reference manual to get correct value of this number.

Parameters
pSSDConfigThe SSD configuration structure pointer.
recordIndexThe record index will be read. It can be from 0x0 to 0x7 or other range according to specific derivative.
pDataArrayPointer to the array from which data will be taken for program once command.
sizeByte count of data to be programmed. The value of size should be 4 or 8 according to specific derivative.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR,FTFx_ERR_MGSTAT0)
uint32_t FlashReadResource ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint8_t *  pDataArray,
uint8_t  resourceSelectCode,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API is used to read data from special purpose memory in Flash memory module including P-Flash IFR, swap IFR, D-Flash IFR space and version ID.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended read operation.
pDataArrayPointer to the data returned by the read resource command.
resourceSelectCodeRead resource select code: 0 : Flash IFR 1: Version ID
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR)
uint32_t FlashProgram ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint32_t  size,
uint8_t *  pData,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API is used to program 4 consecutive bytes (for program long word command) and 8 consecutive bytes (for program phrase command) on P-Flash or D-Flash block. This API always returns FTFx_OK if size provided by user is zero regardless of the input validation

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended program operation.
sizeSize in byte to be programmed
pDataPointer of source address from which data has to be taken for program operation.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR, FTFx_ERR_PVIOL, FTFx_ERR_SIZE, FTFx_ERR_MGSTAT0)
uint32_t FlashProgramCheck ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint32_t  size,
uint8_t *  pExpectedData,
uint32_t *  pFailAddr,
uint8_t  marginLevel,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API tests a previously programmed P-Flash or D-Flash long word to see if it reads correctly at the specified margin level. This API always returns FTFx_OK if size provided by user is zero regardless of the input validation

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended program check operation.
sizeSize in byte to check accuracy of program operation
pExpectedDataThe pointer to the expected data.
pFailAddrReturned the first aligned failing address.
marginLevelRead margin choice as follows: marginLevel = 0x1: read at User margin 1/0 level. marginLevel = 0x2: read at Factory margin 1/0 level.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR, FTFx_ERR_MGSTAT0)
uint32_t FlashCheckSum ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint32_t  size,
uint32_t *  pSum 
)

This API performs 32 bit sum of each byte data over a specified Flash memory range without carry which provides rapid method for checking data integrity. The callback time period of this API is determined via FLASH_CALLBACK_CS macro in the SSD_FTFx_Common.h which is used as a counter value for the CallBack() function calling in this API. This value can be changed as per the user requirement. User can change this value to obtain the maximum permissible callback time period. This API always returns FTFx_OK if size provided by user is zero regardless of the input validation.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address of the Flash range to be summed
sizeSize in byte of the Flash range to be summed
pSumTo return the sum value
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_RANGE)
uint32_t FlashProgramSection ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint16_t  number,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API will program the data found in the Section Program Buffer to previously erased locations in the Flash memory. Data is preloaded into the Section Program Buffer by writing to the acceleration Ram and FlexRam while it is set to function as a RAM. The Section Program Buffer is limited to the value of FlexRam divides by a ratio. Refer to the associate reference manual to get correct value of this ratio. For derivatives including swap feature, the swap indicator address is encountered during FlashProgramSection, it is bypassed without setting FPVIOL but the content are not be programmed. In addition, the content of source data used to program to swap indicator will be re-initialized to 0xFF after completion of this command.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended program operation.
numberNumber of alignment unit to be programmed. Refer to associate reference manual to get correct value of this alignment constrain.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR, FTFx_ERR_PVIOL, FTFx_ERR_MGSTAT0, FTFx_ERR_RAMRDY)
uint32_t FlashEraseBlock ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API erases all addresses in an individual P-Flash or D-Flash block. For the derivatives including multiply logical P-Flash or D-Flash blocks, this API erases a single block in a single call.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended erase operation.
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR, FTFx_ERR_PVIOL, FTFx_ERR_MGSTAT0)
uint32_t FlashVerifyBlock ( PFLASH_SSD_CONFIG  pSSDConfig,
uint32_t  dest,
uint8_t  marginLevel,
pFLASHCOMMANDSEQUENCE  pFlashCommandSequence 
)

This API checks to see if an entire P-Flash or D-Flash block has been erased to the specified margin level For the derivatives including multiply logical P-Flash or D-Flash blocks, this API erases a single block in a single call.

Parameters
pSSDConfigThe SSD configuration structure pointer.
destStart address for the intended verify operation.
marginLevelRead Margin Choice as follows: marginLevel = 0x0: use Normal read level marginLevel = 0x1: use the User read marginLevel = 0x2: use the Factory read
pFlashCommandSequence: Pointer to the Flash command sequence function.
Returns
Successful completion (FTFx_OK)
Error value (FTFx_ERR_ACCERR, FTFx_ERR_MGSTAT0)