Skip to content

Fix DLC=0 IRQ handling#6

Open
caternuson wants to merge 2 commits intoadafruit:mainfrom
caternuson:iss4
Open

Fix DLC=0 IRQ handling#6
caternuson wants to merge 2 commits intoadafruit:mainfrom
caternuson:iss4

Conversation

@caternuson
Copy link
Copy Markdown
Contributor

Possible simple fix for #4.

Also fixes the onreceive example which was missing some config pin setup.

This was tested using two Feather M4 CAN's.

This was the DLC=0 TX test sketch:

#include <CANSAME5x.h>

CANSAME5x CAN;

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10);

  Serial.println("CAN Sender with DLC=0 packets");

  pinMode(PIN_CAN_STANDBY, OUTPUT);
  digitalWrite(PIN_CAN_STANDBY, false); // turn off STANDBY
  pinMode(PIN_CAN_BOOSTEN, OUTPUT);
  digitalWrite(PIN_CAN_BOOSTEN, true); // turn on booster

  // start the CAN bus at 250 kbps
  if (!CAN.begin(250000)) {
    Serial.println("Starting CAN failed!");
    while (1) delay(10);
  }
  Serial.println("Starting CAN!");
}

void loop() {
  // send packet: id is 11 bits, packet can contain up to 8 bytes of data
  Serial.print("Sending packet ... ");

  CAN.beginPacket(0x12);
  CAN.endPacket();

  Serial.println("done");

  delay(1000);
}

The RX test sketch was the feather_m4can_onreceive example, with the mods from this PR.
RX BEFORE
Screenshot from 2024-05-16 07-14-58

RX AFTER
Screenshot from 2024-05-16 07-15-29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant