Other Parts Discussed in Thread: Z-STACK
Tool/software: TI-RTOS
Hello,
i have Z-Stack 1.2.2a on top of Ti-RTOS running on a CC2630 Device. After BIOS_start(); i execute the following piece of code. No zigbee stuff is done at that point, only the following tirtos functions.
/* Get the reason for reset */
uint32_t rSrc = SysCtrlResetSourceGet();
if(rSrc == RSTSRC_WAKEUP_FROM_SHUTDOWN) {
Board_Led_control(board_led_type_LEDGREEN, board_led_state_BLINK);
zstack_sysResetReq_t pReq;
pReq.type = zstack_ResetTypes_DEVICE;
pReq.newNwkState = false;
Zstackapi_sysResetReq(zswEntity, &pReq);
}
else{
PIN_setConfig(keyPinHandleSOS, PINCC26XX_BM_WAKEUP, Board_KEY_SELECT | PINCC26XX_WAKEUP_NEGEDGE);
Power_shutdown(NULL);
}
On power up the device correctly enters the else-path and goes to shutdown. After i press the button the LED blinks and resets and apparently enters the if-path again (infinitely).
I assumed that sysReset would issue a soft-reset as the following api function suggests:
static bool processSysResetReq( ICall_EntityID srcEntityID, void *pMsg )
{
zstackmsg_sysResetReq_t *pReq = (zstackmsg_sysResetReq_t *)pMsg;
if ( pReq->pReq )
{
if(pReq->pReq->newNwkState)
{
zgWriteStartupOptions( ZG_STARTUP_SET,
ZCD_STARTOPT_DEFAULT_NETWORK_STATE | ZCD_STARTOPT_DEFAULT_CONFIG_STATE);
}
--->SystemResetSoft();
pReq->hdr.status = zstack_ZStatusValues_ZSuccess;
}
else
{
pReq->hdr.status = zstack_ZStatusValues_ZInvalidParameter;
}
return (TRUE);
}
Following SystemResetSoft() eventually leads to the following macro:
*((uint32 *)0x40082270) = 1;
Based on this i would assume the next time i use SysCtrlResetSourceGet(); after calling reset would return anthing but RSTSRC_WAKEUP_FROM_SHUTDOWN, enter the else-path and go to shutdown again.
Do i somehow need to clear any register before i reset my device to clear the reset source or something?
kind regards,
stephanie