
GD32A50x User Manual
203
or more MFCOM timers can be triggered.
Output triggers
The output trigger of each MFCOM timer is equal to the timer output, and the timer output is
not affected by the timer's pin polarity configuration.
9.4.7.
Typical configuration of application
The following operation flow is a typical process for a variety of MFCOM module applications.
UART transmit
UART transmit requires a timer, a shifter, and a pin using module resources, or two pins if
CTS is supported. Multiple transfers are supported with DMA, and the start and stop bits are
inserted automatically. MFCOM does not support automatic insertion of parity bits. When the
stop bit of each word is transmitted the timer status flag can indicate.
Interrupted frames and idle frames require software intervention.Before transmitting interrupt
and idle frames, the interrupt and idle frames are configured by setting the bit fields
SSTART[1:0] and SSTOP[1:0], and all bits in an idle frame are 1, and the interrupt frame is a
number of low levels immediately after the stop bit.
A second stop bit is supported, increasing
the number of bits to be transmitted by configuring the field TMCVALUE[15:0], and using
software to insert the stop bit into the data stream.When a byte is written to SBUFx to support
LSB, leaving the rest of the data frame unchanged, additional stop bits and idle frames are
inserted.
UART transmit configuration
1.
Set the bits SSTOP[1:0] and SSART[1:0] as 0b11 and 0b10 in register MFCOM_SCFGx
respectively, and set the start bit to 0 and the stop bit to 1.
2.
Set the bits SPCFG[1:0] and SMOD[1:0] as 0b11 and 0b010 in register MFCOM_SCTLx
respectively, configure sending using timer 0 on the rising edge of the clock with output
data at pin 0. Set PINPL to reverse output data and PINPL=1 and PINCFG =1 to support
open drainage.
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], TMSTOP[1:0] and TMSTART as 0b10, 0b10,
0b10 and 0b1 in register MFCOM_TMCFGx respectively, configure start bits, stop bits,
enable trigger assertions, and disable comparisons. CTS can be supported by
configuring TMEN=0b011.
5.
Set the bits TRIGSEL[3:0], TRIGPL, TRIGSRC, and TMMOD[1:0] as 0b0001, 0b1, 0b1,
and 0b01 in register MFCOM_TMCTLx respectively, configure a double 8-bit counter
using the shift 0 status flag as an inverted internal trigger source. CTS can be supported
by configuring PINSEL=1(for pin1) and PINPL=1.
6.
Set the bit SBUF[31:0] as data to transmit in register MFCOM_SBUFx, Transferred data