
GD32A50x User Manual
204
can be written to an SBUF[7:0] to initiate an 8-bit transmission, using the shifter status
flag bit to determine when to use an interrupt or DMA request to write. Supports the MSB
first transfer write to the SBUFBBS[7:0] register instead.
UART receive
UART receivers use one timer, one shifter, and one pin support, while supporting RTS
requires two timers and two pins. Start and stop bit validation is handled automatically, and
multiple transfers can be supported using DMA. The timer status flag determines when a stop
bit for each word is received. MFCOM does not support parity.
MFCOM accepts data only once in the middle of each bit.The timer can be used to filter errors
in the input data and detect the length of free frames.The interrupt frame causes an error flag
position bit, and the shift buffer register returns 0x00.Due to the synchronization delay, the
serial input data is set up in 2 MFCOM clock cycles, so the maximum baud rate is the MFCOM
clock frequency divided by 4.
UART receiver configuration
1.
Set the bits SSTOP[1:0] and SSART[1:0] as 0b11 and 0b10 in register MFCOM_SCFGx
respectively, set the start bit to 0 and the stop bit to 1.
2.
Set the bits TMPL and SMOD[1:0] as 0b1 and 0b01 in register MFCOM_SCTLx
respectively, configure receive using timer 0 on negedge of clock with input data on pin
0. Can invert input data by setting PINPL.
3.
Set the bit TMCVALUE[15:0] as 0x0F01 in register MFCOM_TMCMPx, configure 8-bit
transfer with baud rate of divide by 4 of the MFCOM clock. Set TMCVALUE [15:8] =
(number of bits x 2) - 1. Set TMCVALUE [7:0] = (baud rate divider / 2) - 1.
4.
Set
the
bits
TMOUT[1:0],
TMDEC[1:0],
TMRST[2:0],
TMSTOP[1:0],
TMDIS[2:0],TMEN[2:0] and TMSTART as 0b10, 0b00, 0b100, 0b10, 0b010, 0b100 and
0b1 in register MFCOM_TMCFGx respectively,
configure start bit, stop bit, enable on pin
posedge and disable on compare.
5.
Set the bits TMPPL, and TMMOD[1:0] as 0b1, and 0b01 in register MFCOM_TMCTLx
respectively, configure dual 8-bit counter using inverted pin 0 input.
6.
Set the bit SBUF[31:0] as data to receive in register MFCOM_SBUFx, received data can
be read from SBUFBYS[7:0], use the shifter status flag to indicate when data can be
read using interrupt or DMA request. Can support MSB first transfer by reading from
SBUFBIS[7:0] register instead.
UART receiver with RTS functionality uses a second timer to generate the RTS output. When
the RTS is asserted, the start bit is not detected and the received data is ignored. RTS asserts
when the start bit is detected and negates when reading from the shift buffer register.
UART receiver with RTS configuration
1.
Set the bits SSTOP[1:0] and SSART[1:0] as 0b11 and 0b10 in register MFCOM_SCFGx
respectively, configure start bit of 0 and stop bit of 1.
2.
Set the bits TMPL and SMOD[1:0] as 0b1 and 0b01 in register MFCOM_SCTLx
respectively, configure receive using timer 0 on negedge of clock with input data on pin