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.

UART CC2650 INTERRUPT CONFIGURATION

Other Parts Discussed in Thread: SYSBIOS, CC2650

Hi,

With the help of  TI BLE Wiki, to the SimpleBLEperipheral project, I added UART drivers data transfer was tested. It works fine in callback mode with tasks.
Initially i attempted a basic UART configuration with UART_read() and UART_write() in a while(1) loop. Interesting thing was it displayed the string " Hello_world " only once and in debug mode, the control was not coming out of UART_write() function. (It goes to disassembly) . I have added the code snippet below. .

  • Is there anything wrong with the code ?

#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
#include "Board.h"

#include <xdc/runtime/Error.h>
#include <ti/sysbios/family/arm/cc26xx/Power.h>
#include <ti/sysbios/BIOS.h>

UART_Handle handle;
UART_Params params;
uint8_t txBuf[]={"Hello_World"};

void main()
{
  PIN_init(BoardGpioInitTable);
  ret=sizeof(txBuf);
  UART_Params_init(&params);  // To initialize UART drivers
  params.baudRate=115200;
  params.writeDataMode=UART_DATA_BINARY;
 
  handle = UART_open(Board_UART,&params);
  while(1)
  {
    UART_write(handle,txBuf,sizeof(txBuf));
   BIOS_start();
  }
}

  • Second,  can't UART be configured for interrupt on RX pin ? I mean, if some data comes via UART_RX pin, the control should be transferred to ISR from the main loop.  Is there any API which should be used to register the ISR on UART? Normally IRQ mapping is done using vector number, right? I searched for vector numbers in IAR installation directory, but couldn't locate one for CC2650 board. How can interrupt be enabled on UART pins?

  • Hello,

    Please see the SW Dev Guide (SWRU393). BIOS_Start can only be called once and it doesn't return. I suggest looking at the examples in the TI-RTOS SDK as well.

    Best wishes
  • Hi,
    OK. I had tried different combinations with and without BioS_start()
    Is there any example for UART IRQ mode??

    I tried to use HWI for UART_IRQ . But no luck. Am I missing some configurations?
    The next option for me is to configure GPIO interrupt and then try reading from UART.

    void uart_isr()
    {

    UART_read(handle,rxBuf,sizeof(rxBuf));
    memcpy(txBuf,rxBuf,sizeof(rxBuf));
    UART_write(handle,txBuf,sizeof(txBuf));
    }

    int main()
    {
    PIN_init(BoardGpioInitTable);
    Task_Params taskParams;
    // Configure task
    Task_Params_init(&taskParams);
    taskParams.stack = taskStack;
    taskParams.stackSize = TASK_STACK_SIZE;
    taskParams.priority = TASK_PRIORITY;
    Task_construct(&taskStruct, uart_task, &taskParams, NULL);

    Hwi_Params_init(&hwiParams);
    hwiParams.enableInt =true;
    hwiParams.priority=1;
    Hwi_create(INT_UART0,(Hwi_FuncPtr)uart_isr,&hwiParams,NULL);
    //Hwi_construct(&UART_callback,INT_UART0,(Hwi_FuncPtr)uart_isr,&hwiParams,NULL);
    // Hwi_enableInterrupt(INT_UART0);
    BIOS_start();
    }
  • Hi,
    One more doubt, I used the UART_echo example in TI RTOS SDK. After the UART_write()/ UART_read() is called, the control never comes back to the next statement. These APIs work fine in callback mode. I mean polling mode with semaphore_pend() and semaphore_post().
    Why is it so? Anyone has faced similar issue??
  • The interrupt routine is inside the UART driver itself which can be added to the project from ti/drivers/uart/UARTCC26XX.c.
    Creating a new interrupt on top of the UART interrupt inside the driver will not work.

    I would suggest looking at the driver documentation for information on how to use the driver:
    tirtos_path\docs\docs_overview.html ->TI-RTOS Driver Runtime APIs (doxygen) ->UARTCC26XX.h

    Regards,
    Svend