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.

TMDSCNCD263: UART Connection Issue with AM2634C and CC2652

Part Number: TMDSCNCD263
Other Parts Discussed in Thread: TMDSHSECDOCK, LP-CC2652RB, SYSCONFIG

Subject: UART Connection Issue with AM2634C and CC2652

Dear Texas Instruments Support,

I am currently working on a project that involves establishing a UART connection between the AM2634C and the CC2652, as well as between the AM2634C and Putty software running on a PC connected to the board via USB.

The AM2634C device I am using is connected to the TMDSHSECDOCK dock station, and I'm also working with an LP-CC2652RB module, which contains a CC2652 chip.

For the AM2634C, I've used the "mcu_plus_sdk_am263x_08_06_00_34" SDK, and for the CC2652, I've utilized the "simplelink_wbms_sdk_2_00_02_23_eng" SDK.

I am encountering some problems when trying to establish a UART connection between the AM2634C and the CC2652. Specifically, I've managed to declare a new UART interface in the sysconfig of the uart echo project (that works perfectly) and chosen available GPIO pins for mapping. For instance, ports L3 and M3 on the Sitara processor are mapped to pins 161 and 162 on the dock.

I modified the UART echo project from the "mcu_plus_sdk_am263x_08_06_00_34" SDK by replacing all instances of UART_CONSOLE with my new UART interface. Then, I connected pins 161 and 162 of the TMDSHSECDOCK with the Rx and Tx pins of the TM4C129, expecting at first for testing to send characters via the TM4C129 and get them back.

However, I'm currently experiencing inconsistent results. Most of the time, I am only able to receive characters from the AM with the TM4C, but not in reverse. On rare occasions, the setup works, but then if I flash the same code again it fails.

I put the protocol of the simpliest demonstration of my problem at the end of my request.

I have tested with an osciloscope and the TM4C129 correctly sends characters via UART (I also tested with a secound TM4C129 and together they exchange information well).

I'm not sure what could be causing this inconsistency, and I would greatly appreciate any guidance or support you could provide to help me troubleshoot this issue.

Thank you for your time and assistance.

Best Regards,

Théo Geairain


Procedure of the UART TEST

I- UART0 test
Create a new workspace.
Import the uart_echo_am263x-cc_r5fss0-0_freertos_ti-arm-clang project from the mcu_plus_sdk_am263x_08_06_00_34.
Flash the device (deselect the M4 processor).
Select the S26A0200 debugger.
Test UART 0.
Open the serial port in a terminal and type characters (8), which are sent via UART 0 to the Sitara. Then they are returned to us and displayed in the serial port terminal.
UART 0 test validated.

Now we change the buffer size of APP_UART_RECEIVE_BUFSIZE to (1U) in uart_echo.c.
We add an infinite loop around the block "{ /* Read 8 chars */ and /* Echo chars entered */}".
Refash the device.
Now it sends back characters to us indefinitely, one by one.

II- Test UART 1.
1) Sitara Tx.
Open the sysconfig.
Add a UART interface.
Rename it to CONFIG_UART1 and set the Rx on L3 and Tx on M3.
Now we duplicate all the UART_write lines, replacing CONFIG_UART_CONSOLE with CONFIG_UART1.
transferOK = UART_write(gUartHandle[CONFIG_UART1], &trans);
Flash the device again.
Next, we cross connect the Rx and Tx pins of the TM4C129 and the Sitara (pin 161 and 162).
Open the serial port of the TM4C129 in a terminal and send characters into the serial port of the Sitara. These are then returned to the TM4C129's serial port.
UART1 Tx test validated.

2) Sitara Rx.
After this, we change the UART_read lines by putting CONFIG_UART1. We thus expect to be able to send the characters in the TM4C129's serial port console and they will be read by the Sitara in UART 1.
When we test, it does not work.
UART1 Rx test not validated.

  • Hi Theo,

    Can you connect the AM263x to a PC emulator (like TaraTerm) and try the UART echo example (with UART1) continuously? If it works, then the issue is not on the AM263x side.

    Best regards,

    Ming

  • Dear Texas Ming Wei,

    Thank you for your prompt response and the proposed troubleshooting step.

    However, I would like to clarify that in my current setup, only UART0 is available via the USB connection. This was already tested and found to work perfectly. As for UART1, it doesn't have a direct USB connection, making the proposed test with TaraTerm or a similar PC emulator challenging to implement.

    One possible solution I could consider is using a UART to USB converter to connect UART1's pins to my PC. However, at the moment, I do not have this kind of converter at hand.

    Looking forward to hearing from you.

    Best Regards,

    Théo

  • Hi Theo,

    Can you use the TMDSHSECDOCK dock station to wire the UART1 to an UART cable then connect the UART cable to a desktop PC with UART connector?

    One more thing, make sure you cross wired the CC2652 UART and the AM263x UART (TX to RX, RX to TX).

    Best regards,

    Ming

  • Dear Support Team,

    Thank you for your suggestion. I want to clarify that I have already performed a similar test using the TM4C129 on the LP-CC2652RB. This module acted as a bridge between the USB and the UART, allowing me to test the UART1 connection on the AM2634C.

    Below I put again the protocol I used:

    I. UART0 Test:
    1. Created a new workspace and imported the uart_echo_am263x-cc_r5fss0-0_freertos_ti-arm-clang project from the mcu_plus_sdk_am263x_08_06_00_34.
    2. Flashed the device (deselecting the M4 processor) using the S26A0200 debugger.
    3. Opened the serial port in a terminal, typed characters which were sent via UART 0 to the Sitara and returned to us, being displayed in the serial port terminal.
    4. Adjusted the buffer size of APP_UART_RECEIVE_BUFSIZE to 1U in uart_echo.c and added an infinite loop around the block "{ /* Read 8 chars */ and /* Echo chars entered */}".
    5. The device was reflashed and now continuously sends back characters one by one.

    II. UART1 Test:
    1. For Sitara Tx:
    - Opened the sysconfig and added a UART interface, renaming it to CONFIG_UART1, and set the Rx on L3 and Tx on M3.
    - Duplicated all the UART_write lines, replacing CONFIG_UART_CONSOLE with CONFIG_UART1.
    - Flashed the device again.
    - Cross-connected the Rx and Tx pins of the TM4C129 and the Sitara (pin 161 and 162).
    - Opened the serial port of the TM4C129 in a terminal and sent characters into the serial port of the Sitara, which were then returned to the TM4C129's serial port.
    2. For Sitara Rx:
    - Changed the UART_read lines by putting CONFIG_UART1 and expected to be able to send the characters in the TM4C129's serial port console to be read by the Sitara in UART 1. However, this did not work.

    From the above protocol, the Tx on the AM2634C was confirmed to be functional, but not the Rx. If one direction (Tx) worked successfully, it assures that the lines were connected correctly (Tx to Rx, and Rx to Tx).

    I hope this information helps clarify the steps I've taken. Please let me know if you have further suggestions or if there are any other tests you recommend.

    Best Regards,

    Théo

  • Hi Theo,

    1. Can you use the default settings for UART1 in the system configure (A9 for RXD and B9 for TXD)?

    2. Did you use the UART_write() with  CONFIG_UART1 to confirm the UART1 TX works?

    3. Is it possible to test the UART1 with two AM263x CC?

    Best regards

    Ming

  • Hello,

    1. The AM2634C's A9 and B9 ports are mapped to pins 76 and 78 on the TMDSHSECDOCK, which are reserved for UART or LIN functionality. By default, these pins are configured for LIN communication. To switch them to UART mode, the multiplexer's 1:2 selection line must be set high. This selection line is controlled by a GPIO signal (LIN_MUX_SEL) coming from the IO expander and communication with the IO expander is accomplished through I2C. I am not sure if I know well how to configure this because I already tried and it never worked. But I already tried with the pins of UART5 for instance and it does work with Tx and not with Rx too.

    2. Indeed, that is what I did.

    3. I could try. If you have a doupt with the TM4C129, I have two of them and when I cross coonnect the Rx Tx pins of each of them they correctly exchange informations. To test with two AM263x I need 2 computers I think because when I connect two of them I can't choose to flash one or another card.

    Best regards

    Théo

  • Hi Theo,

    Can you send me the code for using UART_read() with the calling parameters?

    I looked through the implementation of the UART_read(). It basically read the UART FIFO one character at a time until the number of the characters read matches the number of characters specified in trans.count. If you use the original APP_UART_RECEIVE_BUFSIZE (8), then the UART_read() will not return until the number of characters read reaches 8.

    A quick test you can do is to change the APP_UART_RECEIVE_BUFSIZE to 1.

    Best regards,

    Ming

  • Hello,

    As requested, here is the relevant section of my code where I use the `UART_read()` function:

    /* Read 1 char */
    gNumBytesRead = 0U;
    trans.buf = &gUartReceiveBuffer[0U];
    trans.count = APP_UART_RECEIVE_BUFSIZE;
    transferOK = UART_read(gUartHandle[CONFIG_UART1], &trans);
    APP_UART_ASSERT_ON_FAILURE(transferOK, trans);

    In this section, `APP_UART_RECEIVE_BUFSIZE` is indeed set to 1, as I already mentioned in my test protocol. The definition is as follows:

    #define APP_UART_RECEIVE_BUFSIZE (1U)

    This configuration allows me to read one character at a time. However, despite setting `APP_UART_RECEIVE_BUFSIZE` to 1, UART1 did not operate correctly in my tests, specifically regarding the reception of data (Rx). This occurred only for UART1 tests, because if in the code provided above, I replace CONFIG_UART1 by CONFIG_UART_CONSOLE it works.

    The next lines are 

    /* Echo chars entered */
    gNumBytesWritten = 0U;
    trans.buf = &gUartReceiveBuffer[0U];
    trans.count = APP_UART_RECEIVE_BUFSIZE;
    transferOK = UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);
    transferOK = UART_write(gUartHandle[CONFIG_UART1], &trans);
    APP_UART_ASSERT_ON_FAILURE(transferOK, trans);


    This returns what I input in the UART 0 (I can see it in both the TM4C129 console and the Sitara's one as there are two UART_write), but it doesn't return anything when the input comes from CONFIG_UART1.

    I hope this information will assist in troubleshooting the issue. I look forward to your guidance on next steps.

    Best regards,

    Théo

  • Hi Theo,

    It is hard to explain what is going on there. The TX is working and the RX is not working. For further investigating, I will need to find another AM263x CC and docking station. It will take a few days. Especially the weekend is coming. I will get back to you early next week.

    Best regards,

    Ming

  • Hello Ming,

    Thank you very much for your help,

    I will wait for you to get what  you need.

    Have a nice week-end,

    Best regards

    Théo

  • Hi Theo,

    I have located another AM263x CC with docking station. I will start working on it and get back to you early next week. Have a nice weekend!

    Best regards,

    Ming

  • Hi Theo,

    I did the following test using one AM263x CC with the docking station:

    1. Connect the pin 161 and the 162 (loopback the UART1_TXD to UART1_RXD)

    2. Add the UART1 instance using L3 and M3 in syscfg file

    3. In uart_echo, add code to send 8 characters to UART1, then immediately followed by receiving 8 characters from UART1, then compare the sending buffer and the receiving buffer. Do the same test for 100 time, then print out the statistic on UART0.

    Here is the UART0 display:

    and the Saleae capture of the UART1_RXD and UART_TXD:

    The about result proved the AM263x UART1 is working properly, both TX and RX. One thing I noticed during the test. If I set a break point after the TX and before the RX, then the loop cannot complete. My guess is the receiving interrupt may get lost. If I set the break point after the TX and RX, then it works properly.

    Attached please find my uart_echo.c and example.syscfg files.

    Best regards,

    Ming

    0268.uart_echo.c
    /*
     *  Copyright (C) 2021 Texas Instruments Incorporated
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /* This example demonstrates the UART RX and TX operation by echoing char
     * that it recieves in blocking, interrupt mode of operation.
     * When user types 'quit', the application ends.
     */
    
    #include <string.h>
    #include <kernel/dpl/DebugP.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    
    #include <board/ioexp/ioexp_tca6424.h>
    
    #define APP_UART_BUFSIZE              (200U)
    #define APP_UART_RECEIVE_BUFSIZE      (8U)
    
    uint8_t gUartBuffer[APP_UART_BUFSIZE];
    uint8_t gUartReceiveBuffer[APP_UART_RECEIVE_BUFSIZE];
    volatile uint32_t gNumBytesRead = 0U, gNumBytesWritten = 0U;
    
    uint8_t gUartBuffer1[APP_UART_BUFSIZE];
    uint8_t gUartReceiveBuffer1[APP_UART_RECEIVE_BUFSIZE];
    volatile uint32_t gNumBytesRead1 = 0U, gNumBytesWritten1 = 0U;
    
    #define APP_UART_ASSERT_ON_FAILURE(transferOK, transaction) \
        do { \
            if((SystemP_SUCCESS != (transferOK)) || (UART_TRANSFER_STATUS_SUCCESS != transaction.status)) \
            { \
                DebugP_assert(FALSE); /* UART TX/RX failed!! */ \
            } \
        } while(0) \
    
    int loopCnt = 0;
    int mismatchCnt = 0;
    void uart_echo(void *args)
    {
        int32_t          transferOK;
        UART_Transaction trans;
        int32_t          transferOK1;
        UART_Transaction trans1;
    
        Drivers_open();
        Board_driversOpen();
    
        DebugP_log("[UART] Echo example started ...\r\n");
    
        UART_Transaction_init(&trans);
        UART_Transaction_init(&trans1);
    
        /* Send entry string */
        gNumBytesWritten = 0U;
        trans.buf   = &gUartBuffer[0U];
        strncpy(trans.buf,"This is uart echo test blocking mode\r\nReceives 8 characters then echo's back. Please input..\r\n", APP_UART_BUFSIZE);
        trans.count = strlen(trans.buf);
        transferOK = UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);
        APP_UART_ASSERT_ON_FAILURE(transferOK, trans);
    
    for (int j=0; j<100; j++)
    {
        /* send 8 chars to UART1 */
        memset(gUartBuffer, 0x5A, APP_UART_RECEIVE_BUFSIZE);
        gNumBytesWritten = 0U;
        trans1.buf   = &gUartBuffer[0U];
        trans1.count = APP_UART_RECEIVE_BUFSIZE;
        transferOK1 = UART_write(gUartHandle[CONFIG_UART1], &trans1);
        APP_UART_ASSERT_ON_FAILURE(transferOK1, trans1);
    
        /* Read 8 chars from UART1 */
        memset(gUartReceiveBuffer1, 0x00, APP_UART_RECEIVE_BUFSIZE);
        gNumBytesRead1 = 0U;
        trans1.buf   = &gUartReceiveBuffer1[0U];
        trans1.count = APP_UART_RECEIVE_BUFSIZE;
        transferOK1 = UART_read(gUartHandle[CONFIG_UART1], &trans1);
        APP_UART_ASSERT_ON_FAILURE(transferOK1, trans1);
    
        for (int i=0; i<APP_UART_RECEIVE_BUFSIZE; i++)
        {
            if (gUartBuffer[i]!=gUartReceiveBuffer1[i])
                mismatchCnt++;
        }
        loopCnt++;
    }
    
        /* Send entry string */
        gNumBytesWritten = 0U;
        trans.buf   = &gUartBuffer[0U];
        sprintf(trans.buf,"UART1 Sending and Receiving %d Times with %d mismatch\r\n", loopCnt, mismatchCnt);
        trans.count = strlen(trans.buf);
        transferOK = UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);
        APP_UART_ASSERT_ON_FAILURE(transferOK, trans);
    
        /* Read 8 chars from UART0 */
        gNumBytesRead = 0U;
        trans.buf   = &gUartReceiveBuffer[0U];
        trans.count = APP_UART_RECEIVE_BUFSIZE;
        transferOK = UART_read(gUartHandle[CONFIG_UART_CONSOLE], &trans);
        APP_UART_ASSERT_ON_FAILURE(transferOK, trans);
    
        /* Echo chars entered to UART0 */
        gNumBytesWritten = 0U;
        trans.buf   = &gUartReceiveBuffer[0U];
        trans.count = APP_UART_RECEIVE_BUFSIZE;
        transferOK = UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);
        APP_UART_ASSERT_ON_FAILURE(transferOK, trans);
    
        /* Send exit string */
        gNumBytesWritten = 0U;
        trans.buf   = &gUartBuffer[0U];
        strncpy(trans.buf, "\r\nAll tests have passed!!\r\n", APP_UART_BUFSIZE);
        trans.count = strlen(trans.buf);
        transferOK = UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);
        APP_UART_ASSERT_ON_FAILURE(transferOK, trans);
    
        DebugP_log("All tests have passed!!\r\n");
    
        Board_driversClose();
        Drivers_close();
    
        return;
    }
    

    6354.example.syscfg

  • Hello,

    Thank you for your detailed instructions. I replicated your test by using the same AM263x CC with the docking station and the test results were consistent with yours. When I connected Rx and Tx, I could read in Rx what I sent in Tx. However, I noticed that in your sysconfig file, you added an i2c instance. Could you explain why you chose to do this?

    Despite these positive results, the UART1 still doesn't operate correctly when receiving data from the TM4C129. I am unable to read in the Rx of UART1 what I sent from the TM4C129. 

    Best regards,

    Théo

  • Hi Theo,

    The I2C instance was added for my experiment on the IO-expander. It turns out not necessary for the final test. You remove it.

    As of the UART from TM4C129, can you check the signal voltage? The UART1_RXD/UART1_TXD for AM263x is 3.3V. Any mismatching on the signal voltage may cause problem.

    Best regards,

    Ming

  • Hi Theo,

    I also did the two AM263x CC connected together with Pin 161 and 162 (cross connected). It does not work initially.

    After I connect the GND of two AM263x CC together, then the test passed everytime.

    Can you try to connect the GND of AM263x CC and the TM4C129 LP and try the test again?

    Best regards,

    Ming

  • Hi Ming 

    You are absolutely right ! It works when both GND are connected ! It even worrks when I connect the CC2662 to the Sitara (with both GND connected)

    However now when I flash a code on the Sitara it does this error :

    The code is still televersed on the Sitara and executed so I don't understand why there is this error.

    Thank you so much for your help !

    Best regards,

    Théo

  • Hi Theo,

    There are basically two application execution modes in AM263x: load and running application using CCS + JTAG and boot from QSPI flash (SBL_QSPI+ appImage). It sounds like you are running the application from QSPI flash now, but the error is from CCS when you try to connect to the target.

    In general, you will use one of the above two modes (not both modes at the same time). The first mode is commonly used for application code development and debugging. The second mode is commonly used for production.

    The first mode usually combined with one of the two methods to initialize the SoC: flash the SBL_NULL into QSPI flash then use the QSPI boot mode OR use the DEV boot mode along with the GEL file.

    Best regards,

    Ming