Hi everyone,
I’m using a Serial CAN module (GitHub Library) with an Arduino Mega 2560 and running into an issue where the module works fine over SoftwareSerial, but not on any of the hardware serial ports.
The module communicates correctly over SoftwareSerial pins 11 and 10, but when switching to hardware serial (e.g., Serial1, Serial2, Serial3), it doesn’t work.
Checked with an oscilloscope, the module’s TX pin outputs 3.3V logic, and the module is powered via 5V.
Tried a logic level shifter (3.3V → 5V), bit no improvement, Still doesn’t work on hardware serial.
Tried multiple hardware serial ports (Serial1, Serial2, Serial3), None worked.
SoftwareSerial works flawlessly, but I’d prefer to use hardware serial for reliability and performance.
Any ideas why SoftwareSerial works, but hardware serial doesn’t?
#include <Serial_CAN_Module.h>
Serial_CAN can;
void setup() {
Serial.begin(9600);
while(!Serial);
// WORKS WITH SOFTARE SERIAL
can.begin(11, 10, 9600);
// DOESN'T WORK WITH HARDWARE
// can.begin(Serial1, 9600);
if(can.canRate(CAN_RATE_500)) {
Serial.println("set can rate ok");
} else {
Serial.println("set can rate fail");
}
}
void loop() {}
Thanks in advance!