Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 9 months ago.
CAN is only working on CAN Low not High
Hello,
I have 2 C027 boards and worked the last week on activating the CAN Module and sending messages from one to another.
Communication is working, and messages are transfered.
Using a digital Oszilloscope, I tried to read the messages, and saw that only the CAN/L actually has the signals on it. CAN/H is high and has no signals on it
I tried it on both C027, and both show the same behaviour.
Any suggestions, or anything I have to switch around?
The Setup in the main routine for the CANS Signal is:
DigitalOut can_standby(CANS); can1.frequency(500000); can1.mode(CAN::Normal); can_standby = 0;
Question relating to:
1 Answer
8 years, 9 months ago.
Hi Slawomir,
As Andy said, please make sure you are measuring signals on the right pins (outer pins of the green CAN connector).
Can H/L signals are differential, both signals have to move accordingly. In case of high speed can you should also add the termination resistors 120ohm to match the nominal impedance of the cable. Some info on that: http://www.ni.com/white-paper/9759/en/
I have made a trial run with the same setup as you, 2xC027 boards and the code:
can test
static CAN can(CANRD, CANTD); DigitalOut canS(CANS); can.frequency(500000); canS = 0; CANMessage canTx(0xB5, "Nebo pozdrav", 8); // sending test string here CANMessage canRx;
... and it works fine for me.
Here is a snapshot from my scope: You should have something similar on yours if you're measuring the right signals..
Hope this helps, Jaka
Driving the two lines is up to the CAN driver IC, nothing to do with the software or CPU. The only thing that could cause that would be a hardware issue or being connected to another device incorrectly.
Silly question but you're sure you're looking at the correct pins? The two ends of the 3 pin CAN header.
posted by Andy A 26 Jan 2016I am looking at the right pins. Actually I can see the other signal too. I doublechecked the analog Signals, and can low lies between 1 and 2.5 V, whereas Can H is between 2.5 and 4V. Therefore I just have to figure out how to reset the ground between units. Thanks for the information though.
posted by Slawomir Suchy 27 Jan 2016That sounds about right. Idle is both at 2.5, active is CAN low at a low voltage, CAN high at a high voltage. The spec requires at least a 1.5V difference when active, you've got 3V. Since it's a differential signal the ground between the two units isn't that important for CAN, as long as it's within a few volts everything will work fine.
posted by Andy A 27 Jan 2016