Other Parts Discussed in Thread: CC2530
Hi All !
I think i have found a bug in znp_interface.c that comes with CC2530 ZNP Mini Kit.
In the function "setSecurityKey" starting at line 555:
void setSecurityKey(unsigned char* key)
{
#ifdef ZNP_INTERFACE_VERBOSE
printf("Setting Security Key: ");
printHexBytes(key, ZCD_NV_PRECFGKEY_LEN);
#endif
znpBuf[0] = ZB_WRITE_CONFIGURATION_LEN + ZCD_NV_PRECFGKEY_LEN;
znpBuf[1] = MSB(ZB_WRITE_CONFIGURATION);
znpBuf[2] = LSB(ZB_WRITE_CONFIGURATION);
znpBuf[3] = ZCD_NV_PRECFGKEY;
znpBuf[4] = ZCD_NV_PRECFGKEY_LEN;
for (int i=5; i<(ZCD_NV_PRECFGKEY_LEN+5); i++)
znpBuf[i] = key[i];
znpResult = sendMessage();
}
The security key is copied to the transfer buffer from the 5th index. The security code itself is
only 16 bytes long, so with the above code the transfer buffer gets 5 bytes long garbage from the memory..
Otherwise this code is great help for developing applications !
Bye,
Kristof