Hi, it shows that the LIN module in ADUCM330/331 support UART mode, so I want to use this mode to communication with DB9 of my computer.
But in the examples, there is no demo project about UART mode. So I write a project based on user manual, but fail to TX and RX data. When I debug my project, I found that LINCON always 0x100, and LINBR is always 0x326.
Does anyone have UART example project?
My part of code is shown as below. The whole project is attached as well.
T3CON = 0;
ISER0 = 0x720;
unsigned int HVstatus;
/* TX and RX pins are configured in HSI_GpioConfig() */
LINCON = ( (1u << 12u) |
(1u << 6u ) ); /* enable UART mode */
LINIMSK = 0u; /* enable all interrupts by clear mask bit */
LINBR = UART_BAUD_RATE_57600; /* UART baud rate-->284u = 16384000 / 57600*/
/* send a special byte to test UART work or not */
void HSI_UartSendByte(uint8_t byte)
/* fill the data into TX buf */
LINCON |= 0x40u; /* enable UART mode again */
LIND1 = byte;
/* wait last byte is tx complete */
//while(!(LINSTA & (1u << 11u)));