On PIC micro controller UART, Baud rate was set to 38400 (No parity,, 8 data bits),
*************UART 1 configuration********* IFS0bits.U1RXIF = 0; IFS0bits.U1TXIF = 0; IEC0bits.U1RXIE = 1; IEC0bits.U1TXIE = 0; U1MODEvalue = 0b1000000000001000; U1STAvalue = 0b0000010000000000; U1BRG = 103; U1MODE = U1MODEvalue; U1STA = U1STAvalue;
Device connected to uC is working fine; they have healthy communication. But I was measuring the baud time of my data, and I observed that the start bit and data bit read 26 us which is ok as per 1000000/Baudrate us, but the stop bit is only about 20us, that looks wrong to me, it should also read the 26us. So I try with different baud rate. But have the same problem ( see below table).
4800Buad rate , Stop bit time =160us ( but it should be 208us)
9600Buad rate , Stop bit time =72us ( but it should be 104us)
38400Buad rate , Stop bit time =20us ( but it should be 26us)
115200Buad rate , Stop bit time =7.2us ( but it should be 8.8us)
I asked the support team, and they say your BRGH value is set to 1, try to change it to 0. So I changed BRGH=0 and this problem is solved.
With BRGH = 0, stop bit error removed and stop bit measures 26uS. We still need to test this with other baud rates too.
Q1) Why BRGH making difference in stop bit baud time only? We are using 8 MHz Crystal.
Q2) Data sheet says BRGH=1 for high speed enable, what does it mean here by high speed, is it baud rate, if so which baud rate is considered to high speed?
Q4) When to use BRGH=0 or when to use BRGH=1, as per test it was observe stop bit baud error in every baud rate as per above given test result table.
Link of uC