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.

CC2652R: Issues using UART to communicate with an external device with rtls_passive

Part Number: CC2652R
Other Parts Discussed in Thread: SYSCONFIG

Hello all, 

I am currently working on a project that uses the rtls_master, rtls_slave, and rtls_passive. Within the rtls_passive project, I want to send some data through UART over to another device. I have looked at the uart2echo example project to see how it is set up and added the code to the rtls_passive project. The issue that I am having is that whenever I build my project, I get linking errors, see attached screenshot.

The code added to the file:

#include <ti/drivers/UART2.h>

const char echoPrompt[] = "testing";
UART2_Handle uart;
UART2_Params uartParams;
size_t bytesWritten = 0;

UART2_Params_init(&uartParams);
uartParams.baudRate = 115200;

uart = UART2_open(0, &uartParams);

if(uart == NULL)
{
/* UART2_open() failed */
while (1);
}

UART2_write(uart, echoPrompt, sizeof(echoPrompt), &bytesWritten);

Errors:

Is there another UART driver library that I should be using? I have looked through the driver files, but there aren't any actual .c files within them. If anyone knows a solution to this, I would greatly appreciate it.

Thank you in advance, 

Adan

  • Hi Adan,

    I have assigned to expert to help you with your query. I see that you are using the 4.40 SDK for your project, is this correct? You may find the following GitHub Example projects useful:

    Simple Serial Socket Client

    Simple Serial Socket Server

    The Simple Serial Socket project uses UART as part of its functionality and may be useful to help you implement UART into your project.

    Regards,

    Jan

  • Jan, 

    Thank you for your reply. 

    Yes, I am using 4.40 SDK. I looked through the examples you provided and I noticed that UART was being used to send data to a PC. I was looking to send/receive data through the pins DIO2 and DIO3 so that it could be connected to say another microcontroller. Would the setup still be the same?

    Also, with the example code provided in my post, I changed UART2 to UART and added the code in the RTLSPassive_taskFxn. The code compiles, but the issue that I am having is that the passive node does not work anymore. The addition of the code seems to break the program. The way I am checking the functionality is by running the rtls_ui.exe program and checking if the device is still discoverable. If I do that without the added code, the device shows up. If I add the code, it does not. Any idea of what might be causing this?

    -------- Edit ------------

    I did some further debugging and noticed that the reason why the program breaks is because the function UART_open() fails and returns NULL. This causes the program to enter the infinite loop.

    -------- Edit 2------------

    After looking around through the code, I have came to the assumption that UART is being used to communicate with the PC; which would explain why the function fails, but I am not 100% sure. 

    So here is what I think is happening: the program loads correctly and sets up all of the peripherals it needs and begins executing the RTLSPassive_tskFxn. Here is where I initialize uart. Because uart has already been initialized and is being used with something else, calling the UART_open() fails.

    I also seen that there was another UART channel available. How can I set it up so I can use it in the project? I am new to the cc26x2R and I am unfamiliar with setting up peripherals. Any help would be much appreciated!

    Adan

  • Adan,

    I do that without the added code, the device shows up. If I add the code, it does not. Any idea of what might be causing this?

    Interesting. It seems you are trying to instantiate the same UART port twice - I would use the UART2 APIs instead.

    Examples of use of the UART2 APIs are shown at the examples uart2echo or uart2callback, which are part of our SDK

    https://dev.ti.com/tirex/explore/node?node=AM12QSgg6YcV.is8TnZaFw__pTTHBmu__LATEST
    https://dev.ti.com/tirex/explore/node?node=ALp228-TYyvj5BU7inysKw__pTTHBmu__LATEST

    Also, be sure to look into the Sysconfig file to get the instantiation of the UART2 peripheral. That is what is probably causing the linker errors you are seeing in your first post - the appropriate library files are not being pulled into your project.

    Hope this helps,

    Rafael

  • Rafael,

    Thank you for your suggestion! I got UART2 working on my project. 

    In case anyone else is trying to add the same peripheral to their project here is what I did.

    1. Follow Rafael's suggestion. 

    2. Click 'Add' to UART2.

    3. Go to 'PinMux'.

    4. Select what pins on the MCU to assign RX and TX. In my case TX->DIO21 RX->DIO22.

    5. Save the Sysconfig.

    You can now incorporate UART2 into your project and everything should work.

    Adan