Trying to set baudrate of uart to 115200 on DEVKIT for MPC5748G, is missing a character once in a while, according to my calculation the baudrate is 115273 when the mantissa is 43 and fraction 6, psb:
void uart_init()
{
uint32_t Fraction;
uint32_t Integer;
LINFlexD_2.LINCR1.B.INIT = 1; /* Enter Initialization Mode */
LINFlexD_2.LINCR1.B.SLEEP = 0; /* Exit Sleep Mode */
LINFlexD_2.UARTCR.B.UART = 1; /* UART Enable, Req'd before UART configuration */
LINFlexD_2.UARTCR.B.RxEn = 1;
LINFlexD_2.UARTCR.B.TxEn = 1;
LINFlexD_2.UARTCR.B.RFBM = 0;
LINFlexD_2.UARTCR.B.WL0 = 0x1;
LINFlexD_2.UARTCR.B.PCE = 1;
//LINFlexD_2.UARTCR.R = 0x0033; /* UART Enable, 1 byte tx, no parity, 8 data*/
LINFlexD_2.UARTSR.B.SZF = 1; /* CHANGE THIS LINE Clear the Zero status bit */
LINFlexD_2.UARTSR.B.DRFRFE = 1; /* CHANGE THIS LINE Clear DRFRFE flag - W1C */
BaudRate = (80 * 1000000) / 115200;
Integer = BaudRate / 16;
Fraction = BaudRate - (Integer * 16);
LINFlexD_2.LINIBRR.R = Integer;
LINFlexD_2.LINFBRR.R = Fraction;
LINFlexD_2.LINCR1.B.INIT = 0; /* Exit Initialization Mode */
SIUL2.MSCR[PC8].B.SSS = 1; /* Pad PC8: Source signal is LIN2_TX */
SIUL2.MSCR[PC8].B.PUS = 1; /* by Kfir: Tx need to be pulled up - prevent junk chars */
SIUL2.MSCR[PC8].B.PUE = 1; /* by Kfir: Tx need to be pulled up - prevent junk chars */
SIUL2.MSCR[PC8].B.OBE = 1; /* Pad PC8: OBE=1. */
SIUL2.MSCR[PC8].B.src=3; /* Pad PC8: Full strength slew rate */
SIUL2.MSCR[PC9].B.IBE = 1; /* Pad PC9: Enable pad for input */
SIUL2.IMCR[202].B.SSS = 2; /* LIN2_RX : connected to pad PC9 */
}
The character miss happens both when putty is set to 115200 and 115273.
example:
"result": "PASS", "file": "
output:
"rsult": "PAS", "file":
What can be the reason?