Dear Sir,
I get an issue about KW21 256KB with NVM module.
I created a new example project about ZigBee using BeeKit.
Example is: Ha IASCIE.
Codebase is BeeStack Codebase 4.0.1.

Target board is TWR-KW21D256.

Enable NVM storage module.
And KW21 256 uses FlexNVM as storage.
#if (gTargetTWR_KW21D256_d == 1)
#define gNvUseFlexNVM_d TRUE
#endif

Enable ZTC.

The device type is Coordinator.

Other settings are default, and export the project to IAR.
When run the example, all LEDs are always on.

I traced the code, it stops at while loop. This means NvModuleInit() is failed.
#if gNvStorageIncluded_d
if (NvModuleInit() != gNVM_OK_c)
{
/* NV Module has failed initialization. Lock up node */
TurnOnLeds();
while(1);
}
#endif
I also traced the code more, and found the error point is:
/* Initialize flash HAL driver */
NV_FlashInit(&mNvConfig);
#if (gNvUseFlexNVM_d == TRUE) && (gNV_DEBLOCK_SIZE_c != 0) /* FlexNVM */
/* check data flash IFR map */
if(mNvConfig.EEEBlockSize == 0)
{
return gNVM_NvWrongFlashDataIFRMap_c;
}
…
EEEDataSetSize and DEPartitionCode are 0.
FTFL_FCCOB6 and FTFL_FCCOB7 are 0xFF.

But I see SIM_FCFG1 register. EESIZE is 0x2 means 4k.

I am confused about the two differences, and why the FlexNVM module initialize failed?
The example code is generated from Beekit, I think it should work normally.
Please help to check and resolve this issue.
Thanks.
BR,
Sean Wu
Weikeng Inc.