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.

CCS/UCD3138: Resolved UCD3138: uart TX pin has no output

Part Number: UCD3138

Tool/software: Code Composer Studio

Dear UCD expert,

Hello, I just came into contact with the UCD3138 chip recently, I want to test the serial port function, the relevant code is shown in the figure. Using "memory debug", you can see that the data is sent to the serial port register, but no data is sent out when debugging with the serial port tool, and there is no waveform when measuring the TX pin of uart with an oscilloscope. I wonder if there is a problem with the gpio settings? I hope you can help answer, thank you.

Regards,

pan

  • Well, for one thing, you left out setting the SW_RESET back to 1 to let it function.  You also didn't send a byte out to get things started.  I think that is necessary for char_out to work.  I don't think that tx_rdy works until the first byte has gone out.

    Please try this code:

    void init_uart0(void)
    {
    volatile Uint32 rx_byte0; //volatile to make warning go away about set but not read

    Uart0Regs.UARTCTRL3.bit.SW_RESET = 0; //software reset while initializing UART

    Uart0Regs.UARTCTRL0.bit.DATA_SIZE = 7; //8 bits
    Uart0Regs.UARTCTRL0.bit.STOP = 1; //2 stop bits
    Uart0Regs.UARTCTRL0.bit.SYNC_MODE = 1; //asynchronous mode

    Uart0Regs.UARTHBAUD.all = 0;
    Uart0Regs.UARTMBAUD.all = BAUD_RATE_VALUE_M;
    Uart0Regs.UARTLBAUD.all = BAUD_RATE_VALUE_L; //for 38400 //47 for control board, 44 for open loop

    Uart0Regs.UARTRXST.bit.RX_ENA = 1 ;//enable RX

    Uart0Regs.UARTTXST.bit.TX_ENA = 1;//enable TX

    Uart0Regs.UARTINTST.all = 0xff; //these two statements are supposed to clear the status bits
    Uart0Regs.UARTINTST.all = 0;

    rx_byte0 = Uart0Regs.UARTRXBUF.all; //clear RXRDY flag

    Uart0Regs.UARTIOCTRLTX.bit.IO_FUNC = 1; //enable transmit pin
    Uart0Regs.UARTIOCTRLRX.bit.IO_FUNC = 1; //enable receive pin

    Uart0Regs.UARTCTRL3.bit.CLOCK = 1; //internal clock select;
    Uart0Regs.UARTCTRL3.bit.SW_RESET = 1; //software reset released UART init done?

    Uart0Regs.UARTIOCTRLSCLK.bit.IO_FUNC = 0; //disable external clock for UART.

    Uart0Regs.UARTTXBUF.all = '\n'; //put out a byte to get things started.
    }