AustinECEStudent
Active member
However pcan view now shows no signs of anything
Was this ran with my code. I am using theFirst your code doesn't compile. You need to add:
uint8_t count;
Just comment out
msg.flags.fd = 1;
As can3 is already has CAN FD.
On PCAN-View you should see something like this:
View attachment 35815
With your error on PCAN-View, it could be your wiring to the CAN transceiver is not right.
Which CAN transceiver are you using ? Is it CAN FD compliant ?
Post a photo of your setup.
Yes I have closed them. What does that do though? Also before I purchase a CAN FD transreceiver can I test if can 2 or can 1 works with the current setup. Also do I need termination resistors or does the transreceivers with the closed header pins work as termination resistors ?Have you closed the terminator header pins on the CAN transceiver board ?
The SN65HVD230 is not CAN FD compliant.
You need to use a CAN FD compliant transceiver such as the MCP2562FD chip.
Yes I have closed them. What does that do though? Also before I purchase a CAN FD transreceiver can I test if can 2 or can 1 works with the current setup. Also do I need termination resistors or does the transreceivers with the closed header pins work as termination resistors ?
#include <FlexCAN.h> // Teensy 4.1 supports FlexCAN
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> can; // Set up CAN3 for standard CAN
void setup() {
Serial.begin(9600);
while (!Serial) delay(100);
// Initialize CAN3 (standard CAN with a baud rate of 500kbps)
can.begin();
can.setBaudRate(500000);
// Optional: Print a message to the serial monitor when setup is complete
Serial.println("CAN initialized (standard CAN)");
// Set up a sample CAN message
CAN_message_t msg;
msg.id = 0x123; // Example message ID
msg.len = 8; // Standard CAN supports up to 8 bytes of data
msg.buf[0] = 0x11;
msg.buf[1] = 0x22;
msg.buf[2] = 0x33;
msg.buf[3] = 0x44;
msg.buf[4] = 0x55;
msg.buf[5] = 0x66;
msg.buf[6] = 0x77;
msg.buf[7] = 0x88;
// Send the CAN message
if (can.write(msg)) {
Serial.println("CAN message sent successfully!");
} else {
Serial.println("Error sending CAN message");
}
}
void loop() {
// Add logic to send CAN messages periodically or based on other triggers
delay(1000); // Delay for 1 second between message sends
}
By closing the CAN transceiver does that act as a terminating resistor?Info on CAN termination:
SSZTB40 Technical article | TI.com
Why Are Termination Networks in CAN Transceivers So Important?www.ti.com
Best to keep using the FlexCAN_T4.h and not FlexCAN.h
Your code will then work as Classic CAN on can3 with the SN65HVD230 transceiver.
Maybe. It depends on the board.By closing the CAN transceiver does that act as a terminating resistor?
Also you were right. The SN65HVD230 can transceiver works just for CAN. Do you know any can Fd applicable transceiver ?Maybe. It depends on the board.
If in doubt check. With everything powered off measure the resistance between CAN high and CAN low. If it is over 120 ohms add a 120 ohm resistor between the two lines.
CAN termination is ideally 120 ohms at each end of the bus (so 60 ohms at DC) but unless you are pushing the speed / wire length limits it is generally fairly forgiving, for a short link at 500k you should be fine with a single termination resistor placed anywhere on the bus.
There are many.Also you were right. The SN65HVD230 can transceiver works just for CAN. Do you know any can Fd applicable transceiver ?
I was considering the MCP2562FD and realized it requires an external power source since it operates at 5V, whereas the previous transceiver was powered directly by the 3.3V from the Teensy. For my setup, which includes the Teensy 4.1, a PCAN FD cable, and the MCP2562FD, would I need external terminating resistors? Are there any other components or configurations required for this specific setup?There are many.
MCP2562FD
TJA1442
SN65HVD266
The thing with transceivers is that you buy one that meets your criteria and there are many to choose from. So, you should know what you want then go looking for a part that matches.
Chances are these are the questions you should be asking
1. What voltage transceiver do I need? (3.3v or 5v would be the common choices). Generally this matches your CPU voltage
2. How fast do I need it to be? The general answer is that 5Mb/s is fast enough but technically CAN-FD can go all the way to 8Mb/s
3. Do I need galvanic isolation? These transceivers exist but then you also need an isolated power supply and everything gets more complicated. But, as a bonus, it entirely isolates your MCU from the incoming CAN signals so things on the CAN bus won't likely fry your MCU and you can interface even with high voltage motor controllers without worry
But, unless you're doing something special, probably just use the MCP2562FD which is well known.
If you get the chip then yes, you will need a terminating resistor.I was considering the MCP2562FD and realized it requires an external power source since it operates at 5V, whereas the previous transceiver was powered directly by the 3.3V from the Teensy. For my setup, which includes the Teensy 4.1, a PCAN FD cable, and the MCP2562FD, would I need external terminating resistors? Are there any other components or configurations required for this specific setup?