Low-power universal asynchronous receiver transmitter (LPUART)
Parity checking in reception
If the parity check fails, the PE flag is set in the LPUART_ISR register and an interrupt is
generated if PEIE is set in the LPUART_CR1 register. The PE flag is cleared by software
writing 1 to the PECF in the LPUART_ICR register.
Parity generation in transmission
If the PCE bit is set in LPUARTx_CR1, then the MSB bit of the data written in the data
register is transmitted but is changed by the parity bit (even number of "1s" if even parity is
selected (PS=0) or an odd number of "1s" if odd parity is selected (PS=1)).
37.4.7
Single-wire half-duplex communication using LPUART
Single-wire half-duplex mode is selected by setting the HDSEL bit in the LPUART_CR3
register. In this mode, the following bits must be kept cleared:
•
LINEN and CLKEN bits in the LPUART_CR2 register,
•
SCEN and IREN bits in the LPUART_CR3 register.
The LPUART can be configured to follow a single-wire half-duplex protocol where the TX
and RX lines are internally connected. The selection between half- and full-duplex
communication is made with a control bit HDSEL in LPUART_CR3.
As soon as HDSEL is written to 1:
•
The TX and RX lines are internally connected
•
The RX pin is no longer used
•
The TX pin is always released when no data is transmitted. Thus, it acts as a standard
I/O in idle or in reception. It means that the I/O must be configured so that TX is
configured as alternate function open-drain with an external pull-up.
Apart from this, the communication protocol is similar to normal LPUART mode. Any
conflicts on the line must be managed by software (by the use of a centralized arbiter, for
instance). In particular, the transmission is never blocked by hardware and continues as
soon as data is written in the data register while the TE bit is set.
Note:
In LPUART, in the case of 1-stop bit configuration, the RXNE flag is set in the middle of the
stop bit.
37.4.8
Continuous communication in DMA mode using LPUART
The LPUART is capable of performing continuous communication using the DMA. The DMA
requests for Rx buffer and Tx buffer are generated independently.
Note:
Use the LPUART as explained in
you can clear the TXE/ RXNE flags In the LPUART_ISR register.
Transmission using DMA
DMA mode can be enabled for transmission by setting DMAT bit in the LPUART_CR3
register. Data is loaded from a SRAM area configured using the DMA peripheral (refer to
Section 10: Direct memory access controller (DMA) on page
register whenever the TXE bit is set. To map a DMA channel for LPUART transmission, use
the following procedure (x denotes the channel number):
1260/1693
Section
37.4.3. To perform continuous communication,
DocID024597 Rev 3
295) to the LPUART_TDR
RM0351
Need help?
Do you have a question about the STM32L4x6 and is the answer not in the manual?
Questions and answers