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/TMDXIDK5728: RS-485 stuck in UART write

Part Number: TMDXIDK5728

Tool/software: TI-RTOS

Dear all,

I try to get RS-485 running on the IDK, but I have some troubles with that. Basically I removed all other code to break it down to the UART routine.

I'm using the am5728x IDK v1.2, Processor SDK RTOS AM57xx 4.2.0.

/* main entry point */
int main()
{
    /* Init Board */
    initBoard();

    biosTaskCreate(uart_test,
                   "uart_test",
                   8, 4096);

    /* Start the BIOS 6 Scheduler */
    BIOS_start ();
    return 0;
}

static int initBoard()
{
    /* Call board init functions */
    Board_initCfg boardCfg;

    boardCfg =  BOARD_INIT_PINMUX_CONFIG |
        BOARD_INIT_MODULE_CLOCK;// | BOARD_INIT_UART_STDIO;
    Board_init(boardCfg);
}

void uart_test(UArg arg0, UArg arg1)
{
    UART_Params uartParams;
    int32_t count;
    char input = '\n';
    char buffPointer[1000];
    char echoPrompt[] = "\n";
    char echoPrompt1[] = "Data received is\n";

   // CSL_xbarDspIrqConfigure(1,
                     //       CSL_XBAR_INST_DSP1_IRQ_34,
                      //      CSL_XBAR_UART2_IRQ);

    UART_init();

    /* Create a UART with data processing off. */
        UART_Params_init(&uartParams);
        uartParams.writeMode = UART_MODE_BLOCKING;
        uartParams.writeDataMode = UART_DATA_BINARY;
        uartParams.readDataMode = UART_DATA_BINARY;
        uartParams.readReturnMode = UART_RETURN_FULL;
        uartParams.readEcho = UART_ECHO_OFF;
        uartParams.baudRate = 9600;


    uart_handle = UART_open(0x01, &uartParams);

    //First write does not work
	UART_write(uart_handle,echoPrompt,sizeof(echoPrompt));

    while(1)
       {
        UART_write(uart_handle,echoPrompt1,sizeof(echoPrompt));
        Task_sleep(250);
       }
}

I've used the examples to get started. The schematic and pinmux says, that the RS-485 is connected to UART2. So I've opened 0x01 and I get the correct handle and address. Everything looks fine, but I never get back from the write routine, because it stucks in the semaphore in UART_write2_v1:

                     if (object->params.writeMode == UART_MODE_BLOCKING)
                     {
                         /* Pend on lock and wait for Hwi to finish. */
                         semStatus = UART_osalPendLock(object->writeSem,
                                                       transaction->timeout);

The interesting part is, that this example works with the UART3, so I get response from the FTDI. Probably its something easy, but I've no more ideas, where to start.

Thanks!

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

    Please take a look at the file idkAM572x_clock.c file in PDK_INSTALL_PATH\packages\ti\board\src\idkAM572x.

    In the Board_moduleClockInit function only module  clock  for UART1, UART3 and UART9 are being enabled by default.  To use UART2, you can either add the following to the board library and rebuild it or use the CSL API from your application before UART_open to enable the clock to that instance of UART.

       CSL_FINST(l4PerCmReg->CM_L4PER2_UART2_CLKCTRL_REG,
            L4PER_CM_CORE_COMPONENT_CM_L4PER2_UART2_CLKCTRL_REG_MODULEMODE, ENABLE);
    
        while(CSL_L4PER_CM_CORE_COMPONENT_CM_L4PER2_UART2_CLKCTRL_REG_IDLEST_FUNC !=
           CSL_FEXT(l4PerCmReg->CM_L4PER2_UART2_CLKCTRL_REG,
            L4PER_CM_CORE_COMPONENT_CM_L4PER2_UART2_CLKCTRL_REG_IDLEST));

    Let us know if this doesn`t enable UART2 output and we can try and provide further guidance.

    Regards,

    Rahul