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/TDA2EXEVM: enabling custom UART from sysBIOS RTOS in tda2xx

Part Number: TDA2EXEVM

Tool/software: TI-RTOS

Hi all,

I am currently using JACINTO 6 evk  board.We will be working with the c ustom board ,where UART3 is been used for read/write from sysbios (RTOS) . I  know that uart0 is enabled by default (which is  used for usb mini port for debugging), so I am able to work with uart0 from use cases(path:/PROCESSOR_SDK_VISION_03_02_00_00/vision_sdk/apps/src/rtos/usecases)  in vision sdk3.0 . Can you please help me out in bringing uart3 up from RTOS. The pin details are given below.

D27 - uart2_ctsn/uart3-rxd

C28-uart2_rtsn

Thanks in advance.

bhagyam

  • Hi,

    I have forwarded your question to an expert for comment.

    Regards,
    Yordan
  • Kindly change the UART1 pinmux setting in function Bsp_platformTda2xxSetPinMux() in file ti_components/drivers/pdk_<VERSION>/packages/ti/drv/vps/src/platforms/src/bsp_platformTda2xx.c to UART3 as per the pin you have selected.

    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART3_TXD,
    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_OUT |
    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_ENABLE |
    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_UP);
    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART3_RXD,
    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_BI |
    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_DISABLE |
    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_DOWN);

    Once this is done, change the UART driver create in VSDK to point to UART3.
    In file vision_sdk\links_fw\src\rtos\utils_common\src\utils_uart.c in fxn System_uartInit()
  • I have updated the PDK FAQ wiki page with this info processors.wiki.ti.com/.../PDK_FAQ
  • Hi Siva,
    Thank you so much for your quick reply. I want to add new UART in my custom board (without disturbing default uart1) where the pins

    D27 - uart2_ctsn(signal name) ---> muxmode 2.

    C28 - uart2_rtsn(signal name)----->muxmode 1.

    So I have added the following code in function Bsp_platformTda2xxSetPinMux()

    /* UART1 mux */
    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART1_RXD,
    BSP_PLATFORM_IOPAD_CFG_DEFAULT);
    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART1_TXD,
    BSP_PLATFORM_IOPAD_CFG_DEFAULT);
    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART1_CTSN,
    BSP_PLATFORM_IOPAD_CFG_DEFAULT);
    Bsp_platformSetPinmuxRegs((UInt32) 0, (UInt32) CTRL_CORE_PAD_UART1_RTSN,
    BSP_PLATFORM_IOPAD_CFG_DEFAULT);
    /*UART3 mux*/
    Bsp_platformSetPinmuxRegs((UInt32) 1, (UInt32) CTRL_CORE_PAD_UART2_RTSN, /* uart3-txd*/
    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_OUT |
    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_ENABLE |
    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_UP);
    Bsp_platformSetPinmuxRegs((UInt32) 2, (UInt32) CTRL_CORE_PAD_UART2_CTSN, /*uart3-rxd*/
    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_BI |
    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_DISABLE |
    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_DOWN);

    ---
    ----
    ----




    How I can use both the i.e UART1 and UART3( which has different muxmodes for rx and TX)
    .
    I would like to know the changes needs to be done in file <path_to_vsdk>/vision_sdk\links_fw\src\rtos\utils_common\src\utils_uart.c ?
    should i have to write a separate uart driver /APIs for another uart ? Can you please help me with UART example code for read/write from external device


    Thanks and regards
    bhagyaraja
  • Since pins used for UART1 and UART3 are different, they can coexist without any issue.
    From VSDK, if you want to use both the UARTs you need to instantiate both the UART instance in the file I mentioned.
    But note that the API's are written in such a way that only one instance can be used - because the UART read/write API doesn't take UART instance ID.
    So the simpler solution is to copy-paste the utils_uart.c to utils_uart3.c, modify the global variables and API to have "3" suffix and then call the corresponding API from your application. While doing that you need to modify vision_sdk\links_fw\src\rtos\utils_common\src\SRC_FILES.MK to include uart3.c file
    SRCS_$(IPU_PRIMARY_CORE) += utils_execp_trace_local_m4.c utils_uart.c utils_uart3.c \

    After this call System_uartInit3(), Utils_uartCreateDevice3() and Utils_uartDeleteDevice3() API from whereever the UART1 API's are called.

    I suggest you first change the existing file for UART3 and verify it works fine. Then the above change can be done and tested for simultaneous UART1/3 support
  • HI siva,
    Thanks for yor reply. I am using "MAKECONFIG?=tda2xx_evm_linux_all" in rules.make file, and i am using hlos folder not rtos alone. I could not find any uart driver example code in this. And in this configuration changing "ti_components/drivers/pdk_<VERSION>/packages/ti/drv/vps/src/platforms/src/bsp_platformTda2xx.c" file will configure my custom UART??? Please help me out.
  • Hi

    For tda2xx_evm_linux_all configuration, all peripherals including UART is controlled by "Linux" running on A15.  Only certain video drivers are used from PDK.

    Can you please let me know what you try to modify in VSDK Linux or what feature you trying to add ?

    regards, Shiju

     

  • Hi Siva,
    >Siva: Can you please let me know what you try to modify in VSDK Linux or what feature you trying to add ?
    bhagyam: we need to receive data from UART2_CTSN/UART2_RTSN pins (muxed as UART3) from M4 and will be processed for display. For that I am using" MAKECONFIG?=tda2xx_evm_bios_all" . for this I used VSDK and I have followed the your suggestions . I changed "ti_components/drivers/pdk_<VERSION>/packages/ti/drv/vps/src/platforms/src/bsp_platformTda2xx.c"file and I added a new "my_usecase" and wrote a simple .c file to read and write. but still I couldnt read /write. So I am trying with " MAKECONFIG?=tda2xx_evm_linux_all".

    I want to enable UART2/UART3 along with default UART and need to access (r/w) from M4 core .



    >Siva: For tda2xx_evm_linux_all configuration, all peripherals including UART is controlled by "Linux" running on A15
    >bhagyam: Correct. So we need to configure UART3 from /arch/arm/boot/dts/dra7xx-evm.dts file . Am i Correct?
  • Hi bhagyam
    Thanks for the details.
    I do not prefer tda2xx_evm_linux_all configuration in your case as data capture via UART is not validated in this configuration.
    use tda2xx_evm_bios_all configuration, we do have a UC where we read ultra sonic senor connected with UART and UART reads data from these sensors
    refer UC: \vision_sdk\apps\src\rtos\usecases\lvds_vip_sv_analytics_us
    ignore all SRV portions.
    To enable ultrasonic capture, you need to enable
    ULTRASONIC_INCLUDE=yes
    in \vision_sdk\apps\configs\tda2xx_evm_bios_all\cfg.mk

    regards, Shiju
  • Hi Shiju,

    Thanks for the update. I will use  "tda2xx_evm_bios_all" .

    We have a custom board. we need to do this UART read from

    D27 - uart2_ctsn(signal name)- muxmode 2.

    C28 - uart2_rtsn(signal name)-muxmode 1 pins.

     I have done the following changes in "ti_components/drivers/pdk_<VERSION>/packages/ti/drv/vps/src/platforms/src/bsp_platformTda2xx.c "

    /*UART3 mux*/

    Bsp_platformSetPinmuxRegs((UInt32) 1, (UInt32) CTRL_CORE_PAD_UART2_RTSN, /* uart3-txd*/

    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_OUT |

    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_ENABLE |

    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_UP);

    Bsp_platformSetPinmuxRegs((UInt32) 2, (UInt32) CTRL_CORE_PAD_UART2_CTSN, /*uart3-rxd*/

    BSP_PLATFORM_IOPAD_CFG_INPUTENABLE_BI |

    BSP_PLATFORM_IOPAD_CFG_PULLUDENABLE_DISABLE |

    BSP_PLATFORM_IOPAD_CFG_PULLTYPESELECT_DOWN);

    and compiled using  "make -s all BOARD=tda2xx-evm CORE=ipu1_0" from the path  "<home> /PROCESSOR_SDK_VISION_03_02_00_00/ti_components/drivers/pdk_01_08_01_06/packages/ti/build".my_usecase_rtos.tar.gz

    Then I copied utils_uart.c to utils_uart3.c as u suggested, I changed uart instance as 3 and changed uartprint3 api . I did include utils_uart3.c file . Then I wrote my own use case  .Please find the attachment. I compiled and it generated AppImage. I prepared SDcard and inserted . Then it UART3 read/write is not happening.(Forte sting i just used uart3printf). Please help me out. ALL I need is custom UART,its configuration and usecase.

  • bhagya

    Are you trying to create this UARt based application from Vision SDK or as a standalone PDK example?

    regards, Shiju

  • Hi siva,
    I am trying to create this UARt based application from Vision SDK only, where it uses new UART other than default UART0.
  • Hi
    if you use J6 EVM, first check default UART0 is working for you
  • Hi shiju,
    UART0 is working fine. I think i have not convey my requirements clearly. There is an MCU connected to the J6 based custom board .The MCU sends the uart data to J6 via UART2_CTSN/UART2_RTSN Pins. J6 has to receive the data from M4 sysbios. I need to implement this in VSDK application. My requirement is to enable UART from SYSBIOS and to write UART2_READ/WRITE APIs ( UARt based application ) from Vision SDK. I want to use both the UARTS (UART0 and UART2).

    Regards
    Bhagyam
  • Hi Bhagyam,

    The UART driver supports all the instances of UART.

    You can call the GIO_addDevice with dev_id set to 2 and open the driver handle and use for communicating using UART2.

    You may refer the example provided in pdk at <pdk_install_dir>\packages\ti\drv\bsp_lld\uart\src

    Add the dma crossbar mapping for the UART2 instance.

    Regards,

    Prasad

  • I am trying o add new UART from Vision SDK. I could not find any procedure for this.
  • Hi Bhagyam,

    In VSDK, the UART device is created for the default UART instance used for console logs in below file.
    links_fw/src/rtos/utils_common/src/utils_uart.c

    You can refer this to create handle for the UART2 device and call the GIO_write and GIO_read APIs of the driver for doing the transfers.

    Regards,
    Prasad