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.
| Family | Series | Break Support | Auto-Baud Support |
|---|---|---|---|
| dsPIC30F | 30F series | Yes (basic) | Yes (basic) |
| dsPIC33F/E/C | 33F, 33E, 33C series | Yes (standard) | Yes (standard) |
| dsPIC33A | 33A, 33AK series | Yes (enhanced with configurable detection) | Yes (enhanced with overflow detection) |
| PIC32 | MK, MZ, MX | Yes | Yes |
| SAM | E7x, E5x, C2x, D2x | Device-dependent | Device-dependent |
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:
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
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
The UART continuously monitors for Break sequences, even during normal reception:
| RXBIMD | Detection Criteria | RXBKIF Flag Sets When… |
|---|---|---|
| 0 | (default) | End-of-Break detection |
| 1 | Start-of-Break detection | 11th consecutive low bit time detected |
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:
Transmitter sends 0x55 (binary: 0b01010101) - alternating bit pattern:
// Transmitter (known baud rate) U1TXB = 0x55; // Sync byte for auto-baud
// Receiver (unknown baud rate) U1CON |= 0x0040; // Set ABDEN bit (UxCON[6]) // UART state machine enters Idle, waiting for Start bit
On detecting the Start bit of 0x55, the UART:
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
If the 5th falling edge is not detected before BRG counter rolls over:
Auto-baud works in both baud rate generation modes:
| Bit | Name | Function |
|---|---|---|
| 6 | ABDEN | Auto-Baud Enable (set to start, cleared by hardware when done) |
| 8 | SENDB | Send Break (13-bit Break + UxTXB contents) |
| 9 | BRKOVR | Break Override (manual TX line control) |
| 11 | RXBIMD | RX Break Interrupt Mode (0=end detect, 1=start detect) |
| 18 | TXPOL | TX Polarity (affects BRKOVR line state) |
| Bit | Name | Function |
|---|---|---|
| 2 | RXBKIF | RX Break Interrupt Flag (cleared by software) |
| 5 | ABDOVIF | Auto-Baud Overflow Flag (BRG rollover during detection) |
| 10 | RXBKIE | RX Break Interrupt Enable |
| 13 | ABDOVIE | Auto-Baud Overflow Interrupt Enable |
| Bit | Name | Function |
|---|---|---|
| 2 | ABDIE | Auto-Baud Detection Interrupt Enable |
| 6 | ABDIF | Auto-Baud Detection Interrupt Flag (set when complete) |
LIN (Local Interconnect Network) uses Break + Sync pattern:
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
While a dedicated Break/Autobaud block may be available, these features are typically configured through:
Problem: ABDEN set but no auto-baud completion.Solutions:
Problem: Break sent but RXBKIF never sets.Solutions:
Problem: Auto-baud completes but calculated rate is wrong.Solutions:
[Communication Blocks] | [UART Config] | Code Generation