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.

CC1310: UART configuration for cc1310

Part Number: CC1310

Dear All,

we are working on  CC1310 Launchpad, Downloaded code example SimpleLink CC13x0 SDK 1.60.00.21 (version 1.60.00.21) .

I am using Nortos rfEasylinkTx and rfEasyLinkRx examples for my Application. 

 I want to Configure UART with Interrupt method, so that any Receiving data Bytes on UART should raise the Interrupt. I included the file UART.c of driver lib in my project.

How can we configure UART with Interrupt, can we have any example to receive data in Interrupt?

  • Hello Riki,

    in case of CC1310, please consider UARTCC26xx.h instead of UART.h as your interface to CC1310 (and CC26xx family) UART devices.
    If your have any farther questions, do not hesitate to ask.
  • Please take a look at the UART driver documentation:

    dev.ti.com/.../

    Siri
  • Part Number: CC1310

    Hello Tomasz and siri,


    Thank you for your quick response.

    I had a look on UART26XX.C file, it seems bit complex for me.
    Hence decided to initialize UART using uart.c register level drivers, according to technical refrence manual.
    I Wrote a code but it's not working.
    I need help !

    /* UART Initialization */


    #define PRCM_DOMAIN_SERIAL 0x00000002
    #define UART_Clk 24000000
    #define Baudrate 115200
    #define LCRH_CONFIG 0x00000060

    /* ui32Base is UART0 Base Address */


    void
    UART0_Init(uint32_t ui32Base)
    {


    /* steps as given in Technical refrence manual page no.1460 */

    PRCMPowerDomainOn(PRCM_DOMAIN_SERIAL);
    PRCMPeripheralRunEnable(ui32Base);
    PRCMPeripheralSleepEnable(ui32Base);
    PRCMPeripheralDeepSleepEnable(ui32Base);
    PRCMLoadSet();

    IOCPinTypeUart( ui32Base, IOID_2 , IOID_3,
    IOID_UNUSED, IOID_UNUSED );

    UARTConfigSetExpClk( ui32Base, UART_Clk, Baudrate, LCRH_CONFIG);

    UARTEnable(ui32Base);

    }

  • Have you looked at how the UART is used in the SDK? See dev.ti.com/.../README.html

    as a start. The PRCM... is handled by the driver and is nothing a user should be looking into.
  • Riki,

    this late evening (GTM+1) I will have time to look at your issue.
  • Hi Tomasz,
    Thank you for your support.
    could you please take a look on my first question of this conversation, I want simplest way to configure UART with interrupt method.

    Thanks !
    riki
  • Hi Riki,

    you wrote: I Wrote a code but it's not working.

    Sorry, but I have to say, your statement almost means nothing.

    What does not work?
    Where is your interrupt routine?
    Help me so I could help you.

    I have no experience in programming PRCM.
    TI-RTOS does PRCM management for me.
    In your code, you have entered into the PRCM domain.
    Does both rfEasyLinkRx and rfEasyLinkTx manage PRCM for you?
    I do not thing so.

    I have linked your code example and I have found that your code fails at:
    UARTConfigSetExpClk( ui32Base, UART_Clk, Baudrate, LCRH_CONFIG);
    statement.

    In your code example you said: /* steps as given in Technical reference manual page no.1460 */
    You have missed something.
    Page no. 1460 (in case of SWCU117H ref. man. ver., saying exactly) says that:
    the UART:IBRD and UART:FBRD registers must be written before the UART:LCRH register.

    You call UARTConfigSetExpClk( ui32Base, UART_Clk, Baudrate, LCRH_CONFIG)
    however I do not know what it does.
    Could you help me and explain me initial conditions for UARTConfigSetExpClk to be called on?

    Bear on mind that UART drivers for CC1310 are designed to be used with TI-RTOS.
    You decide to go TI_RTOS highway or your way.

    I do recommend for you to use TI-RTOS UART drivers even in case of nortos example .

    If you agree with me and decide to use TI-RTOS drivers
    I can show in a 5 minutes how to set it up and make working.
  • Hello Tomasz,

    I wanted to configure UART through Register level drivers, But as you said :I do recommend for you to use TI-RTOS UART drivers even in case of nortos example .

    So please explain how to set it up and make working for Polling and Interrupt methods.

  • Riki: On a higher level, are you planning to write your code bare metal and if so, why? What do you mean by "register level drivers"?

    In any case why strongly recommend using our drivers.
  • Have you looked at the UartEcho example for no rtos that was referred to prevoisly?
    Why can't you use this code? If you do not want to use blocking mode, you can do a search on E2E on for example params.writeCallback or params.readCallback
  • Hi TER,

    sorry, it's not Register level drivers. That is the functions given in uart.c file .
    Actually I didn't find UART Init function in that (uart.c) file. That's why I tried to write code to initialize UART according to Technical Reference Manual and using these functions like IOCPinTypeUart(), UARTConfigSetExpCl() . I posted my code in above conversations, that code is unable to Initialize UART.
    later I used UART.c file, In which UART_init() is given , now UART_write() and UART_read() is working properly but with polling , I want to use it with interrupt.

    Thanks !
    riki
  • Have you did what I suggested and searched E2E? I did a quick search and found an example for CC2640R2 that are verified by TI. The same example can be used on CC13xx.

    Siri
  • Hello Riki,

    I do like this:

    In main()

    /* Call board init functions */
    Board_initGeneral();
    Board_initUART();
    and then
    UART_InitChannels();



    In UART_InitChannels()

    UART_Handle uart;
    UART_Params uartParams;
    Semaphore_Params semParams;

    /* Create an UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = BAUDRATE_BASE;
    uart = UART_open(Board_UART0, &uartParams);

    if (uart == NULL) {
    System_abort("Error opening the UART");
    }
    return 0;


    As you see within the code above, I assign default params for the uartParams structure and modify when needed.


    Then you can use:

    UART_read(uart, &input, size);
    UART_write(uart, &otput, size);


    In a real application you probably cannot go with defaults like:
    * readTimeout = UART_WAIT_FOREVER;
    * writeTimeout = UART_WAIT_FOREVER;
    You might serve timeouts, counters in separate thread, watchdog or whatever is good for your design.
  • Hi Siri,

    when I was writing response for Riki
    my text was well formatted and looked much better that you can see a posted text right now.
    For ex: in each line begging spaces were removed.

    Do you have any recommendations for me to have better formatted questions and responses?
    Any link to text I missed?
  • When replying to a post, select the "Insert Code, Attach Files and more..." link.

    Then you get several formatting options.

    BR

    Siri

  • Thanks!
  • Hello Siri.
    I have tried the echo Uart example provided in the simplelink sdk.
    But that uses Blocking Read and Write.
    I've changed that mode to Read and WriteCallback.

    Now my question is how can this Callback (for eg Readcallback) be invoked via UART ISR?
  • When using the UART driver provided by TI, the UART ISR will be internally handled by the driver. The driver will then post the callbacks in SWI context out to the user. You will not have to think about the actual invocation of the UART ISR, your callback function will be called when the criteria is meet.

    If you run the uartecho example and want to change to callback mode I recommend you look again into the UART driver documentation that contains an example for how to use callback mode.

    http://dev.ti.com/tirex/content/simplelink_cc26x2_sdk_2_10_00_44/docs/tidrivers/doxygen/html/_u_a_r_t_c_c26_x_x_8h.html

  • Thanks.

    Regards,
    Nishit.