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.

LAUNCHXL-CC26X2R1: specific event trigger for runcmd() packet transmission

Part Number: LAUNCHXL-CC26X2R1

Hello, I need to transmit packets at specific time, so I have to use a different peripheral for triggers. I tried to put the runcmd of cmdPropTxAdv on an interrupt handler to send a packet once an event happen. Somehow it didnt work. Is what I aim possible or did I just do it wrong?

void     UART0IntHandler(void) {
  uint8_t testval;

if (HWREG(UART0_BASE + UART_O_MIS)&UART_MIS_RXMIS)
{
    HWREG(GPIO_BASE + GPIO_O_DOUTTGL31_0)  =  (0x80);
    testval = UARTCharGet(UART0_BASE);
    HWREG(UART0_BASE + UART_O_ICR)|=UART_ICR_RXIC;
}
else if(HWREG(UART0_BASE + UART_O_MIS)&UART_MIS_TXMIS)
{
    HWREG(GPIO_BASE + GPIO_O_DOUTTGL31_0)  =  (0x80);
    RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)& RF_cmdPropTxAdv, RF_PriorityNormal, NULL, 0);
    RF_yield(rfHandle);
    HWREG(UART0_BASE + UART_O_ICR)|=UART_ICR_TXIC;
}

  • I'm not using any rtos environment.

  • Hello pandaman01,

    It is not advised to use an RF command from the UART interrupt context, instead please set a flag which is then serviced in the main function loop.  Furthermore RF_runCmd is a synchronous command which will not preempt running commands, thus you should ensure that the radio is not currently active when using this command.  Otherwise, you should debug the terminationReason and cmdStatus to discover more about what is happening within the RF core.  You can review the Prop RF User's Guide for more details.

    Regards,
    Ryan

  • Actually I'm just testing if there is a possibility of putting the RF_runCMD on any interrupt since I need specific time for packet transmission. And I also needed to keep the system in sleep mode so that it will only transmit everywake up event for power saving reasons. Does the problem only occur on UART or any interrupt sources? I didnt try it on RTC since I observed that it is already used by the API for clock objects. 

    Base on debug session,  no termination reason is returned since it was stucked inside the runCMD

  • You should avoid calls to RF_runCmd from any peripheral interrupt.  How accurate must your timing be?  There should not be too much overhead involved in RF_runCmd or power consumption from the main thread if you use an RTOS to pend/post semaphores.  Maintaining the no-RTOS architecture will be more difficult.

    Regards,
    Ryan