UART Break and Autobaud Block Icon
Microchip UART modules support advanced communication features including Break character transmission/detection and Auto-Baud rate detection for robust communication in systems where baud rates are unknown or need synchronization.

Overview

Microchip UART modules support advanced communication features including Break character transmission/detection and Auto-Baud rate detection. These features enable robust communication in systems where baud rates are unknown or need synchronization, and provide special signaling capabilities for protocol implementations.

Supported Device Families

FamilySeriesBreak SupportAuto-Baud Support
dsPIC30F30F seriesYes (basic)Yes (basic)
dsPIC33F/E/C33F, 33E, 33C seriesYes (standard)Yes (standard)
dsPIC33A33A, 33AK seriesYes (enhanced with configurable detection)Yes (enhanced with overflow detection)
PIC32MK, MZ, MXYesYes
SAME7x, E5x, C2x, D2xDevice-dependentDevice-dependent

Break Character Feature

What is a Break Character?

A Break character is a special UART signal consisting of a continuous low (or high if polarity inverted) state for an extended period - typically 11 to 13 bit times. It’s used for:

  • Communication synchronization and initialization
  • Protocol signaling (LIN, DMX512, etc.)
  • Error recovery and attention signaling
  • Multi-drop bus addressing

Break Transmission

Method 1: Automatic Break (SENDB)

Set the SENDB bit (UxCON[8]) and write any value to UxTXB: U1CON |= 0x0100; // Set SENDB bit U1TXB = 0x00; // Trigger Break transmission (value ignored) // Break (13 bit times) is sent, followed by UxTXB contents

Method 2: Manual Override (BRKOVR)

Use BRKOVR bit (UxCON[9]) for custom-duration Break: U1CON |= 0x0200; // Set BRKOVR - manually drive TX line // TX line driven low (if TXPOL=0) or high (if TXPOL=1) delay_us(break_duration); U1CON &= ~0x0200; // Clear BRKOVR - release TX line

  • TXPOL=0: TX line driven LOW
  • TXPOL=1: TX line driven HIGH
  • Any duration possible (not limited to 13 bit times)

Break Reception/Detection

The UART continuously monitors for Break sequences, even during normal reception:

Detection Modes (RXBIMD bit)

RXBIMDDetection CriteriaRXBKIF Flag Sets When…
0(default)End-of-Break detection
1Start-of-Break detection11th consecutive low bit time detected

Break Interrupt Configuration

Auto-Baud Feature

What is Auto-Baud?

Auto-Baud (Automatic Baud Rate Detection) allows the UART receiver to automatically determine and synchronize to the transmitter’s baud rate without prior configuration. This is essential for:

  • Systems where baud rate is unknown at startup
  • Multi-device communication with varying speeds
  • Plug-and-play serial interfaces
  • LIN bus and other automotive protocols

Auto-Baud Detection Process

Step 1: Transmitter Sends Sync Byte

Transmitter sends 0x55 (binary: 0b01010101) - alternating bit pattern: // Transmitter (known baud rate) U1TXB = 0x55; // Sync byte for auto-baud

Step 2: Receiver Enables Auto-Baud

// Receiver (unknown baud rate) U1CON |= 0x0040; // Set ABDEN bit (UxCON[6]) // UART state machine enters Idle, waiting for Start bit

Step 3: Automatic BRG Calculation

On detecting the Start bit of 0x55, the UART:

  • Counts BRG clock cycles between 5 falling edges (0x55 pattern)
  • Calculates average bit time
  • Writes appropriate value to UxBRG register
  • Clears ABDEN bit (hardware auto-clear)
  • Sets ABDIF flag (UxUIR[6])

Step 4: Completion Handling

Auto-Baud with Break Preamble

The Sync byte (0x55) may optionally be preceded by a Break character for additional synchronization: // Transmitter sequence U1CON |= 0x0100; // Set SENDB U1TXB = 0x55; // Send Break followed by Sync byte

Error Handling: BRG Overflow

If the 5th falling edge is not detected before BRG counter rolls over:

  • ABDOVIF flag (UxSTAT[5]) sets - indicates overflow
  • ABDOVIF cannot be cleared until ABDEN is cleared
  • If ABDOVIE bit (UxSTAT[13]) set → error interrupt generated

Supported Baud Rate Modes

Auto-baud works in both baud rate generation modes:

  • Legacy Mode (CLKMOD=1): Standard BRG calculation
  • Fractional Mode (CLKMOD=0): Enhanced fractional BRG

Register Summary

UxCON (Mode Control Register)

BitNameFunction
6ABDENAuto-Baud Enable (set to start, cleared by hardware when done)
8SENDBSend Break (13-bit Break + UxTXB contents)
9BRKOVRBreak Override (manual TX line control)
11RXBIMDRX Break Interrupt Mode (0=end detect, 1=start detect)
18TXPOLTX Polarity (affects BRKOVR line state)

UxSTAT (Status Register)

BitNameFunction
2RXBKIFRX Break Interrupt Flag (cleared by software)
5ABDOVIFAuto-Baud Overflow Flag (BRG rollover during detection)
10RXBKIERX Break Interrupt Enable
13ABDOVIEAuto-Baud Overflow Interrupt Enable

UxUIR (UART Interrupt Register)

BitNameFunction
2ABDIEAuto-Baud Detection Interrupt Enable
6ABDIFAuto-Baud Detection Interrupt Flag (set when complete)

Application Examples

Example 1: LIN Bus Communication

LIN (Local Interconnect Network) uses Break + Sync pattern:

Example 2: DMX512 Protocol

DMX512 uses Break for frame start signaling: // Send DMX Break (Mark-After-Break timing) U1CON |= 0x0200; // BRKOVR=1 delay_us(88); // Break: 88-1000 μs U1CON &= ~0x0200; // BRKOVR=0 delay_us(8); // MAB: 8-1000 μs U1TXB = 0x00; // Start code

Example 3: Unknown Baud Rate Detection

Configuration in MCHP Blockset

While a dedicated Break/Autobaud block may be available, these features are typically configured through:

  • UART Config block - Auto-baud enable option (device-dependent)
  • Direct register access - Use embedded code blocks for manual configuration
  • S-Function blocks - Custom implementations for protocol-specific needs

Troubleshooting

Auto-Baud Not Working

Problem: ABDEN set but no auto-baud completion.Solutions:

  • Verify transmitter sends exactly 0x55 (alternating bit pattern)
  • Check UART clock source (FUART) is correct
  • Ensure no framing errors (check FERR flag)
  • Verify ABDOVIF flag - if set, BRG rolled over (increase clock speed or lower baud range)

Break Not Detected

Problem: Break sent but RXBKIF never sets.Solutions:

  • Check Break duration ≥11 bit times (use oscilloscope)
  • Verify RXBIMD setting matches detection criteria needed
  • Ensure UART RX pin correctly configured
  • Check line polarity (RXPOL bit if available)

Incorrect Baud Rate After Auto-Baud

Problem: Auto-baud completes but calculated rate is wrong.Solutions:

  • Verify peripheral clock (FCY/FUART) setting
  • Check BRGH and CLKMOD bit settings
  • Ensure Sync byte 0x55 transmitted correctly (verify with logic analyzer)
  • Read UxBRG value after auto-baud to debug calculation
  • [UART Config] - Configure UART module
  • [UART Tx] - Transmit data
  • [UART Rx] - Receive data
  • Device Datasheet - Detailed UART register descriptions
  • LIN 2.2 Specification - LIN protocol implementation
  • DMX512 Standard - DMX protocol timing requirements

See Also

[Communication Blocks] | [UART Config] | Code Generation