GD32A50x User Manual
210
respectively,
configure start bit, stop bit, enable on trigger high, disable on compare, reset
if output equals pin. Initial clock state is logic 0 and is not affected by reset.
7.
Set the bits TRIGSEL[3:0], TRIGPL, TRIGSRC, TMPCFG[1:0], TMPSEL[2:0], and
TMMOD[1:0] as 0b0001, 0b1, 0b1, 0b01, 0b001, and 0b01 in register MFCOM_TMCTLx
respectively, configure dual 8-bit counter using pin 1 output enable (SCL open drain),
with shifter 0 flag as the inverted trigger.
8.
Set the value of register MFCOM_TCMP(x+1) as 0x0000000F, configure 8-bit transfer.
Set TMCVALUE [15:0] = (number of bits x 2) - 1.
9.
Set the bits TMDEC[1:0], TMDIS[2:0], TMEN[2:0], TMSTOP[1:0] and TMSTART as 0b10,
0b001, 0b001, 0b01 and 0b1 in register MFCOM_TMCFG(x+1) respectively, enable
when timer 0 is enabled, disable when timer 0 is disabled, enable start bit and stop bit at
end of each word, decrement on pin input.
10.
Set the bits TRIGSEL[3:0], TRIGPL, TRIGSRC, TMPSEL[2:0], TMPPL and TMMOD[1:0]
as 0b0001, 0b1, 0b1, 0b001, 0b1 and 0b11 in register MFCOM_TMCTL(x+1)
respectively, configure 16-bit counter using inverted pin 1 input (SCL).
11.
Set the bit SBUF[31:0] as data to transmit in register MFCOM_SBUFx, transmit data can
be written to MFCOM_SBUFBBSx[7:0], use the shifter status flag to indicate when data
can be written using interrupt or DMA request.
12.
Set the bit SBUF[31:0] as data to receive in register MFCOM_SBUF(x+1), received data
can be read from SBUFBIS[7:0], use the shifter status flag to indicate when data can be
read using interrupt or DMA request.
I2S master
The I2S master mode uses two timers, two shifters and four pins. One timer is used to
generate the bit clock and control the shifter, and the other is used to generate frame
synchronization. Supports DMA data transfer. The shift error flag will be set in case of
insufficient transmission or overflow of reception. The MFCOM shift buffer enables bit clock
and frame synchronization generation after the first write to the transmitted data.
At the first bit clock edge initial frame synchronization asserts that the bit clock frequency is
an even part of the MFCOM clock frequency. The timer uses the start bit to ensure that frame
synchronization generates a clock cycle before the first output data. Receiver input is set to
3 MFCOM clock cycles, so the maximum baud-rate MFCOM_CLK frequency is divided by 8
due to the synchronization delay.
I2S master configuration
1.
Set the bits SSART[1:0] as 0b01 in register MFCOM_SCFGx, load transmit data on first
shift and stop bit disabled.
2.
Set the bits SPCFG[1:0] and SMOD[2:0] as 0b11 and 0b010 in register MFCOM_SCTLx
respectively, configure transmit using timer 0 on rising edge of clock with output data on
pin 0.
3.
Set the bits in register MFCOM_SCFG(x+1) as default value,
start and stop bit disabled.
4.
Set the bits TMPL, SPSEL[2:0] and SMOD[2:0] as 0b1, 0b001, and 0b001 in register
MFCOM_SCTL(x+1) respectively, configure receive using timer 1 on falling edge of clock