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.

AM3358: UART example questions

Part Number: AM3358
Other Parts Discussed in Thread: AM3359

UART_BasicExample_bbbAM335x_armTestProject:

line 2290 uart = UART_open(uartTestInstance, &uartParams); failed. Here uartTestInstance is 0! if I change uartTestInstance to 1 before UART_open, line 2290 uart = UART_open(uartTestInstance, &uartParams); success. can you explain why. Where does UART_write to go? I can see UART_putc but not UART_write. Thanks

  • Anping,

    I don't see UART_open() on line 2290 of uart_main_test.c. What version of PRSDK are you using?

    I can't explain why UART_open(uartTestInstance, &uartParams) fails with uartTestInstance set to 0. This is the default setting for the test case, and our test results for PRSDK 6.0.0.7 show this test passing on BBB.

    Does the failure occur with the OOB test, or does the failure occur in your own application code? Are you trying to open an instance which has already been opened, e.g.:

    UART_stdioInit(uartTestInstance);
    uart = UART_open(uartTestInstance, &uartParams);

    UART_putc() is part of the UART stdio API. This API is initialized using UART_stdioInit() and UART_stdioInit2(). If you inspect these functions in UART_stdio.c, you'll notice they use a global handle which is defined locally in the file:

    UART_Stdio_Object uart_stdio = {NULL, NULL}

    If you inspect UART_putc(), you'll notice it calls UART_write() using this local handle.

    UART_write() goes to the UART IP associated with the UART handle returned by UART_open().

    Which UART are you connected to physically?

    Thanks,
    Frank

  • pdk_am335x_1_0_15

  • Strange, that's what I'm using and this is what I see at line 2290:

    2290:    /* Print test description */

     

  • void UART_test_print_test_desc(UART_Tests *test)<--2276 line

    {

    UART_Handle uart = NULL;

    UART_Params uartParams;

    char testIdPrompt[16] = "\r\n UART UT ";

    char crPrompt[16] = "\r\n";

    char testId[16] = {0, };

    /* UART SoC init configuration */

    UART_initConfig(false);

    /* Initialize the default configuration params. */

    UART_Params_init(&uartParams);

    uartParams.parityType = uartParity;

    uart = UART_open(uartTestInstance, &uartParams);<--2290 line

    if (uart == NULL)

    {

    System_printf("UART did not open");

    }

    /* Print unit test ID */

    sprintf(testId, "%d", test->testId);

    UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));

    UART_write(uart, (void *)(uintptr_t)testIdPrompt, sizeof(testIdPrompt));

    UART_write(uart, (void *)(uintptr_t)testId, sizeof(testId));

    UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));

    /* Print test description */

    UART_write(uart, (void *)(uintptr_t)test->testDesc, sizeof(test->testDesc));

    UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));

    UART_close(uart);

    }<--2307line

  • Anping,

    Thanks for sharing the information. It seems we have some discrepancy between our main_uart_test.c file. Please see below my grep results from pdk_am335x_1_0_15/packages/ti/drv:

    $ grep -rI -n -i --regexp="UART_test_print_test_desc" --include "*.c"
    uart/test/firmware_test/src/main_uart_test.c:4686:void UART_test_print_test_desc(uint32_t uartInstance, UART_Tests *test)
    uart/test/firmware_test/src/main_uart_test.c:4784: UART_test_print_test_desc(testOutUartInstance, &Uart_tests[i]);
    uart/test/src/main_uart_test.c:2267:void UART_test_print_test_desc(UART_Tests *test)
    uart/test/src/main_uart_test.c:2383: UART_test_print_test_desc(&Uart_tests[i]);

    I'm attaching the file version I have for your inspection.

    Does the example fail out of box without any modification?

    Thanks and regards,
    Frank

    6837.main_uart_test.c

  • Hi Frank

        UART_BasicExample_bbbAM335x_armTestProject has "Task_create return NULL". I have changed stacksize to solve the issue. Then UART_open return NULL with uartTestInstance = 0! But if I have changed uartTestInstance to 1, UART_open doesn't return NULL. I don't know why. Thanks

  • Anping,

    Ok, so PRSDK 6.0.0.7 UART_BasicExample_bbbAM335x_armTestProject doesn't work on BBB for you without any modification. I'll test whether I get the same behavior on a BBB, but I won't be able to pursue this until next week sometime. Your patience is appreciated.

    Regards,
    Frank

  • Anping,

    Can you please download PRSDK 6.1.0.8 and see if it fixes any of the problems you've encountered?

    Regards,
    Frank

    http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/latest/index_FDS.html

  • Anping,

    Please try UART_BasicExample_bbbAM335x_armTestProject with PRSDK 6.1.0.8. According to the developer the Task_create() issue has been fixed. I also see this test is passing in our regression test log.

    Regards,
    Frank

  • Anping,

    I was able to acquire my BBB board today so I could take a closer look at this issue.

    For PRSDK 6.1.0.8, I noticed UART_BasicExample_bbbAM335x_armTestProject doesn't provide DMA support, so I created the necessary files in the same manner as CSPI_SlaveMode_MasterExample_bbbAM335x_armExampleProject: 

    https://e2e.ti.com/support/processors/f/791/p/851148/3147822#3147822

    I increased the default heap size to 48 kB in am335x_app_bbbam335x.cfg:

    /*
    * The BIOS module will create the default heap for the system.
    * Specify the size of this default heap.
    */
    BIOS.heapSize = 0xC000;

     

    This was required since Task_create() fails in the second call to UART_test_simultaneous_rw() without a larger heap. Another way to handle this is to delete the dynamically created task at the end of UART_test_simultaneous_rw() like so:

        Task_Handle      writeTask = NULL;

    ... // intervening code

        Err:
        if (uart)
        {
            UART_close(uart);
        }
        if (writeTask)
        {
            Task_delete(writeTask);
        }

    return (ret);

     

    The files are attached below. I think the MMU settings are properly handled this time.

    Please let me know if this resolves the issue.

    Regards,
    Frank

     

    4278.am335x_app_bbbam335x.cfg

    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/soc/am335x/UART_soc.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/test/src/main_uart_test.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/soc/am335x/sample_am335x_arm_int_reg.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/soc/am335x/sample_am335x_cfg.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/soc/am335x/sample_arm_cs.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/soc/am335x/sample_arm_init.c"
    -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/uart/test/am335x/armv7/bios/am335x_app_bbbam335x.cfg"
    -ccs.setCompilerOptions "-c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard  -DSOC_AM335X -DbbbAM335x -DBUILDCFG_MOD_UART -DUART_DMA_ENABLE -g -gstrict-dwarf -gdwarf-3 -finstrument-functions -Wall -MMD -MP -I${PDK_INSTALL_PATH}/ti/drv/uart -I${PDK_INSTALL_PATH} -I${EDMA3LLD_BIOS6_INSTALLDIR}/packages "  -rtsc.enableRtsc
    -ccs.setLinkerOptions " -lgcc -lrdimon -lm -lnosys -nostartfiles -static -Wl,--gc-sections "
    
    

  • Hi Frank

         It is line 2290

    uart = UART_open(uartTestInstance, &uartParams);

    failed( in void UART_test_print_test_desc(UART_Tests *test)).

    Here uartTestInstance is 0. If I set uartTestInstance to 1, It works! why? If I step into, it let me locate function. I have trouble to locate it. What rule should I follow? Thanks

  • Anping,

    I'm using AM335x PRSDK 6.1.0.8 & CCS 9.1.0. These can be downloaded here: http://software-dl.ti.com/processor-sdk-rtos/esd/AM335X/latest/index_FDS.html.

    I'm using Shared Device Support 1.1.3 & Sitara Device Support 1.4.7.

    I'm working on a Windows 10 Host PC.

    I place the files I provided to you above here: <PRSDK install dir>\pdk_am335x_1_0_16\packages\ti\drv\uart\test\am335x\armv7\bios

    • am335x_app_bbbam335x.cfg : backup existing file to am335x_app_bbbam335x_org.cfg if desired
    • UART_BasicExample_bbbAM335x_armTestProject.txt : backup existing file to UART_BasicExample_bbbAM335x_armTestProject_org.txt if desired

    I create the UART projects as below from a DOS prompt:

    cd <PRSDK install folder>\pdk_am335x_1_0_16\packages
    pdkProjectCreate.bat AM335x bbbAM335x little uart all arm 

    The project UART_BasicExample_bbbAM335x_armTestProject is created here: <PRSDK install folder>\pdk_am335x_1_0_16\packages\MyExampleProjects

    This project uses the files linked in the UART_BasicExample_bbbAM335x_armTestProject.txt file. The files are:

    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/soc/am335x/UART_soc.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/test/src/main_uart_test.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/soc/am335x/sample_am335x_arm_int_reg.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/soc/am335x/sample_am335x_cfg.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/soc/am335x/sample_arm_cs.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/soc/am335x/sample_arm_init.c"
    <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/test/am335x/armv7/bios/am335x_app_bbbam335x.cfg"

    Note the main source code for the test is located in <PRSDK install folder/pdk_am335x_1_0_16/ti/drv/uart/test/src/main_uart_test.c". I don't see UART_open() on Line 2290 of this file.

    To run the test, I follow these steps:

    • Launch CCS.
    • Launch BBB target. Please let me know if you need instructions on creating this target. I'm using an XDS200 external emulator.
    • Select CortexA8 core.
    • Click Run->Reset->System Reset and immediately click "Connect Target". The On Target connect GEL script executes. Please see "gel_log.txt" for GEL output.
    • Load program to CortexA8, Run->Load->Load Program, Browse Project, UART_BasicExample_bbbAM335x_armTestProject->Debug->UART_BasicExample_bbbAM335x_armTestProject.out.
    • Run TeraTerm, connect to USB UART port, 115200,8,None,1,None.
    • Execute program.

    I don't observe any failures with UART_open() with the default UART instance of 0. Please see my UART log below.

    I've attached my .out file. Can you please see if this executes properly for you?

    Thanks and regards,
    Frank

    CortxA8: Output: ****  AM335x BeagleBlack Initialization is in progress .......... 
    CortxA8: Output: ****  AM335x ALL PLL Config for OPP == OPP100 is in progress ......... 
    CortxA8: Output: Input Clock Read from SYSBOOT[15:14]:  24MHz
    CortxA8: Output: ****  Going to Bypass... 
    CortxA8: Output: ****  Bypassed, changing values... 
    CortxA8: Output: ****  Locking ARM PLL
    CortxA8: Output: ****  Core Bypassed
    CortxA8: Output: ****  Now locking Core...
    CortxA8: Output: ****  Core locked
    CortxA8: Output: ****  DDR DPLL Bypassed
    CortxA8: Output: ****  DDR DPLL Locked
    CortxA8: Output: ****  PER DPLL Bypassed
    CortxA8: Output: ****  PER DPLL Locked
    CortxA8: Output: ****  DISP PLL Config is in progress .......... 
    CortxA8: Output: ****  DISP PLL Config is DONE .......... 
    CortxA8: Output: ****  AM335x ALL ADPLL Config for OPP == OPP100 is Done ......... 
    CortxA8: Output: ****  AM335x DDR3 EMIF and PHY configuration is in progress......... 
    CortxA8: Output: EMIF PRCM is in progress ....... 
    CortxA8: Output: EMIF PRCM Done 
    CortxA8: Output: DDR PHY Configuration in progress 
    CortxA8: Output: Waiting for VTP Ready ....... 
    CortxA8: Output: VTP is Ready! 
    CortxA8: Output: DDR PHY CMD0 Register configuration is in progress ....... 
    CortxA8: Output: DDR PHY CMD1 Register configuration is in progress ....... 
    CortxA8: Output: DDR PHY CMD2 Register configuration is in progress ....... 
    CortxA8: Output: DDR PHY DATA0 Register configuration is in progress ....... 
    CortxA8: Output: DDR PHY DATA1 Register configuration is in progress ....... 
    CortxA8: Output: Setting IO control registers....... 
    CortxA8: Output: EMIF Timing register configuration is in progress ....... 
    CortxA8: Output: EMIF Timing register configuration is done ....... 
    CortxA8: Output: PHY is READY!!
    CortxA8: Output: DDR PHY Configuration done 
    CortxA8: Output: ****  AM335x BeagleBlack Initialization is Done ****************** 
    

    
     UART UT 0
    
     UART DMA read write test in block mode
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
    
     UART UT 0 PASSED
    
    
     UART UT 1
    
     UART non-DMA read write test in block mode
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
    
     UART UT 1 PASSED
    
    
     UART UT 2
    
     UART DMA read write test in callback mode
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
    
     UART UT 2 PASSED
    
    
     UART UT 3
    
     UART non-DMA read write test in callback mode
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
    
     UART UT 3 PASSED
    
    
     UART UT 4
    
     UART DMA timeout test, wait for 10 seconds to timeout read
    
     Read timed out
    
    
     UART UT 4 PASSED
    
    
     UART UT 5
    
     UART non-DMA timeout test, wait for 10 seconds to timeout read
    
     Read timed out
    
    
     UART UT 5 PASSED
    
    
     UART UT 6
    
     UART DMA RX error test, enter a break
    
    
     UART UT 6 PASSED
    
    
     UART UT 7
    
     UART non-DMA RX error test, enter a break
    
    
     UART UT 7 PASSED
    
    
     UART UT 8
    
     UART DMA read write cancel test, enter less than 16 chars
    
     Previous read canceled
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
     Previous write canceled
    
    
    
     UART UT 8 PASSED
    
    
     UART UT 9
    
     UART non-DMA read write cancel test, enter less than 16 chars
    
     Previous read canceled
    
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
     Previous write canceled
    
    
    
     UART UT 9 PASSED
    
    
     UART UT 10
    
     UART DMA simultaneous read write test
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
    
     UART UT 10 PASSED
    
    
     UART UT 11
    
     UART non-DMA simultaneous read write test
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     enter the data of 16 character
    
     Data entered is as follows
    1234567890123456
    
     UART UT 11 PASSED
    
    
     UART UT 12
    
     UART DMA TX/RX FIFO trigger level test
    
    
     UART UT 12 PASSED
    
    
     UART UT 13
    
     UART stdio printf and scanf test
    
     enter the data of 16 character and press ENTER
    asdfghjklasdfghj
    
    
     UART UT 13 PASSED
    
    
     UART UT 14
    
     UART non-DMA TX/RX FIFO trigger level test
    
    
     UART UT 14 PASSED
    
    
     UART UT 15
    
     UART polling timeout test, wait for 10 seconds to timeout read
    
     Read timed out
    
     enter the data of 16 character
    
     Data entered is as follows
    asdfghjklasdfghj
    
     UART UT 15 PASSED
    
    
     UART UT 16
    
     UART stdio printf and scanf test with STDIO params(Default)
    
     enter the data of 16 character and press ENTER
    asdfghjklasdfghj
    
    
     UART UT 16 PASSED
    
    
     UART UT 17
    
     UART read write test with interrupt disabled
    
     enter the data of 16 character
    
     Data entered is as follows
    asdfghjklasdfghj
     enter the data of 16 character
    
     Data entered is as follows
    0987654321098765
    
     UART UT 17 PASSED
    
    
     UART UT 18
    
     UART non-DMA read API test in loopback mode
    
    
     UART UT 18 PASSED
    
    
     UART UT 19
    
     UART DMA multiple instances loopback test
    
    
     UART UT 19 PASSED
    
     All tests have passed.
    
    

    UART_BasicExample_bbbAM335x_armTestProject.zip

  • C:\ti\pdk_am335x_1_0_16\packages>pdkProjectCreate.bat AM335x bbbAM335x little uart all arm
    =========================================================================
    Configuration:
       SOC             :   AM335x
       BOARD           :   bbbAM335x
       ENDIAN          :   little
       MODULE          :   uart
       PROJECT_TYPE    :   all
       PROCESSOR       :   arm
       PDK_SHORT_NAME  :   C:\ti\PDK_AM~3\packages\
    =========================================================================
    Checking Configuration...
    Complete
    =========================================================================
       PDK_PARTNO         : AM335
       PDK_ECLIPSE_ID     : com.ti.pdk.am335x
       RTSC_PLATFORM_NAME : ti.platforms.evmAM3359
       RTSC_TARGET        : gnu.targets.arm.A8F
       CCS_DEVICE         : "Cortex A.AM3359.ICE_AM3359"
    *****************************************************************************
    Detecting all projects in PDK and importing them in the workspace C:\ti\PDK_AM~3\packages\\MyExampleProjects
    Detected Test Project: UART_FwExample_bbbAM335x_armExampleProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
            0 file(s) copied.
    Detected Test Project: UART_BasicExample_bbbAM335x_armExampleProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
            0 file(s) copied.
    Detected Test Project: UART_BasicExample_bbbAM335x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
            0 file(s) copied.
    Detected Test Project: UART_FwTestExtLb_bbbAM335x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
            0 file(s) copied.
    Detected Test Project: UART_FwTest_bbbAM335x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
            0 file(s) copied.
    Project generation complete
    *****************************************************************************

    What am I missing? Thanks

  • Anping,

    Can you check CCS_INSTALL_PATH in pdkProjectCreate.bat?

    Regards,
    Frank

  • Hi Frank

        UART_open don't return NULL. Thanks

  • Anping,

    Excellent, I'm very glad to hear it. I'll create a JIRA ticket internally to track this issue and merge the fix for a future release of PRSDK.

    Regards,
    Frank