Part Number: UCD3138OL40EVM-032
Other Parts Discussed in Thread: UCD3138, UCD3138064
Tool/software:
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 it's a problem with my gpio settings or if there's a problem with my hardware connection. I hope you can help answer, thank you.
Regards.
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 = 0;
Uart0Regs.UARTLBAUD.all = 49; //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.bit.RXDAT; //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.
}
void char_out(char data)
{
while(Uart0Regs.UARTTXST.bit.TX_RDY == 0)
{
//do nothing while waiting for data to transmit.
}
Uart0Regs.UARTTXBUF.all = data; //put out a byte
}
void main()
{
// enable JTAG
MiscAnalogRegs.IOMUX.all = 0;
//---------------------------------------------------------------------------
// IMPORTANT: READ BELOW, OR CODE MAY NOT EXECUTE CORRECTLY
//---------------------------------------------------------------------------
// tie pin FAULT3 to ground for normal operation
// tie pin FAULT3 to 3.3V to clear checksum
if(GioRegs.FAULTIN.bit.FLT2_IN == 1)
{
clear_integrity_word();
}
#if (UCD3138|UCD3138064)
MiscAnalogRegs.CLKTRIM.bit.HFO_LN_FILTER_EN = 0;
MiscAnalogRegs.CSTRIM.bit.RESISTOR_TRIM =23; //28;
#endif
init_pmbus(0x58); // initialize PMBus handler
init_uart0();
for(;;)
{
pmbus_handler();
char_out('1');
}
}












