Blog
Your blog category
Explore basics of TIMER Peripheral in Microcontroller!!
Explore about ADC peripheral in Microcontroller from foundational and functional level
Introduction –> UART Peripheral is one of the most common communication modules present in every series of microcontrollers. For Crisp and Short UART understanding as a concept, redirect yourself to this BLOG, it might take a couple of minutes to have an overlayed understanding. Now, UART is used in GPS modules or other wireless modules like Bluetooth and WiFi. GPS Modules- Use UART to exchange NMEA strings for positioning data. Bluetooth (e.g., HC-05)- Employs UART for wireless data transfer and pairing. Wi-Fi Modules (e.g., ESP8266, ESP32)- Use UART for sending AT commands and receiving responses. –> In S32K144, we’ll be referring to the UART as LPUART because the UART supported in S32K144 is a low-power UART called LPUART(Low Power Universal Asynchronous Receiver/Transmitter). –> NOTE: A single instance of UART contains a pair of a TX pin and an RX pin. –> Below are mentioned table of LPUART instances supported in different series with highlighted sections of our development board: Features of UART > Full-Duplex, standard Non-Return-to-Zero (NRZ) format Full-duplex: Communication happens in both directions at the same time. One device can send data while receiving data simultaneously. Yes, as you might be thinking about Half-Duplex Communication and it also exists where the channel can either send or receive data, but not both at the same time. At the same time, there also exists a last type of this which you might not think, that is Simplex Communication where only one-way communication is possible. Standard Non-Return-to-Zero (NRZ) Format: Data is represented as high (1) or low (0) voltage levels. Voltage doesn’t return to zero between bits, ensuring efficient use of the signal without gaps. > Programmable baud rates (13-bit modulo divider) Baud Rate: The baud rate is the number of signal changes or symbols transmitted per second in a communication system. For example, a baud rate of 9600 means 9600 bits are sent every second. Baud Rate in LPUART: In LPUART, a 13-bit counter generates the baud rate by dividing the LPUART clock. The division factor is set using the BAUD[SBR] register, with values ranging from 1 to 8191. The baud rate generator is always active when the transmitter or receiver is enabled, and for the transmitter, each character aligns with the next edge of the transmit bit clock. This ensures continuous operation despite minor errors. But there’s a catch that you might see in development, our IDE only gives some preset group of baud rates like 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, and 921600, then “what is the use of this baud-rate generator?”. The generator’s role is to provide flexibility to derive these preset baud rates from the main LPUART clock. While only specific baud rates may be officially supported (due to hardware limits or design constraints), the generator’s configuration ensures these values can be accurately achieved by adjusting the divisor (SBR) and oversampling ratio (OSR), which improves accuracy by sampling each bit multiple times. We’ll be discussing the sampling technique in a further section. > Transmission Functionality Now, we’ll be learning how characters are sent over LPUART where we’ll also learn different other features of LPUART. Below mentioned is the Block Diagram of LPUART Transmission: No need to worry by viewing this block diagram, after this go-through you’ll be able to teach others about this block diagram seamlessly. Idle State and Configuration: The transmitter output (TXD) is idle at a logic high by default. To invert this behavior, set the CTRL[TXINV] bit. The transmitter is enabled by setting CTRL[TE], which queues a preamble (idle state) character. Data Transmission: Data is written to the transmit buffer via the DATA register. The transmit shift register (9–13 bits long based on configuration) sends a start bit, data bits, and a stop bit. In 8-bit mode, the shift register handles 1 start bit, 8 data bits, and 1 stop bit. Operation Flow: When the shift register is free, it fetches data from the transmit buffer and synchronizes it with the baud rate clock. The STAT[TDRE] flag is set, indicating readiness for new data. If no new data is available after sending the stop bit, the transmitter enters idle mode (TXD high). Disabling the Transmitter: Writing 0 CTRL[TE] doesn’t stop the transmitter immediately. Current activity (data, idle, or break character) must finish first. Sending Break and Queued Idle in LPUART(Feature offered by LPUART)–> Sending break and queued idle refers to transmitting a break character (a full character of logic 0) or an idle character (logic 1) to manage communication flow, often to signal the end of a message or to wake up sleeping receivers. These actions can be queued by setting control bits in the LPUART, ensuring proper synchronization and transmission. Break Characters: A break character forces the TX line to logic 0 for a full character time (9–12 bits, including start and stop bits). For a longer 13-bit break, set STAT[BRK13]. To send a break: Wait for STAT[TDRE] (Transmit Data Register Empty) to ensure the last character has been shifted out. Set CTRL[SBK] to 1, then clear it to 0. This queues a break for transmission. If CTRL[SBK] remains 1, additional break characters will be queued automatically. Break characters received on RX are detected as all 0s with a framing error (STAT[FE] = 1). Alternative Break Transmission: Writing to DATA with bit 13 set and all data bits cleared can send a break as part of the data stream. This method also works with DMA to transmit a break character. Idle Characters: An idle character (logic 1 for a full character time) can wake up sleeping receivers during idle-line wakeup. To send an idle character: Wait for STAT[TDRE]. Clear and then set CTRL[TE]. This queues an idle character. The transmitter holds TXD high until the queued idle is sent. Alternative Idle Transmission: Writing to DATA with bit 13 and all data bits set can send an idle character as part of the data stream. DMA can also be used for idle transmission. Control Bits for Break Length: The length of break characters depends
Explore About PORT Peripheral in S32K144 MCU || What is it? How to use it? How is it different from GPIO Peripheral
Generating PWM signals of varying Frequency and Duty Cycle via PWM Driver of Autosar MCAL using ElecronicsV3 Board ( S32K144 MCU)
Interfacing LEDS and Switches via Port Driver of Autosar MCAL Layer using ElecronicsV3 Board(S32K144 MCU)
Interfacing of ESP8266 Wi-Fi Module as Web Client using UART Driver of Autosar MCAL Layer via ElecronicsV3 Board (S32K144 MCU)
Explore about FTM Peripheral of Automotive MCU S32K1xx using ElecronicsV3 Board (S32K144 MCU) || FTM PWM || FTM ICU || FTM Counter Modes
Explore about ADC Peripheral of Automotive MCU S32K1xx using ElecronicsV3 Board (S32K144 MCU) || ADC Channels || ADC HW&SW Triggering || ADC Pre Triggers || ADC relation with PDB and TRGMUX