Hello Kedari,
Apparently, when the BeeKit HA OnOffSwitch project is generated for TWR-KW21D256, the NVM module is enabled (default setting), but for this type of board the NVM that is used is FlexNVM (due to the fact that the part has FlexMemory). If you check the AppToPlatformConfig.h header file, you will find the macro gNvUseFlexNVM_d set to TRUE.
The NVM initialization fails because the part is not configured to use the FlexMemory. Moreover, after each mass-erase of the device the bits that configures the FlexNVM are cleared and the default setting is DEPART=0b1111, EEESIZE=0b1111. According to RM this simply means “no EEPROM”. The entire DFLASH block is used as regular data/instruction flash memory.
Anyway, to be sure you have the same value, please try using a breakpoint in NV_FlashHAL.c file at line illustrated and send us the values of EEEDataSetSize and DEPartitionCode variables.
Moreover, If you do not want to use the FlexMemory feature, you can disable the feature (set gNvUseFlexNVM = FALSE in the project options or even in AppToPlatformConfig.h) and then modify the linker file to use DFLASH block. This is however application specific. You could generate a TWR-KW24D512 project and check its linker file to get an idea.
Regards,
AngelC