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: TFMini Plus using UART using CCS

Part Number: LAUNCHXL-CC26X2R1
Other Parts Discussed in Thread: ENERGIA, SYSCONFIG, CC2652R7

Hello,

I'm using a CC26X2R1-LAUNCHXL and a LiDAR device (TFMini Plus: [technical documentation]).

I already have a program that works fine on two TI - TivaC w/ TM4C123 boards (compiled on Arduino 2.0 IDE), but I'm encountering difficulties connecting the TFMini to the board using the RX/TX pins. I haven't found much information about this issue, or I might not fully understand it due to the Code Composer Studio (CCS) requirement, as I must use CCS because Energia/Arduino IDE doesn't support my board.

The only thread I found that could potentially help me is this one: [the thread], but I'm still struggling to grasp all the configuration requirements for CCS.

If you could provide any guidance or clarification on configuring the TFMini Plus with CCS or suggest alternative resources, I would greatly appreciate it. I'm looking forward to successfully integrating my LiDAR device with the CC26X2R1-LAUNCHXL platform.

Thank you in advance for your assistance.

(If you have any working project/code that I can get to understand, it would be amazing)

  • Hello Kylian Maillard,

    I hope you are well. For more information regarding how to use UART with the CC26X2R1 device please reference: 

    UART echo example in the SDK: https://dev.ti.com/tirex/explore/node?node=A__AJ0rCcugoJRKwGj-BDBgvA__com.ti.SIMPLELINK_CC13XX_CC26XX_SDK__BSEc4rl__LATEST

    POSIX (with also shows how to use/configure UART) SimpleLink Academy (SLA): POSIX Project Zero — CC13XX CC26XX SimpleLink Academy (ti.com)

    Make sure you are configuring UART correctly within sysconfig, and reference what PinMux TX/RX pins are set to (a dropdown menu within sysconfig UART).

    Thanks
    Alex F

     

  • Hello,

    Thank you for providing the examples!

    Using your help, I was able to use UART_write(), although I admit that I don't 100% understand &bytesRead / &bytesWritten arguments within UART_write() / UART_read(). I proceeded to use the only example I found which use a CC26** and TFMini Plus (although I suspect it may be incomplete; it can be found on GitHub). My objective was to facilitate debugging and access the real-time data provided by the LiDAR through UART1, knowing that UART0 is connected to the PC via USB. I encountered a problem when using printf() or puts() with the GCC compiler, so I changed for TI-clang

    However, when I run the following code snippets:

    Source:

    while (1) {
        printf("hello ");
    };


    Output:

    [Cortex_M4_0] hello hello hello hello hello... (+100 times)


    Source:
    for (int j = 0; j <= 20; j++) {
        printf("hello\n");
    };


    Output: (only 5 or 6 times even though I requested it to be executed 20 times)

    [Cortex_M4_0] hello
    hello
    hello
    hello
    hello
    hello


    Source:
    for (int j = 0; j <= 20; j++) {
        printf("%d:\n", j);
        if (j == 2) printf("VAAA\n");
        if (j == 3) printf("VB\n");
        if (j == 4) printf("VC\n");
    }



    Output:
    [Cortex_M4_0] 0:
    1:
    2:
    VAAA
    3:
    VB


    And sometimes it prints this:

    [Cortex_M4_0] 0:
    1:
    2:
    VAAA
    3:


    It appears that the program crashes after printing around 5 lines. I have also observed that when I include `sleep(1);` (from `#include <unistd.h`), the program stops.

    I am uncertain if others have encountered this issue, or if it is specific to my situation.

    Thank you in advance for any guidance.

    Kylian

    By the way, is it possible to include an Energia sketch in CCSv12? I couldn't find a specific button in the Project navbar for this purpose.

  • Hello Kylian,

    It is good to hear you got some functionality working, to comment on the bytesRead the UART2.h file describes it as follows:  

    "bytesRead: If non-NULL, the location to store the number of bytes actually read into the buffer. If NULL, this parameter will be ignored. In callback mode, NULL could be passed in for this parameter, since the callback function will be passed the number of bytes read. Similarly, in blocking mode with infinite
    timeout, NULL can be passed. However, status should be checked in case the number of bytes requested was not received due to errors.
    In nonblocking mode, it is not recommended to pass NULL for this parameter, as it would be impossible to determine the number of bytes actually read."

    Could you try to use a UART2_write instead of printf, and repeat the same test. I tested a CC2652R7 board, in the uart2echo example with the following code:

        //uart2echo code above this, code within mainThread, comment out the while loop
        UART2_write(uart, echoPrompt, sizeof(echoPrompt), &bytesWritten);
        for (int j = 0; j <= 20; j++) {
            char message[] = "hello\r\n";
            UART2_write(uart, message, sizeof(message), &bytesWritten);
        }
        for (int j = 0; j <= 20; j++) {
            if (j == 2) { UART2_write(uart, ":VAAA\r\n", 10, &bytesWritten);}
            if (j == 3) { UART2_write(uart, ":VB\r\n", 6, &bytesWritten);}
            if (j == 4) { UART2_write(uart, ":VC\r\n", 6, &bytesWritten);}
            UART2_write(uart, "\r\n", 1, &bytesWritten);
        }

    Gave the following image (in PuTTY):

    Is this something along the lines of what you are trying to do? Otherwise, if you want to fill data in a specific way you can try sprintf into a message buffer then pass that message buffer into UART2_write. 

    Sleep should not normally crash the program, after you implement the tests/changes above then try sleep, and if it crashes again try to then use debug and a breakpoint right before sleep code. If you want you can try the "empty..." project in your SDK, this project toggles a led and sleeps for 1 second. 

    Thanks,
    Alex F