Hi,
I am trying to write and array to NV memory
#define ZCD_NV_SITE_CFG 0x0401
#define ZCD_NV_SITE_CFG_LTH 8
uint8 nullAddr[8] = {0xB9, 0x00, 0x00, 0x14, 0x38, 0x12, 0x80, 0x99};
status = osal_nv_item_init( ZCD_NV_SITE_CFG, ZCD_NV_SITE_CFG_LTH, NULL );
if ( status == ZSUCCESS )
{
status = osal_nv_write( ZCD_NV_SITE_CFG, 0, ZCD_NV_SITE_CFG_LTH, nullAddr);
}
The error occurs in osal_nv_write
HalFlashRead(srcPg, (srcOff - OSAL_NV_HDR_SIZE), (uint8 *)(&hdr), OSAL_NV_HDR_SIZE);
if ( hdr.len < (ndx + len) )
{
return NV_OPER_FAILED;
}
where there seems to be a test done on the size of the data that can be written as defined in this structur
typedef struct
{
uint16 id;
uint16 len; // Enforce Flash-WORD size on len.
uint16 chk; // Byte-wise checksum of the 'len' data bytes of the item.
uint16 stat; // Item status.
} osalNvHdr_t;
Currently the lenght seems to be set to 4 and if I reduce the size of my array to write ZCD_NV_SITE_CFG_LTH to 4,
the works successfully.
However I cannot find where the length in the osalNvHdr_t; structure is set and what are the parameters around it
I have found osal_nv_write functions called with larger array amounts of data
Could you tell me if its possible to set the array length larger and, if so, how to do it
Thank You
Regards
Peter Simpson