5.1.4.2.1. Functional Requirements
The system must enable the USART peripheral by setting the USART_CR1_UE bit in the appropriate register. |
The system must configure the TX and RX pins as alternate functions on the microcontroller for data transmission and reception. |
The system must set the baud rate using the USART_BRR register based on the baud rate calculation formula. |
The system must enable oversampling in either 8x or 16x mode by configuring the USART_CR1_OVER8 bit. |
The system must enable data transmission through the TX pin by setting the USART_CR1_TE bit in the CR1 register. |
The system must enable data reception through the RX pin by setting the USART_CR1_RE bit in the CR1 register. |
The system must configure parity for error detection using the USART_CR1_PS and USART_CR1_PE bits in the CR1 register. |
The system must set the data word length to either 8 or 9 bits using the USART_CR1_M bit in the CR1 register. |
The system must configure the mode of operation (asynchronous or synchronous) using the appropriate bits in the USART_CR1 and USART_CR2 registers. |
The system must enable Direct Memory Access (DMA) for data transfer by configuring the USART_CR3_DMAT and USART_CR3_DMAR bits in the CR3 register. |
The system must configure USART to operate in half-duplex mode by enabling the USART_CR1_HDSEL bit, allowing the same pin for both transmission and reception. |
The system must check the RXNE (Read Data Register Not Empty) bit in the USART_SR register to verify if data is ready for reception before reading the USART_DR register. |
The system must check the TXE (Transmit Data Register Empty) bit in the USART_SR register to ensure the data register is empty before transmitting data. |
The system must wait for the transmission to complete by checking the TC (Transmission Complete) bit in the USART_SR register before sending new data. |
The system must disable the USART by clearing the USART_CR1_UE bit before configuring the registers to ensure correct configuration. |
The system must re-enable the USART peripheral by setting the USART_CR1_UE bit after configuration is complete to start communication. |
The system must ensure proper pin mapping for TX and RX pins according to the microcontroller’s specifications, ensuring correct communication. |
The system must allow for the selection of the oversampling mode, either 8x or 16x, by configuring the USART_CR1_OVER8 bit. |
The system must allow the selection of data word length to either 8 or 9 bits by configuring the USART_CR1_M bit. |
The system must handle framing errors by checking the USART_SR_FE bit and generating an error condition if a framing error occurs. |
The system must provide a user-friendly interface for configuration and management of USART communication parameters, including baud rate and pin mappings. |
The system must support easy maintenance, with well-documented configuration parameters and clear error logs for debugging USART communication. |