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.

CC1352P: Data Garbled at UART side in CC1352P.

Part Number: CC1352P
Other Parts Discussed in Thread: SYSCONFIG

Dear TI,

I am using CC1352p Launchpad and receiving data from 4 slaves CC2642P. While receiving the data on CC1352P I want it to be displayed on UART. I am using Putty to display the data at 460800 Baud. I am using SDK version simplelink_cc13x2_26x2_sdk_4_10_00_78. 

While receiving the data on Putty I see data is being Garbled at UART side. I also checked with Teraterm but I saw data garbled there as well. 

Can I know the possible cause of this. Also whenever data is Garbled the very next data is lost. 

Please find the Image of the issue below. I am directly printing the data without using library.

In the Image you can see the data I want is in the first line, but multiple time I see garbled data in which the data from next line combines with the previous line data and causing delay in the next data to come on UART.

Can I know how and what is the cause of this issue?

Thank You

  • Hi Ankit,

    A couple of comments and questions:

    1. The SDK version that you are using is a bit outdated, so I recommend that you update to the latest version (v5.30) since there's been some updates to the TI drivers.

    2. Can you clarify about what you mean with receiving data from 4 slaves? How are you receiving the data (I2C, SPI, etc.)?

    3. When you say that you want to display the data using the UART, do you mean that you want to process the data in the CC1352 and then send it to a PC hose with the UART?

    4. Which UART driver are you using? Remember that there are two UART drivers (UART and UART2)?

    5. How are you configuring the UART (with the drivers)?

    5. Can you clarify what you mean when you say that you are directly printing the data without using a library?

    BR,
    Andres

  • Hello Andres, 
    Please find my answers colored in Blue

    1. The SDK version that you are using is a bit outdated, so I recommend that you update to the latest version (v5.30) since there's been some updates to the TI drivers. OK will try with this

    2. Can you clarify about what you mean with receiving data from 4 slaves? How are you receiving the data (I2C, SPI, etc.)? Over BLE

    3. When you say that you want to display the data using the UART, do you mean that you want to process the data in the CC1352 and then send it to a PC hose with the UART? Yes we have done processing only thing left it to display it properly

    4. Which UART driver are you using? Remember that there are two UART drivers (UART and UART2)? We have used display.h driver to directly display using Display_print5 function

    5. How are you configuring the UART (with the drivers)? In sysconfig we have config the same

    5. Can you clarify what you mean when you say that you are directly printing the data without using a library? Same answer as Q4

    I found that by using Display function our MCU can leave this task when any imp task comes in and that this Display.h runs only when our MCU is idle. Is this true ?

    Also can you share with me some example code to try printing the data using UART drivers. I tries with UART.h but couldn't see any data on UART. Can you share any example code to print the string of data on UART as I see too many examples and everywhere is different. Also what all things are mandatory to run UART  ?

    Regards,
    Ankit

  • Hi Ankit,

    Thank you for the clarifications.

    I know understand, and my recommendation would be to switch to just a UART driver (UART2 would be better). The display driver is there to offer an additional abstraction layer so that you can choose different display implementations (like an LCD for instance).

    I found that by using Display function our MCU can leave this task when any imp task comes in and that this Display.h runs only when our MCU is idle. Is this true ?

    I don't really understand what you mean here. As far as I know, the only limitation here is that it might not be safe to make call to the Display driver from a Hwi/Swi context. 


    Also can you share with me some example code to try printing the data using UART drivers. I tries with UART.h but couldn't see any data on UART. Can you share any example code to print the string of data on UART as I see too many examples and everywhere is different. Also what all things are mandatory to run UART  ?

    As I mentioned before, it would be better to use the UART2 driver. Having said this, the driver can be used and configured  in many different ways. It is up to you to determine the best configuration for your particular application. Having said this, my suggestion is to first try the uart2callback example.

    https://dev.ti.com/tirex/explore/node?node=AAlG9NOjN0wZZzxVYMi7OQ__BSEc4rl__LATEST

    Just run the example to familiarize yourself with how the driver works, and then it should be easy to add it to your particular application.

    https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_5_30_01_01/docs/drivers/doxygen/html/_u_a_r_t2_8h.html

    BR,
    Andres

  • Hello Andres,
    I tried UART2 but unable to print the data.

    FYI - I am using same UART2 for the remaining diaplay_printf functions that I used in other files.
    Is there any issue with this. Also I want to send the data on UART from a buffer that I have created. I don't want to receive any data from UART and just send periodically. The interval is 10 MS for 32Bytes of data.

    I tried using simple UART too but unable to print even a string and was able to print all using simple displayprintf5.  

  • Hi Ankit,

    I tried UART2 but unable to print the data.

    What do you mean here? Did the uart2callback example work for you?

    FYI - I am using same UART2 for the remaining diaplay_printf functions that I used in other files.
    Is there any issue with this.

    There shouldn't be any issue with this, but keep in mind that you are adding a (perhaps) unnecessary layer to your code.  

    Also I want to send the data on UART from a buffer that I have created. I don't want to receive any data from UART and just send periodically. The interval is 10 MS for 32Bytes of data.

    As I mentioned before, your best bet is just to use the basic UART drivers (either UART or UART2). The examples show how do either send or receive data. Furthermore, since you want to send data periodically, you can either use the clock module from the kernel, or you can even use an actual timer. The SimpleLink includes examples for both the clock module and for the timer.

    You can also find the documentation here:

    https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_5_30_01_01/docs/tirtos/sysbios/docs/cdoc/index.html

    https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_5_30_01_01/docs/drivers/doxygen/html/_g_p_timer_c_c26_x_x_8h.html

    I tried using simple UART too but unable to print even a string and was able to print all using simple displayprintf5.  

    How are you trying to print the string? Keep in mind that the UART is just a peripheral, and the driver gives you access and control to the peripheral. The formatting on the other hand, needs to be handled by the application. So it's not like you can immediately use UART_write() as as sort of printf().

    BR,
    Andres

  • Hello Andres,

    Thanks for your reply.

    I tried simple UART it worked for me.

    I have few more queries can you please help me out with it.

    1. I used uart write and it worked for me. But I have multiple arguments with different data types that I was simply printing using Display_print5 or so by converting it into string using itoa() now while using uart_write how can i print different data types variables.

    2. I was using strcat() to add different variable by converting them to string using itoa(). But I got to know strcat is slower than sprintf() so i used sprintf(). But while using sprintf() my uart stops randomly after some seconds.

    writeDataMode = UART_DATA_BINARY;
    baudRate = 460800;

    Can you suggest me some way to combine different datatype variable into string and send it to uart as quick as possible as we want everything to be realtime with less delay.

    Regards,
    Ankit Tomar

  • Hi Ankit,

    You can probably get some ideas from this:

    https://dev.ti.com/tirex/explore/node?node=ANqagjxZxWnBRB7bx0EnOw__pTTHBmu__LATEST

    In particular, the use of System_printf with the SysCallback proxy. The SysCallback module allows a user to plug in a putc-like function (putchFxn) that is called within System_printf after the formatting is done. A common use-case is to plug in a putchFxn function that writes the character to a UART.

    You can read more about the SysCallback module here:

    https://dev.ti.com/tirex/content/simplelink_cc13xx_cc26xx_sdk_5_30_01_01/docs/tirtos/sysbios/docs/cdoc/index.html

    Now, keep in mind that according to this thread, System_printf makes use of breakpoints and can impact timing which might be bad for time-sensitive applications. So you’ll need to run some tests to make sure that it doesn’t affect your application. But even if it’s not possible for you to use something like System_printf, you can probably look at the code and get some ideas on how to format your data, before sending it to the UART.

    Best regards,
    Andres

  • Hi Andres,

    I tried UART library, unfortunately I am still able to see the error. I still see my data being Garbled and once I saw corrupts in the data I want I see that for nearly 2 sec my data is lost.
    For Ex - If I see data garbled at 5sec timestamp then after this data garbled issue I lost my 6,7 sec data and directly get the data from 8sec timestamp.

    So If my Slave is sending 100 Data every 1 sec so I loose 200 data after each data corrupt.

    Why I see this issue even after using UART library directly.

    Thanks for your continuous support.

    Regards,
    Ankit Tomar

  • Hi Ankit,

    I tried UART library, unfortunately I am still able to see the error. I still see my data being Garbled and once I saw corrupts in the data I want I see that for nearly 2 sec my data is lost.

    This means that there must be something wrong with the way you are integrating the UART into your application.

    So If my Slave is sending 100 Data every 1 sec so I loose 200 data after each data corrupt.

    There isn't anything in the UART driver that would cause something like this. I would need to see your application code to understand more about your problem.

    BR,
    Andres