Communication blocks provide serial interfaces for data exchange, sensor connectivity, and network integration. The MPLAB Blockset offers comprehensive support for UART (asynchronous serial), SPI (high-speed synchronous), I2C (multi-master bus), and CAN (automotive/industrial networking) protocols across all Microchip device families.
| Protocol | Block(s) | Speed | Wiring | Best For |
|---|---|---|---|---|
| UART | Config + Tx + Rx | Up to 10 Mbps | 2-wire (TX/RX) | Point-to-point, GPS, Bluetooth, debug console |
| SPI | SPI Master/Slave | Up to 50 Mbps | 4-wire (MOSI/MISO/SCK/CS) | High-speed sensors, displays, SD cards |
| I2C | I2C Master | Up to 1 Mbps | 2-wire (SDA/SCL) | Multi-device bus, EEPROMs, sensors, RTCs |
| CAN | Config + Tx + Rx | Up to 1 Mbps | 2-wire (CAN_H/CAN_L) | Automotive, industrial networks, robust environments |
| Application | Recommended Protocol | Block Choice |
|---|---|---|
| GPS Module | UART | UART_Config + UART_Rx |
| Bluetooth Module | UART | UART_Config + UART_Tx + UART_Rx |
| SD Card Interface | SPI | SPI Master |
| IMU Sensor | SPI or I2C | SPI (fast) or I2C (multi-device) |
| OLED Display | SPI or I2C | SPI (high-speed) or I2C (minimal wiring) |
| EEPROM | I2C | I2C Master |
| Real-Time Clock | I2C | I2C Master |
| Motor Control Network | CAN | CAN_Config + CAN_Tx + CAN_Rx |
| Automotive ECU | CAN | CAN_Config + CAN_Tx + CAN_Rx |
| MATLAB Data Logging | UART | UART_TxMatlab + picgui |
| Device Family | UART | SPI | I2C | CAN |
|---|---|---|---|---|
| dsPIC30F | โ Up to 2 | โ Up to 2 | โ Up to 2 | โ Up to 2 |
| dsPIC33F | โ Up to 2 | โ Up to 2 | โ Up to 2 | โ Up to 2 |
| dsPIC33E | โ Up to 4 | โ Up to 3 | โ Up to 3 | โ Up to 2 |
| dsPIC33C | โ Up to 4 | โ Up to 4 | โ Up to 4 | โ Up to 2 |
| dsPIC33A | โ Up to 4 | โ Up to 4 | โ Up to 4 | โ Up to 2 |
| PIC24 | โ Up to 2 | โ Up to 2 | โ Up to 2 | โ |
| PIC32MK | โ Up to 6 | โ Up to 6 | โ Up to 5 | โ Up to 4 |
| PIC32MZ | โ Up to 6 | โ Up to 6 | โ Up to 5 | โ Up to 4 |
| SAM E5x/D5x | โ Up to 6 | โ Up to 8 | โ Up to 8 | โ CAN FD |
| SAM E7x/S7x/V7x | โ Up to 3 | โ Up to 3 | โ Up to 3 | โ CAN FD (MCAN) |
Note: Actual peripheral count is device-dependent. Consult datasheet for exact numbers.
| Communication Block | dsPIC30F | dsPIC33F | dsPIC33E | dsPIC33C | dsPIC33A | PIC24 | PIC32 | SAM |
|---|---|---|---|---|---|---|---|---|
| UART_Config | โ | โ | โ | โ | โ | โ | โ | โ |
| UART_Tx | โ | โ | โ | โ | โ | โ | โ | โ |
| UART_Rx | โ | โ | โ | โ | โ | โ | โ | โ |
| UART_TxMatlab | โ | โ | โ | โ | โ | โ | โ | โ |
| SPI | โ | โ | โ | โ | โ | โ | โ | โ |
| I2C_Master | โ | โ | โ | โ | โ | โ | โ | โ |
| CAN_Config | โ | โ | โ | โ | โ | โ | โ | โ |
| CAN_Tx | โ | โ | โ | โ | โ | โ | โ | โ |
| CAN_Rx | โ | โ | โ | โ | โ | โ | โ | โ |
Legend: โ Full Support | โ Not Available
Notes:
| Protocol | Max Speed | Wires | Devices per Bus | Complexity | Use Case Priority |
|---|---|---|---|---|---|
| UART | 10 Mbps | 2 | 2 (point-to-point) | ๐ข Straightforward | 1. Debug console 2. GPS/Bluetooth 3. Sensors |
| SPI | 50 Mbps | 4 | Multiple (star) | ๐ก Moderate | 1. High-speed data 2. Displays 3. SD cards |
| I2C | 1 Mbps | 2 | 127 (bus) | ๐ก Moderate | 1. Multi-sensor 2. EEPROM/RTC 3. Low-speed control |
| CAN | 1 Mbps | 2 | 127 (bus) | ๐ด Advanced | 1. Automotive 2. Industrial 3. Noisy environments |
Problem: No data received
Problem: Corrupted data
Problem: No communication
Problem: Data corruption
Problem: No acknowledgment from slave
Problem: Bus hangs or clock stretching
Problem: No messages received
Problem: Bus errors
Related Block Categories:
Application Notes:
Example Projects:
๐ก Quick Selection Guide:
Universal Asynchronous Receiver/Transmitter blocks for serial communication with configurable baud rates, hardware flow control, and interrupt-driven or DMA data transfer.
Read more โController Area Network blocks for robust automotive and industrial communication with configurable filters, masks, and multi-channel message handling.
Read more โBUS I2C MASTER Block The BUS I2C Master block configures and executes I2C (Inter-Integrated Circuit) communication sequences as a bus master. This โฆ
Read more โBUS SPI Block The BUS SPI block configures and executes SPI (Serial Peripheral Interface) communication sequences as either Master or Slave. This โฆ
Read more โ