You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't taken a dig into why, but curious if someone can shed some light on this.
Hardware:
ESP32 using the built in CAN transceiver. Using external can PHY chip. Monitoring the TX line straight out of the esp32.
Measurements:
scope - Setting the baud rate as 500kbaud on esp32 results in a single bit width of 250khz.
salae logic analyzer - Setting the baud rate as 500kbaud on esp32, have to set salae logic to 250kbaud to decode packets.
conclusion
It looks like whatever baud is set in can.begin(baud) gets halved. Am I doing something wrong?
#include <Arduino.h>
//https://github.com/sandeepmistry/arduino-CAN/tree/master
#include <CAN.h>
#define rx 26
#define tx 27
void setup() {
Serial.begin(115200);
Serial.println("CAN Sender");
CAN.setPins (rx, tx);
// start the CAN bus at 250 kbps
if (!CAN.begin(500E3)) {
Serial.println("Starting CAN failed!");
while (1);
}
}
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.write('h');
CAN.write('e');
CAN.write('l');
CAN.write('l');
CAN.write('o');
CAN.endPacket();
Serial.println("done");
delay(1000);
// send extended packet: id is 29 bits, packet can contain up to 8 bytes of data
Serial.print("Sending extended packet ... ");
CAN.beginExtendedPacket(0xabcdef);
CAN.write('w');
CAN.write('o');
CAN.write('r');
CAN.write('l');
CAN.write('d');
CAN.endPacket();
Serial.println("done");
delay(1000);
}
The text was updated successfully, but these errors were encountered:
thefatmoop
changed the title
ESP32 actual baud rate is double of the configured
ESP32 actual baud rate is half of the configured
Sep 19, 2024
I haven't taken a dig into why, but curious if someone can shed some light on this.
Hardware:
ESP32 using the built in CAN transceiver. Using external can PHY chip. Monitoring the TX line straight out of the esp32.
Measurements:
scope - Setting the baud rate as 500kbaud on esp32 results in a single bit width of 250khz.
salae logic analyzer - Setting the baud rate as 500kbaud on esp32, have to set salae logic to 250kbaud to decode packets.
conclusion
It looks like whatever baud is set in can.begin(baud) gets halved. Am I doing something wrong?
The text was updated successfully, but these errors were encountered: