2018-01-23 09:55 AM
I am using usart1 for asynchronous communication. Microcontroller is nucleo STM32F103RB.
Here's is how I am receiving data if parity bit is not set,
char USART1_Receive()
{ if((USART1_SR & 0x00000020) == 0) // no data available return 0; return USART1_DR;}My question is, how should I receive data if parity error occurs? How should I handle parity error?
#stm32f103rb #serial #usart2018-01-23 10:00 AM
On the F1 you need to read the DR to clear the parity error, reception will be stopped until you do so.
2018-01-23 11:02 AM
How do I request data re-transmission?
2018-01-23 12:32 PM
ST use XModem (or is it Zmodem?) in their IAP-over-UART examples...
https://en.wikipedia.org/wiki/XMODEM
https://en.wikipedia.org/wiki/ZMODEM
http://www.rogtronics.net/files/datasheets/micro_z80/xymodem.pdf
2018-01-23 01:10 PM
A UART doesn't work that way, it tells you if you had a reception error (parity, framing, overrun, etc), the protocol you layer on top would need to manage errors and retransmission of data.
X-MODEM is a relatively light-weight protocol.
2018-01-23 01:50 PM
Crude form of Y-MODEM (1K packets with CRC)