MKW30Z FlashApater.h usage

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKW30Z FlashApater.h usage

549 Views
lucianfiran
Contributor V

KW40Z_Connectivity_Software_1.0.1 (KSDK_1.3.0) IAR 7.50

In Flash_Adapter.h there is a structure 576bytes (4*32+6*8+8*8+42*8):

typedef PACKED_STRUCT hardwareParameters_tag
{
    uint8_t  reserved[42];             /* for backward compatibility */
    uint8_t  ieee_802_15_4_address[8]; /* IEEE 802.15.4 MAC address */
    uint8_t  bluetooth_address[6];     /* Bluetooth address */
    uint32_t xtalTrim;                 /* KW4x only */
    uint32_t edCalibrationOffset;      /* KW01 ED offset */
    uint32_t pllFStepOffset;           /* KW01 fine tune pll */
    uint32_t gInternalStorageAddr;     /* The start address of the internal storage used for OTA update.
                                          A value of 0xFFFFFFFF means that the External storage is used. */
} hardwareParameters_t;

Initialized at start ApplMain.c and in hardware_init.c

hardware_init() { ....
NV_ReadHWParameters(&gHardwareParameters);

void main_task(uint32_t param) { ....
        /* Initialize NV module */
        NV_Init();

Used for KW3xXcvrDrv.c (KW4xXcvrDrv.c)
void XcvrInit ( radio_mode_t radioMode )
{
    XcvrInit_ModeChg_Common(radioMode,FIRST_INIT);
#ifdef gXcvrXtalTrimEnabled_d
  if( 0xFFFFFFFF != gHardwareParameters.xtalTrim )
  {
      XcvrSetXtalTrim( (uint8_t)gHardwareParameters.xtalTrim );
  }
#endif
}

Used for OtaSupport.c
otaResult_t OTA_InitExternalMemory(void) {....
        /* Update the offset to the internal storage if necessary */
        NV_ReadHWParameters(&gHardwareParameters);
        if( gHardwareParameters.gInternalStorageAddr != gEepromParams_StartOffset_c )
        {
            gHardwareParameters.gInternalStorageAddr = gEepromParams_StartOffset_c;
            NV_WriteHWParameters(&gHardwareParameters);
        }

MKW30Z4_features.h

#define FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE (1024)

Why this hardwareParameters structure is dimensioned and set like this ?

Does bluetooth_address[6] has a specific value ?

Can the structure be changed by removing ieee_802_15_4_address, edCalibrationOffset, pllFStepOffset and adding new data in the reserved zone ?

Best Regards,

Lucian

0 Kudos
2 Replies

380 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Lucian,

The device contains 2 program flash blocks (one 128Kbytes, one 32Kbytes) consisting of 1 KB sectors.

This is the reason for the #define FSL_FEATURE_FLASH_PFLASH_BLOCK_SECTOR_SIZE (1024)

You can change the structure, but you have to care the structure size doesn't exceed the 1024 kb.

For a better reference please take a look the RM  Chapter 3.6 Memories and memory interfaces

Best Regards,

Mario

0 Kudos

380 Views
lucianfiran
Contributor V

I understand that the max size of the struct is 1K as it mirrors last ROM area in the chip via NV_ReadHWParameters and write.

But what is the reserved data for ? Compatibility with what ?

I see no usage of the bluetooth_address part - there is an example or demo where these fields are actually used ?

0 Kudos