Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/CC2538: How to change PAN and channel

$
0
0

Part Number:CC2538

Tool/software:TI-RTOS

Hi to All, 

I use Z-Stack Energy on a CC2538, IAR ARM CM3.

I tried to construct a command to change the channel list and PAN-ID. I've made it address specific so that the individual devices incl the coordinator could have the PAN & channels changed. It doesn't seem to work on any of them.

My approach was to write to the NV memory and restart. I think I have the right NV ID's, but not sure, these are the only one's that I could find.

>>>

uint8 outcome1 = osal_nv_item_init( ZCD_NV_SAS_PANID, osal_nv_item_len( ZCD_NV_SAS_PANID ), &pCIAppData[4] );
uint8 outcome2 = osal_nv_item_init( ZCD_NV_SAS_CHANNEL_MASK, osal_nv_item_len( ZCD_NV_SAS_CHANNEL_MASK ), &pCIAppData[0] );
uint8 outcome3 = osal_nv_item_init( ZCD_NV_SAS_PANID, osal_nv_item_len( ZCD_NV_SAS_PANID ), &pCIAppData[4] );
uint8 outcome4 = osal_nv_item_init( ZCD_NV_SAS_CHANNEL_MASK, osal_nv_item_len( ZCD_NV_SAS_CHANNEL_MASK ), &pCIAppData[0] );


if( (outcome1 == 0) && (outcome2 == 0) && (outcome3 == 0) && (outcome4 == 0) )
{
    outcome1 = osal_nv_write( ZCD_NV_SAS_PANID, 0, osal_nv_item_len( ZCD_NV_SAS_PANID ), &pCIAppData[4] );
    outcome2 = osal_nv_write( ZCD_NV_SAS_CHANNEL_MASK, 0, osal_nv_item_len( ZCD_NV_SAS_CHANNEL_MASK ), &pCIAppData[0] );
    outcome3 = osal_nv_write( ZCD_NV_PANID, 0, osal_nv_item_len( ZCD_NV_PANID ), &pCIAppData[4] );
    outcome4 = osal_nv_write( ZCD_NV_CHANLIST, 0, osal_nv_item_len( ZCD_NV_CHANLIST ), &pCIAppData[0] );

    restartFlag = true; //Begin restart procedure, which uses the time update routine and a flag...
}

Note:

outcome-x is used to check that the NV operation did not return errors.


Viewing all articles
Browse latest Browse all 262198

Trending Articles