Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit Feather M4 Express CAN: Examples, Pinouts, and Specs

Image of Adafruit Feather M4 Express CANDesign with Adafruit Feather M4 Express CAN in Cirkit Designer

Introduction

The Adafruit Feather M4 Express CAN is a versatile and powerful development board that harnesses the capabilities of the ATSAMD51 microcontroller. This board is part of the Feather ecosystem, known for its compact size, portability, and extensive I/O options. The inclusion of CAN-Bus connectivity makes it ideal for automotive applications, industrial automation, and any project where robust serial communication is required. The ARM Cortex-M4 core with a floating-point unit runs at 120 MHz, providing high computational performance for complex tasks.

Explore Projects Built with Adafruit Feather M4 Express CAN

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Adafruit Feather 32u4 Bluefruit with MPR121 Capacitive Touch Sensor Interface: A project utilizing Adafruit Feather M4 Express CAN in a practical application
Adafruit Feather 32u4 Bluefruit with MPR121 Capacitive Touch Sensor Interface

This circuit integrates an Adafruit MPR121 capacitive touch sensor with an Adafruit Feather 32u4 Bluefruit microcontroller. The MPR121 is powered by the 3.3V supply from the Feather and communicates with the microcontroller via I2C, with SCL connected to pin 3 and SDA connected to pin 2 of the Feather. This setup allows the Feather to detect touch inputs from the MPR121 for further processing or wireless communication.

Open Project in Cirkit Designer
Image of Solar-Powered Environmental Data Logger with Adafruit Feather M0 Express: A project utilizing Adafruit Feather M4 Express CAN in a practical application
Solar-Powered Environmental Data Logger with Adafruit Feather M0 Express

This circuit is designed for environmental data collection and logging, utilizing an Adafruit Feather M0 Express microcontroller as the central processing unit. It interfaces with a BME280 sensor for atmospheric temperature, humidity, and pressure measurements, an SGP30 sensor for monitoring air quality (eCO2 and TVOC), and a STEMMA soil sensor for detecting soil moisture and temperature. The system is powered by a solar panel and a 3.7v LiPo battery, managed by an Adafruit BQ24074 Solar-DC-USB Lipo Charger, and provides easy access to the microcontroller's connections through an Adafruit Terminal Breakout FeatherWing.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Function Description
1 GND Ground
2 3V 3.3V power supply output
3 AREF Analog reference voltage for ADC
4-9 A0-A5 Analog input pins
10-15 D5-D10 Digital I/O pins, PWM capable
16-17 SCK, MISO, MOSI SPI communication pins
18-19 SDA, SCL I2C communication pins
20 RX UART receive pin
21 TX UART transmit pin
22 CAN_RX CAN-Bus receive pin
23 CAN_TX CAN-Bus transmit pin

Usage Instructions

How to Use the Component in a Circuit

  1. Powering the Board: Connect a 3.7V LiPo battery to the JST connector for portable applications or supply 5V to the USB or VBUS pin for stationary projects.
  2. Programming: Use the USB interface to program the board with the Arduino IDE or CircuitPython.
  3. Connecting to CAN-Bus: Attach the CAN_H and CAN_L lines from your CAN network to the CAN_RX and CAN_TX pins, respectively.

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

Example Code for Arduino UNO

#include <SPI.h>
#include <mcp_can.h>

// Initialize MCP_CAN instance with SPI CS Pin 10
MCP_CAN CAN0(10);

void setup() {
  Serial.begin(115200);

  // Initialize CAN0 at 500 kbps
  if (CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
    Serial.println("CAN Bus Module Initialized Successfully!");
  } else {
    Serial.println("CAN Bus Module Initialization Failed!");
  }
}

void loop() {
  // Check if data is available to read
  if (CAN0.checkReceive() == CAN_MSGAVAIL) {
    unsigned char len = 0;
    unsigned char buf[8];

    // Read data: len = data length, buf = data byte(s)
    CAN0.readMsgBuf(&len, buf);

    // Print received data
    for (int i = 0; i < len; i++) {
      Serial.print(buf[i], HEX);
      Serial.print(" ");
    }
    Serial.println();
  }
}

Note: This example demonstrates basic CAN-Bus communication using the MCP_CAN library. Ensure that the library is installed in your Arduino IDE before compiling the sketch. Adjust the CS pin number and CAN bus speed according to your specific setup.