This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: POWER_SAVING in Z-Stack3.0.1

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

Hello everyone.

I am upgrading my project from zstack2.5.1a to zstack3.0.1.

I use  POWER_SAVING to reduce power consumption in end device.

In Sleep Status, How can get UART packet?

I tried as following.

HAL_ISR_FUNCTION(P0_ISR, P0INT_VECTOR)
{

if(P0IFG == 0x04)
{
P0IFG = 0;
asm("NOP");
P0IF = 0;

SysPowerMode(4);
InitKey(0);

}
else
{
P0IFG = 0;
P0IF = 0;
}
}

void SysPowerMode(uint8 mode)
{
if(mode > 0 && mode < 4)
{
SLEEPCMD &= ~0x03;
SLEEPCMD |= mode;

PCON = 0x01; 
}
else
{

SLEEPCMD = g_nSleepCmd;
asm("NOP");
PCON = 0x00; 
}

asm("NOP");
}

// UART configuration
uartConfig.configured = TRUE; // 2x30 don't care - see uart driver.
#if defined(ZDO_COORDINATOR)
uartConfig.baudRate = HAL_UART_BR_230400;
#else
uartConfig.baudRate = HAL_UART_BR_115200;
#endif
uartConfig.flowControl = FALSE;
uartConfig.flowControlThreshold = 96; // 2x30 don't care - see uart driver.
uartConfig.rx.maxBufSize = 192; // 2x30 don't care - see uart driver.
uartConfig.tx.maxBufSize = 192; // 2x30 don't care - see uart driver.
uartConfig.idleTimeout = 6; // 2x30 don't care - see uart driver.
uartConfig.intEnable = TRUE; // 2x30 don't care - see uart driver.
uartConfig.callBackFunc = CallbackRecvUart;
HalUARTOpen (0, &uartConfig);

But I can't get UART packet in sleep status.

Please help me.

Thanks in advance.

Piao

  • CC2530 UART cannot receive data during CC2530 is under sleeping mode. You have to wake up CC2530 to receive UART message.
  • YK Sir.

    You are right.

    So I used interrupt of general GPIO PIn for RX Pin of UART.

    For this,after main MCU send 10 * 0x00 and send main packet to end device.

    I used this method in previous project (use zstack2.5.1a).

    But I cann't get in zstack3.0.1(using power_saving).

    Piao
  • It sounds feasible to me. I see no reason why it doesn’t work. Maybe try to add more extra 0x00 bytes to give more spare time for Z-Stack 3.0 to resume UART.
  • YK Chen Sir.

    I did tried as above method but it isn't enter in HAL_ISR_FUNCTION().

    ....

    P0IEN |= 0x04;
    PICTL |= 0x0;
    IEN1 |= 0x20;
    P0IFG = 0x00;
    EA = 1;

    .....

    HAL_ISR_FUNCTION(P0_ISR, P0INT_VECTOR)
    {

    if(P0IFG == 0x04)
    {
    printf("HAL_ISR\n");
    P0IFG = 0; //���־λ
    asm("NOP");
    P0IF = 0;
    InitKey(0);
    enterReadyStatus();
    }
    else
    {
    P0IFG = 0; //���־λ
    P0IF = 0;
    }
    }


    Please help me.

    Piao
  • YK Sir.

    I tried as above method but it isn't enter in HAL_ISR_FUNCTION().

    ...

    P0IEN |= 0x04;
    PICTL |= 0x0;
    IEN1 |= 0x20;
    P0IFG = 0x00;
    EA = 1;

    ...

    HAL_ISR_FUNCTION(P0_ISR, P0INT_VECTOR)
    {

    if(P0IFG == 0x04)
    {
    printf("HAL_ISR\n");
    P0IFG = 0;
    asm("NOP");
    P0IF = 0;
    InitKey(0);
    enterReadyStatus();
    }
    else
    {
    P0IFG = 0;
    P0IF = 0;
    }
    }

    Please help me.
    Thanks in advance.

    Piao
  • I fixed it.

    I changed from #define HAL_KEY TRUE to #define HAL_KEY FALSE.