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.

AM572X: Using UART in SYS/BIOS

Howdy,

I am looking to use the UART1 connection (signals UART1_RXD and UART1_TXD) for RS-232 communication. I'll be running it on the ARM platform, and am using SYS/BIOS and XDC. Is there an XDC module or driver that I can use to achieve this?

Thanks in advance for your help.

  • Hi,

    I will forward this to the RTOS team.
  • Caleb,

    I am assuming that you are using the AM572x GP EVM for these tests. The EVM by default uses UART3 for Serial IO. However we have UART driver in the Processor SDK RTOS that can support any instance of UART.  The driver can be found under pdk_am57xx_1_0_1\packages\ti\drv\uart in the Processor SDK RTOS package

    In order to enable this functionality,  you will need to modify the board library in the Processor SDK RTOS library in order to enable the UART1 pins if those pins are not being enabled. the pinmux configurations is configured using Board_pinmuxConfig in the file evmam572x_pinmux.c in ${PDK_INSTALL_DIR}\packages\ti\board\evmAM572x. Currently, the board library uses IO_DELAY settings generated from the pinmux utility so you will need to use pin mux utilities to modify the pins to enable UART1 pins but the current release doesn`t provide the pinmux project to import for this board.so as a quick hack you can use a function like PinmuxUartConfig (currently only configures UART3) defined in that file to configure UART1. I see that those pins are going into P18 connector so you should be able to probe the pins 30 and 60 to see output.

    The process of enabling a UART instance other than the default instance used in the SDK has been described for AM335x device here:

    Hope this helps

    Regards,

    Rahul

  • I checked the pinmux configurations for UART1 used in the default board library and it looks like the UART1_TXD and UART1_RXD pins are already configured using BoardPadDelayInit.c found under pdk_am57xx_1_0_1\packages\ti\board\src\evmAM572x

    Format  used to configure CTRL_CORE_PAD_* registers that configure the Pin multiplexing

    /** {PADCONF_REG_OFFSET, PADCONF_VALUE, {CFG_X_IN offset, aDelay, gDelay}, {CFG_X_OEN offset, aDelay, gDelay}, {CFG_X_OUT offset, aDelay, gDelay}} **/

    UART1 settings are as given below:

    /* UART1 - uart1_rxd on B27 - UART1 */

        {0x17E0, 0x50000, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    /* UART1 - uart1_txd on C26 - UART1 */

        {0x17E4, 0x10000, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}},

    This means that you should be able to use the UART1 directly from the application layer using UART driver after configuring the clocks correctly.  To initialize the UART1 instance with the UART driver, we provide default setting defined in the file uart_soc.h that can be used from the application layer.

    Regards,

    Rahul

    PS: If this UART is going to used for STDIO, then you can add the initialization call to Board_uartStdioInit in the file evmAM572x_lld_init.c

  • Howdy,

    I think I may have gotten myself confused here, and that may be due to not using the same SDK. It appears that I am not using the Processor SDK RTOS package that you are recommending. Instead, it appears that I am using the starterware package Version: AV BIOS SDK v01.09.00.00. Within that SDK are the uart.c and uart.h files that I am trying to use. Will these sources still be compatible with what I am attempting to accomplish? If so, are there more appropriate guides that I should be using?

    Also, I am manually setting up the pinmux for UART1 TX and RX so that should be well and good. Are there other clock settings that I need to manually configure?

    Thank you for your help!
  • Howdy,

    I went ahead and added the TI-RTOS SDK to our build, and after a few modifications have gotten it to successfully build. However, from what I can tell, the driver is not yet working. When the program initializes, the pinmux is manually setup. Then a rs232 test function executes.

    Here is what the test function does:

    bool opened = false;
    UART_Handle handle;
    UART_Params params;
    
    void rs232Test
    {
    
      int uartIndex = 0;
      char tx[] = "0123456789";
      char rx[] = "9876543210";
      int msgLen = 10;
      int timeoutLength = 10000;  
    
    
      if (!opened)
      {
       
        // Pin mux should already be configured previously
        UART_init();
        UART_Params_init(&params);
        params.readTimeout = timeoutLength;
    
        handle = UART_open(uartIndex, &params);
    
        // We have opened the device!
        opened = true;
      }
    
      printf("Attempting to write.");
      UART_write(handle, tx, msgLen);
      printf("Message written: %s", tx);
    printf("Attempting to read. Timeout: %d", timeoutLength); UART_read(handle, rx, msgLen); printf("Message in buffer: %s", rx); printf("Test Finished"); }

    Pretty straightforward. The FIFO register appears to be properly written into, but I do not appear to get any RS232 communication (I am using TeraTerm). Are there any initialization steps I may be missing?

    Thank you.

  • Caleb,

    In the TI RTOS SDK, the board library is used to do all the SOC low level initialization like clock, pinmux, module prcm, etc. How are you initializing the device clocks that source the UART module. If you plan to use the board library, we recommend that you use the board library to initialize the clocks necessary for UART. For UART, you can use the board library as provided below:

    Board_initCfg boardCfg;
    boardCfg = BOARD_INIT_PINMUX_CONFIG |
    BOARD_INIT_MODULE_CLOCK |
    BOARD_INIT_UART_STDIO;

    Board_init(boardCfg);

    UART standard IO has been implemented in the UART driver in the UART_stdio.c so you can use that function directly in your code. Also, to initialize UART params to use with UART driver on AM572x, you can use the default soc params used in file UART_soc.c file found under directory path pdk_am57xx_1_0_1\packages\ti\drv\uart\soc\am572x.

    Regards,
    Rahul
  • Howdy,

    The program loader initializes all of the clocks with manual register reads/writes, I believe. For the sake of clarity, I will attempt to show the "clock chain" of what settings are used. If I miss something here, it may reveal the source of my issue.

    1. Input Reference Clock (20MHz)
      1. This SYS_CLKIN1 value becomes PER_DPLL_CLK

    2. DPLL_PER M and N values set to 96 and 5 (0x6004)
      1. This results in a DPLL output of 384MHz
    3. CLKOUT_M2 Divider value set to 4
      1. This puts a 96MHz frequency onto signal FUNC_96M_AON_CLK
      2. This also places a 192MHz frequency onto signal FUNC_192M_CLK
    4. CM_L4PER_UART1_CLKCTRL selects FUNC_192M_CLK

    5. The UART driver is initialized with a baud rate of 115200

    I think that is everything, but please correct me if I am wrong. If I use the Board_Init() function, will the same steps as above be completed? If so, there may be no benefit from re-configuring those registers to the same values.

    Also: I am using the defaults from UART_SOC.c as well. The UART driver was already using them, as far as I could tell, so no modifications were required to hook those in.

    Thank you for your help!

  • Howdy,

    I ran a quick loopback test (9600 Baud), and it appears that I am able to have the UART communicate with itself. Knowing that, I am inclined to believe that the clock configuration may not be my issue.

    However, when I probe the Tx line up on a scope, the pk-pk voltage appears to only be ~500mv. This seems very low, and may be why I was unable to communicate with the device on my PC. Is there a configuration step that I am missing, which would get my output to the correct voltage level?

    Thanks!