Skip to content

eyr1n/RP2040PIO_CAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RP2040PIO_CAN

CAN communication library for RP2040/2350 PIO.

This library was made possible thanks to Kevin O'Connor's PIO-based CAN implementation (https://github.com/KevinOConnor/can2040).

Supported MCUs

  • RP2040
  • RP2350

Getting Started

Setup

#include <RP2040PIO_CAN.h>

void setup() {
  Serial.begin(115200);
  CAN.setRX(4);
  CAN.setTX(5);
  CAN.begin(CanBitRate::BR_1000k);
}

Receive CAN Message

if (CAN.available()) {
  CanMsg msg = CAN.read();
  Serial.println(msg.getStandardId());
}

Transmit CAN Message

CanMsg msg;
msg.id = CanStandardId(0x01);
msg.data_length = 4;
msg.data[0] = 0x23;
msg.data[1] = 0x45;
msg.data[2] = 0x67;
msg.data[3] = 0x89;
CAN.write(msg);

License

GNU General Public License v3.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors