[MM32 eMiniBoard Review] Part 3: UART Test and Analysis
[Copy link]
1. Introduction to MM32 UART
Any UART bidirectional communication requires at least two pins: receive data input (RX) and transmit data output (TX).
RX: receive data serial input. Data is recovered by oversampling to distinguish data from noise.
TX: transmit data output. When the transmitter is disabled, the output pin reverts to its I/O port configuration. When the transmitter is enabled and not transmitting data, the TX pin is high.
The bus should be idle before transmitting or receiving
A start bit
A data word (5, 6, 7 or 8 bits), the least significant bit first
0.5, 1, 1.5, 2 stop bits, thus indicating the end of the data frame
Use fractional baud rate generator - 16-bit integer and 4-bit fractional representation.
The receive and transmit signals can be swapped by enabling the SWAP bit in the UART_GCR register.
The receive/transmit signals can be inverted by enabling the RX_TOG/ TX_TOG bits in the UART_GCR register.
The following pins are required in hardware flow control mode: nCTS: Clear to Send, if high, blocks the next data transmission when the current data transmission ends.
nRTS: Request to Send, if low, indicates that the UART is ready to receive data.
2. Burn in the program
I chose the "UART_Print_DMA" routine as the download program.
As soon as you enter, you can see the string being sent. Change the string to "EEWORLD MM32 eMiniBoard UART" and modify the string length accordingly.
Then open the serial port initialization program and you can see that the UART uses the PA9 and PA10 pins.
Let's take a look at the UART initialization configuration steps for MM32F0133C7P.
Open the schematic diagram, click to download the development board schematic diagram information [ Development Board Information ], and then you can see the pin positions in the schematic diagram corresponding to the actual object as shown in the figure below.
Connect the serial port module, connect the RX of the serial port module to PA9 (TX) of the development board, and finally check the content displayed on the serial port after running.
3. Summary
The MM32 routines are very clear and well commented. This program uses the DMA function, which is not explained in this article, but will be covered later, and DMA will be explained then.
|