Hi, I have a problem with the SCI0 of the microcontrollers MC9S12G240 and MC9S12P128. I need a serial communication with 8 bits data and 2 stop bits, but I see in the datasheet that the SCI is only with 1 bit. Is it real? Is there the possibility to have 2 stop bits? How can I implement it?
Many thanks and best regards,
Andrea Cavazzoni
Hi Andrea,
Yes, it is true that SCI module do not directly support 2 stop bits.
However, that should be possible simply fixed by configuring SCI for 9 bits by setting SCI0CR1_M bit.
In that case, the SCI0DRH_T8 bit should be set and leave unchanged.
The SCI/UART sends data bits from LSB to MSB, therefore nine’s bit will work as additional stop bit.
The SCI transfer is trigeredby writing to SCI0DRL register despite on fact whether we access SCI0DRH register or not.
Of course, the combination of 9 data bits and 2 stop bits is not directly configurable and you should use Edward’s proposal above.
I hope it helps you
Radek
Hi,
2stop bits transmitter is 100% compatible with 1stop bit receiver. No changes are required.
To make 1stop bit transmitter compatible with 2stop bits receiver, you need to wait for TC (transmission complete) instead of TDRE (transmit data register empty flag) and insert one bit time or longer delay prior to sending next byte.
Regards,
Edward