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.

TDA2SX: Why can't I use a specific UART baud rate on TDA2SX?

Part Number: TDA2SX

SDK : PROCESSOR_SDK_VISION_03_05_00_00 

Config : tda2xx_evm_bios_all

SOC : TDA2SX

OS : Windows7

Hi, 

In my test, I need to add some specific baud rate for my application of UART RX, then I successfully added the non-preset baud rate, as shown below.

I have modified the following 6 files in total.

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\bsp_uart.h

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\src\bspdrv_uart.c

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\unit_test\uartUt\testInput\st_uartConfig.h

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\unit_test\uartUt\testLib\st_uart.h

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\unit_test\uartUt\testLib\st_uartCommon.c

ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\unit_test\uartUt\testLib\st_uartParser.c

Let’s not talk about the changes. Anyway, I’m pretty sure that 230400 bps can be use after my changes.

But I can't use the 921600 bps and 3000000 bps, I’m pretty sure that the TX side on the PC supports 3000000 bps.

Then I saw the table on TRM.

What does that 16X 13X represent? 

How do I know which category I am? 

Does this mean that if I want to use 921600 bps, I must switch to 13X? 

How do I switch?

If I can use 230400 bps, does that mean I am 16X? Then why can't I use 3000000 bps?

I'm sorry I asked so many questions at once, but I really need these answers.

Please help me solve these problems, Thanks.

  • Hi, 

    Supplement, my UART initialization function comes from System_uartInit() in vision_sdk\links_fw\src\rtos\utils_common\src\utils_uart.c.

    Slightly modified as shown below.

    static void PSVT_MMWRadarUART_Init(void)
    {
        Uart_ChanParams vChanParams;
        Error_Block vEB;
        GIO_Params vIO_Params;
        static char vUART_Name[16]; //Device name must be global or static variable
        static DEV_Struct vUART_DevObj;
        static GIO_Struct vUART_TX_Obj;
        static GIO_Struct vUART_RX_Obj;
        static SyncSem_Struct vUART_TX_SyncSemObj;
        static SyncSem_Struct vUART_RX_SyncSemObj;
        static Semaphore_Struct vUART_TX_SemObj;
        static Semaphore_Struct vUART_RX_SemObj;
        static IOM_Packet vUART_TX_IOM_Obj[UART_ASYNC_IOM_PACKET_MAX];
        static IOM_Packet vUART_RX_IOM_Obj[UART_ASYNC_IOM_PACKET_MAX];
        DEV_Params vDevParams;
        Uart_Params vUART_Params;
        SyncSem_Params vSyncSemParams;
        Semaphore_Params vSemParams;
    
        UInt32 vCookie = 0;
    
        //Enable UART module
        PMHALModuleModeSet(MMWRADAR_UART_MODULE, PMHAL_PRCM_MODULE_MODE_ENABLED,
                           PM_TIMEOUT_INFINITE);
    
        //Disable interrupt
        vCookie = BspOsal_disableInterrupt();
    
        //Connect IRQ and UART interrupt
        BspOsal_irqXbarConnect(MMWRADAR_UART_USE_XBAR_IPU, MMWRADAR_UART_USE_XBAR_INT);
        //Restore interrutp
        BspOsal_restoreInterrupt(vCookie);
    
        //Struct init
        Error_init(&vEB);
    
        //Initialize channel attributes.
        GIO_Params_init(&vIO_Params);
    
        //Do not do it again, because System_uartInit() had already do Uart_init()
        //Uart_init();
    
        //Set an identifying name
        strcpy(vUART_Name, MMWRADAR_UART_NAME);
    
        //Set pin MUX of Radar TX pin
        HW_WR_REG32(MMWRADAR_TX_PIN_PHYSICAL_ADDRESS, UART_OUTPUT_SETTING);
    
        //Set pin MUX of Radar RX pin
        HW_WR_REG32(MMWRADAR_RX_PIN_PHYSICAL_ADDRESS, UART_INPUT_SETTING);
    
        Vps_printf("~~~ PSVT_MMWRadarUART_Init() devId = %d ~~~\n", MMWRADAR_UART_ID);
        vUART_Params = Uart_PARAMS;
        vUART_Params.opMode = UART_OPMODE_INTERRUPT;
        vUART_Params.hwiNumber = 8;
        vUART_Params.rxThreshold = UART_RXTRIGLVL_8;
        vUART_Params.txThreshold = UART_TXTRIGLVL_56;
        vUART_Params.baudRate = MMWRADAR_UART_USE_BAUDRATE;
        vUART_Params.prcmDevId = 0;
    
        if (vUART_Params.opMode == UART_OPMODE_POLLED)
        {
            Vps_printf("~~~ PSVT_MMWRadarUART_Init() Polled mode is selected ~~~\n");
        }
        else if (vUART_Params.opMode == UART_OPMODE_INTERRUPT)
        {
            Vps_printf("~~~ PSVT_MMWRadarUART_Init() Interrupt mode is selected ~~~\n");
        }
    
        vUART_Params.enableCache = (Bool)FALSE;
    
        //Initialise the edma library and get the EDMA handle
        vChanParams.hEdma = NULL;
    
        //If cross bar events are being used then make isCrossBarIntEn = TRUE and choose
        //appropriate interrupt number to be mapped (assign it to intNumToBeMapped)
        vChanParams.crossBarEvtParam.isCrossBarIntEn = (Bool)FALSE;
    
        vChanParams.crossBarEvtParam.intNumToBeMapped = 0xFFU;
    
        vIO_Params.chanParams = (Ptr)&vChanParams;
    
        DEV_Params_init(&vDevParams);
        vDevParams.deviceParams = &vUART_Params;
        vDevParams.initFxn = NULL;
        vDevParams.devid = MMWRADAR_UART_ID;
    
        DEV_construct(&vUART_DevObj, vUART_Name, (Ptr)&Uart_IOMFXNS, &vDevParams, &vEB);
    
        //Radar TX init
        SyncSem_Params_init(&vSyncSemParams);
    
        Semaphore_Params_init(&vSemParams);
    
        vSemParams.mode = Semaphore_Mode_BINARY;
    
        Semaphore_construct(&vUART_TX_SemObj, 0, &vSemParams);
    
        vSyncSemParams.sem = Semaphore_handle(&vUART_TX_SemObj);
    
        SyncSem_construct(&vUART_TX_SyncSemObj, &vSyncSemParams, &vEB);
    
        vIO_Params.sync = SyncSem_Handle_upCast(SyncSem_handle(&vUART_TX_SyncSemObj));
    
        if (vIO_Params.numPackets > UART_ASYNC_IOM_PACKET_MAX)
        {
            UTILS_assert(vIO_Params.numPackets <= UART_ASYNC_IOM_PACKET_MAX);
        }
    
        memset(&vUART_TX_IOM_Obj[0], 0, vIO_Params.numPackets * sizeof(IOM_Packet));
        vIO_Params.packets = &vUART_TX_IOM_Obj[0];
    
        //Create the required channels TX for the Radar
        GIO_construct(&vUART_TX_Obj, vUART_Name, (UInt32)GIO_OUTPUT, &vIO_Params, &vEB);
    
        //Radar RX init
        SyncSem_Params_init(&vSyncSemParams);
    
        Semaphore_Params_init(&vSemParams);
        vSemParams.mode = Semaphore_Mode_BINARY;
    
        Semaphore_construct(&vUART_RX_SemObj, 0, &vSemParams);
    
        vSyncSemParams.sem = Semaphore_handle(&vUART_RX_SemObj);
    
        SyncSem_construct(&vUART_RX_SyncSemObj, &vSyncSemParams, &vEB);
    
        vIO_Params.sync = SyncSem_Handle_upCast(SyncSem_handle(&vUART_RX_SyncSemObj));
    
        memset(&vUART_RX_IOM_Obj[0], 0, vIO_Params.numPackets * sizeof(IOM_Packet));
        vIO_Params.packets = &vUART_RX_IOM_Obj[0];
    
        //Create the required channels RX for the Radar
        GIO_construct(&vUART_RX_Obj, vUART_Name, (UInt32)GIO_INPUT, &vIO_Params, &vEB);
    
        vUART_TX_Handle = GIO_handle(&vUART_TX_Obj);
        vUART_RX_Handle = GIO_handle(&vUART_RX_Obj);
    
        if ((vUART_RX_Handle == NULL) || (vUART_TX_Handle == NULL))
        {
            Vps_printf("~~~ PSVT_MMWRadarUART_Init() GIO_create(%s) failed ~~~\n",
                       vUART_Name);
        }
        else
        {
            vInitDone = (Bool)TRUE;
        }
    
        Vps_printf("~~~ PSVT_MMWRadarUART_Init() Done. ~~~\n");
    }

    Usually I only need to modify vUART_Params.baudRate to change UART baud rate, I tested 4800 bps、9600 bps、115200bps and 230400bps can be change and use.


    Do I only need to modify vUART_Params.baudRate, the system will automatically calculate the appropriate baud multiple and DLH 、DLL for me,

    and I don’t need to set it manually?

  • Hi,

    I will try to implement the same then I will share the all required changes.

    Thanks

    Gaviraju

  • Hi,

    Can you check the below example is working or not for the higher baud-rate?

    ti_components/drivers/pdk_01_10_04_05/packages/ti/csl/example/uart/uart_test

    Thanks

    Gaviraju

  • Hi, 

    our hardware team is confirming the response time of the hardware, maybe the hardware caused the receive error.

    But I still want to know about X16 X13 mode and related settings as I asked before.

    Thanks.

  • Hi, 

    after our inspection, the response time of the hardware affects the higher baudrate UART signal, 

    so we removed part of the NPN that protects the SOC.

    Then I used CSL for testing, the test results are as follows.

    I think it is because the stability function of NPN is lost, the 460800 bps that can be received has become unstable, and ignoring the hardware response time 921600bps is still unable to receive.

    Anyway, my question is still how to receive higher baud rate for my application like as PSVT_MMWRadarUART_Init(), if use current hardware and CSL can receive 460800 bps, why use my application can't receive 460800 bps?

    And is this related to X16 or X13?

  • Greetings,

    What would you like me to call you?

    Regarding your questions, 16x 13x shown in the table are divisors.  TDA2SX TRM Rev G Figure 24-60 shows a Baud Rate Generation diagram (p. 6041) that describes this in more detail.  This divisor selection can be changed via UART_MDR1[2:0] register.

    Yes, you must use 13x to achieve 921.6 kbps (actual would be 923.08 kbps) as well as 460.8 kbps.

    Best Regards,

    Shiou Mei

  • Hi, 

    If i need to changed the via UART_MDR1[2:0] register, in my application PSVT_MMWRadarUART_Init(), when should I make changes?

    Or should it be set at an earlier time?

  • Greetings,

    I have forwarded your question to the SW team.

    Best Regards,

    Shiou Mei

  • Please take a look at uartConfigure() in ~/ti_components/drivers/pdk_xx_xx_xx_xx/packages/ti/drv/bsp_lld/uart/src/bspdrv_uart.c.

    uartHwSetup() is where baud rate is configured.

  • Hi, 

    Should I directly modify the relevant parts of uartConfigure() and uartHwSetup() or modify the macro from

    ti_components\drivers\pdk_01_10_01_06\packages\ti\drv\bsp_lld\uart\bsp_uart.h.

    Can I directly modify the macros of BSP_UART_BAUD_MULTIPLIER and UART_OPER_MODE?

    Or should I modify PLATFORM_ZEBU?

    If I need to modify PLATFORM_ZEBU in which makefile should I modify it? this macro looks like it was automatically generated by the compilation.

    In addition, when I change the mode to X13, does it mean that I will not be able to use Baudrate in X16 mode? like 115200 for debugging, and 4800 and 9600 for other functions.

  • PLATFORM_ZEBU should not be enabled.

    You can change directly BSP_UART_BAUD_MULTIPLIER and UART_OPER_MODE.

    Our UART driver doesn't support both X13 and X16 at the same time. It's compile time option.