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.

RTOS/AM3352: UART test error

Part Number: AM3352

Tool/software: TI-RTOS

Hi all,

I used BBB short connect pin UART1 RX/TX and RTS/CTS. To do the high baud rate test.

Attached is the test project.

It can pass 1843200  3686400 baud rate test. But failed at 460800 and 1500000.

When working at 1500000 If I load the program and click CCS run, failed.

If load program ->click CCS restart->click CCS run, it working well.

Could you please help this? I don't know what does CCS restart doing? And how to fix this? thanks!

BR,
Denny

https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/uart_5F00_test.7z

  • The RTOS team have been notified. They will respond here.
  • Denny,

    A few questions to clarify.

    "If load program ->click CCS restart->click CCS run, it working well."

    - When you say click CCS restart, are you talking about restarting the target configuration, or restarting CCS as a whole?

    - Did you power cycle the board as well?

    - What does System Reset do?

    Lali

  • Lali,

    Let me clarify:
    1, Click CCS restart means click button  under debug mode.

    2, The Board is beagle bone black, it power cycle well. I used CCS default beaglebone black GEL file to do HW initialization.

    3, System reset will reset the board. After system reset, I load program click run  , it also can't work well. But if I click   and then click  , it working well.

    BR,
    Denny

  • Denny,

    1) To reproduce the issue, you shorted P9 Pin 24 &26? What else is needed to reproduce the issue on a BBB?

    2) How did you change the baud rate? By changing line 24 at \uart_test\platform\src\uartstdio.c ?

    3) Are you configuring the baud rate in btstack_uart.c as well?

    4) If that's the case, are both board_init() & btuart_init(); configuring the baud?

    Lali

  • Hi Lali,

    1, yes, you should short connect P9 24---26 AND 20---19.

    2, No, change btstack_uart.c  ine 27 static unsigned int  baudrate = 1500000;  and line66/294  UARTOperatingModeSelect(xxx,UART16x_OPER_MODE/UART13x_OPER_MODE)

    3,yes.

    4,board_init() config uart0, it used to print log. We test uart1, we short connect uart1 for test.

    BR,
    Denny

  • Hi Denny,

    I'm still working on this. I'm not getting anything through UART0 and I think that there is an issue with my board. Working on getting another one.
    What's expected to come out of UART0 when its working "well"?

    Have you tried to take the PDK example pdk_am335x_1_0_9\packages\MyExampleProjects\UART_BasicExample_bbbAM335x_armExampleProject and see if it runs with the higher baud rate?

    Lali
  • Hi Lali,

    If test well, uart0 will print

    Loop 0 test succ!

    Loop 1 test succ!

    Loop 2 test succ!

    Loop 3 test succ!

    ...

    I have tried pdk_am335x_1_0_9\packages\MyExampleProjects\UART_BasicExample_bbbAM335x_armExampleProject, it working well.

    But customer's app is different with this project. it's better to debug base on my project. thanks!

    BR,
    Denny

  • Denny,

    1) How are you seeing the "Loop 0 test succ!" messages?  Is it via UART0, I don't see where in the code you have initialized UART0.

    Or, are you using ROV to view the looped back messages?

    2) I tried to connect a FTDI cable to header J1 and modified the code fro btuart_loop_test() to the below:

    void btuart_loop_test()
    {
        int i;
    
        for (i = 0; i < sizeof(sdata); i++)
        {
            sdata[i] = i;
        }
        rx_cb = btuart_rec_com;
        tx_cb = btuart_send_com;
    
        i = 0;
    
        while (1)
        {
            recmflag = 0;
            sendflag = 0;
            btstack_uart_read(rdata, sizeof(rdata));
            btstack_uart_write(sdata, sizeof(sdata));
    
                    i++;
    
                    //if (i % 1000 == 0)
                    {
                    	LOG_INFO("Loop %d test succ!\n", i);
                    }
                    recmflag = 0;
                    sendflag = 0;
                    memset(rdata, 0x00, sizeof(rdata));
    
        }
    }

    Here is the output on UART1 on the teraterm console BAUD 115200

    Now, obviously this is 1 way traffic where the BBB is sending the messages to UART1 output to the console. Did this work for you?

    3) "line66/294  UARTOperatingModeSelect(xxx,UART16x_OPER_MODE/UART13x_OPER_MODE)"

    What values did you use on line 66/294 when you tested with other baud rates. A table of values you used for the different baud rates would be helpful.

    4) You mentioned that the regular PDK example worked well. What is the difference between what the example does, and what the customer's application does?

    Lali

  • Lali,

    1,   "Loop 0 test succ!"  from uart0 of BBB, You can connect a uart->usb cable to J1 of BBB. The uart0 init code at main()->board_init()->uartstdioint()->console_uart_init()->UARTStdioInitExpClk()

    I'm not used ROV.

    Here is my HW connection, it short connect uart1 rx-tx  rts-cts:

    2, Seem you delete recmflag and sendflag flag test code. Please don't modify the code. Just LOAD PRORAM->RESTART  [->RUN

    you can see the log from uart0

    If you don't restart   directly click run , you will see nothing from uart0. This is the issue what I want you help to debug.

    3, I just follow table 19-6 of TRM.


    4, My code base on customer's app. It used for Bluetooth module communication. The code logic is different with PDK demo.

    PDK demo is a echo demo. My code front thread send the data and the interruption receive the data.

    BR,
    Denny

  • Denny,

    "PDK demo is a echo demo. My code front thread send the data and the interruption receive the data."
    This application note shows how to change the echo demo to output via UART1.
    www.ti.com/.../sprac32a.pdf

    If you make the changes as in the application note to the original PDK eample, and run your test, does it fail in a similar way?

    Please dump the data from rdata and sdata when the failure occurs, and do a comparison to see if you have bad data that's causing the
    while(recmflag == 0 || sendflag == 0); to fail.

    Wondering if its a timing issue of some kind that's causing data corruption with the baud rates that fail.
    Why is the customer making alot of changes to the UART code compared to the PDK RTOS example? Especially the RTOS setup.

    Lali
  • Hi Lali,

    Customer don't use PDK demo, because they use UART to communication with Bluetooth module. Due to communication protocol customer should do the register level program.  The PDK demo based on function level.

    I have tried to make a demo code base on starterware, it worked fine. But if I add RTOS support, this issue happened.

    Also I have dumped the rdata and sdata, it seems the transmit stopped after several words. Sometimes it will lost some data. It different, you can dump it at your side.

    Maybe the issue caused by RTOS setup, I don't know. Could you please work base on my demo and find what's the root cause?

    thanks!

    BR,
    Denny

  • Denny,

    Unfortunately, I'm not in a position to debug the customer's code since its customized and deviated from the PDK example.

    The porting of a Starterware project to TI-RTOS is not the ideal way to go about this, since it becomes difficult to debug.

    My recommendation is to take rtos_template app from the C:\ti\processor_sdk_rtos_am335x_4_03_00_05\demos\rtos_template_app and use that as the base template for your example. Then get it to work on the customer application you are trying to build. The template shows a configuration for a multi-peripheral set-up (especially from a .cfg file setup).

    So, the expectation is for you to debug the customer application with advice and recommendations provided here on the forums.

    "Also I have dumped the rdata and sdata, it seems the transmit stopped after several words."

    Did you try to debug this further by stepping through the code? 

    Lali