Increasing CANbus Baud

Hey guys,

I’m looking to communicate with some CANopen devices (with Electron as a CANmaster), but am having trouble achieving the max baud rate. I’ve got a Photon and Electron talking via a couple of transceivers without any issues at 250k, but if I start the bus at 500k or 1M and try to transmit, I essentially read a consistent square wave with the logic analyzer.

Any thoughts on this? Am I missing something obvious here?

What exactly do you mean by "consistent square wave"?
CAN is a digital signal so square waves are expected.

I don't see anything in the docs suggesting a max of 250k.
They even state:

common baud rates are 50000, 100000, 125000, 250000, 500000, 1000000

2 Likes

Thanks for the quick reply!

That’s also what I took away from the documentation, hence why I’m tapping the community. Square wave wasn’t the correct term; it’s a consistent 1us pulse at ~40kHz.

This is from monitoring a CANopen SDO at 250k.

This is trying to send the same packet with baud set to 1M.

I’ve flashed a number of times times, occasionally changing various things in the program (generally packet contents), but always confirming that it works at 250k and below.

I’m not an expert at this but I am doing some work on extending I2C over a long distance using bus buffers. It could be in your data bus design on the hardware doesn’t support the higher baud rate. I’ve also had issues with driving DotStar LEDs too fast (well not faster than the specification but faster than my hardware could handle). Do you have a schematic or board layout to share?

I’m afraid I don’t have a schematic, but it’s a reasonably simple setup.

On my Electron, I’ve got D1 (CAN_Tx), D2 (CAN_Rx), 3.3V and ground hooked up to the appropriate pins on a TJA1052i CAN transceiver and then CAN+, CAN-, isolated 5V and ground connected to the bus on the other side of that IC. The other device (Photon), is wired identically. The bus line is only ~20cm long and the wires connecting the Particle boards to their respective transceivers are all less than 4cm. These connections have been verified by communicating between the two devices at 250k and below.

These transceivers seem to have no problem working at 1M with a BeagleBone Black, so I’m reluctant to put the blame there. I should also note that I’m monitoring the CAN_Tx pin (D1) on the Particle devices.

Sounds like a reasonable setup. Like I said, I’m no expert. I guess dive into the code rabbit hole. Can you post code?

Interesting images, didnt know about this measuring device. Looks cool!

Anyway back to the point. It indeed makes no sense.
Is it possible to share your code?

Sadly I have no CAN devices to test but I can take a look if I can find something.

Try increasing the sampling speed of your logic analyzer. It looks like you have a Logic16, so take high-speed analog captures as well.

1 Like

I agree with @HEng. The sampling speed seems too slow. The Nyquist theorem states you should sample at no less than twice the frequency of the signal you are sampling. I recommend at least 4 times the frequency. So a 1Mbps signal should be sampled at no less than 4Msps, more if possible.

I am thinking that even if the logic analyzer sampling speed is too low, the messages between the photon and the electron should still get through. That means there must be another problem besides the setup of the logic analyzer.

For comaparison, Carloop (see carloop.io; one of the Carloop founders also works at Particle.) uses the TJA1049T-118. It has no known issues with running at higher speeds.
The main difference between the TJA1052 and the TJA 1049 is the galvanic isolation. I doubt that difference would cause problems at higher speeds.

Take a look at the Carloop v2 circuit design here:

Since your circuit does work at lower speeds, I would suggest looking into your power supply to see that it can keep up and keep good quality power while running the higher speeds. The other possibility is the quality and type of your signal wiring, although this would not be my first guess as the distance is pretty short.

In addition to the datasheet, did you check out the referenced application note?
AH1301 Application Hints - TJA1052i Galvanic Isolated High Speed CAN Transceiver.


I suggest taking a close look at Figure 7 and playing around with capacitors to see if that helps.
Actually, make sure you follow the requirement in section 3.1.1 of the application note.
Also, take a close look at the recommendations in section 3.1.2 of the application note.
Adding those capacitors may help clear up any power supply quality issues when you go higher speeds.

Let us know if that works for you.

1 Like

This is properly terminated at both ends, right?

1 Like

Hey guys, I appreciate the responses! I was slammed at work and then proceeded to hop off the grid to camp for the weekend, so was only just able to try proposed solutions.

I’m embarrassed to admit that I neglected to include a termination resistor on one end of the bus. I added that and the 0.1uF bypass caps on VDD1 and VDD2 and we now seem to be talking at 1Mbps without issue. Still having trouble talking to my CANopen device…but I’ve confirmed the bitrate with the logic analyzer, so it must be the data itself; I’ll figure it out eventually.

Thanks to all who took the time to reply!

2 Likes