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.

CCS/CC2538: smartRF06 Evaluation board

Part Number: CC2538


Tool/software: Code Composer Studio

Hi everyone.

I'm not good at English. Please understand.

Currently in SLEEPMODE TEST. The compiler is under development with IAR ARM 7.40.

However, when downloading and powering on after downloading, RX interrupt does not work and requests help. 

The source is shown below.

//*****************************************************************************

//

// Sleep mode timer ISR

// jhsong 40ms

//*****************************************************************************

void

SleepModeIntHandler(void)

{

unsigned int volatile ui32Val;

st_Time_1s.count++;

st_Time_50ms.flag = 1;

if(st_Time_1s.count>(1000/40))

{

st_Time_1s.count = 0;

st_Time_1s.flag = 1;

st_Time_2s.count++;

if(st_Time_2s.count> 2)

{

st_Time_2s.count = 0;

st_Time_2s.flag = 1;

}

}

return;

}

 

 

/************************************************************************************

UART1, Rx Complete UART1_RXC_vect (0x48)

************************************************************************************/

//#ifdef USE_UART1

void Uart1_EnQueue(void)

{

BYTE tmp = 0;

tmp = UARTCharGet(UART0_BASE);

//tmp = UARTCharGetNonBlocking(UART0_BASE);

comm_queue[UART_1].baRxQueue[comm_queue[UART_1].nRxHead] = tmp;

comm_queue[UART_1].nRxHead++;

if( comm_queue[UART_1].nRxHead >= RX_QUEUE_SIZE )

comm_queue[UART_1].nRxHead = 0;

}

 

void USART1_Init(uint32_t brate)

{

// Enable UART peripheral module

SysCtrlPeripheralEnable(SYS_CTRL_PERIPH_UART0);

// Disable UART function

UARTDisable(UART0_BASE);

// Set IO clock as UART clock source

UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);

//232 PA0, PA1

IOCPinConfigPeriphOutput(GPIO_A_BASE, PA0_PIN_UART_TXD, IOC_MUX_OUT_SEL_UART0_TXD); //UART1 설정

GPIOPinTypeUARTOutput(GPIO_A_BASE, PA0_PIN_UART_TXD);

IOCPinConfigPeriphInput(GPIO_A_BASE, PA1_PIN_UART_RXD, IOC_UARTRXD_UART0); //UART1 설정

GPIOPinTypeUARTInput(GPIO_A_BASE, PA1_PIN_UART_RXD);

UARTConfigSetExpClk(UART0_BASE, SysCtrlClockGet(), brate,

(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |

UART_CONFIG_PAR_NONE));

UARTIntDisable(UART0_BASE, 0x1FFF);

UARTIntRegister(UART0_BASE, &Uart1_EnQueue);

UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);

UARTFIFOEnable(UART0_BASE);

UARTEnable(UART0_BASE);

//UARTEnableSIR(UART0_BASE, 0);

}

void SLEEP_init(void)

{

uint32_t ui32Val;

//

// Let system enter powermode 2 when going to deep sleep

//

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_GPT0);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_GPT1);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_GPT2);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_GPT3);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_SSI0);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_SSI1);

SysCtrlPeripheralDeepSleepEnable(SYS_CTRL_PERIPH_UART0);

SysCtrlPeripheralDeepSleepEnable(SYS_CTRL_PERIPH_UART1);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_I2C);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_PKA);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_AES);

SysCtrlPeripheralDeepSleepDisable(SYS_CTRL_PERIPH_RFC);

//

// Enable the Sleep Timer wakeup

//

SysCtrlPowerModeSet(SYS_CTRL_PM_2);

GPIOIntWakeupEnable(GPIO_IWE_SM_TIMER);

IntEnable(INT_SMTIM); //

// Set timer to 10000 above current value

//

ui32Val = SleepModeTimerCountGet();

SleepModeTimerCompareSet(ui32Val + WAKE_UP_TIME);

SysCtrlDeepSleep();

}

 

void sleep_on(void)

{

unsigned int volatile ui32Val;

SysCtrlPeripheralDeepSleepEnable(SYS_CTRL_PERIPH_UART0);

SysCtrlPeripheralDeepSleepEnable(SYS_CTRL_PERIPH_UART1);

ui32Val = SleepModeTimerCountGet();

SleepModeTimerCompareSet(ui32Val + (WAKE_UP_TIME));

SysCtrlDeepSleep();

}

main(void)

{

unsigned int i;

// Set the clocking to run directly from the external crystal/oscillator.

// (no ext 32k osc, no internal osc)

//

SysCtrlClockSet(false, false, SYS_CTRL_SYSDIV_32MHZ);

SysCtrlIOClockSet(SYS_CTRL_SYSDIV_32MHZ);

gpio_init();

USART1_Init(115200);

USART2_Init(115200);

// WatchdogEnable(WATCHDOG_INTERVAL_32768);

SLEEP_init();

while(1)

{

sleep_on();

}

}

  • Hi,

    To clarify, if you do NOT go into power saving mode, are you able to get the UART RX interrupt as you expect? As stated in the user guide for the device, in PM1-3, no peripheral will be active and the device will not be able to wake on peripheral interrupts. You could however wake on actual IO interrupts if you set these up.

    Try change from PM2 to PM0 and see if it makes a difference for you.