I'm testing the CAN peripheral on a BeagleBone.
The other device on the CAN BUS, playing the communication partner role, is a Microchip CAN BUS Analyser.
Like most microcontrollers that have a CAN peripheral on board, the Sitara on the BeagleBone doesn't have a physical bus driver.
That's something that needs to be implemented separately.
The CAN driver breakout board I made for an e14 roadtest uses a driver IC.
The CAN Bus analyser from Microchip uses their own (this family is used in several Arduino shields).
Check Thomas' blog to see how the driver connects to the BeagleBone.
Test the CAN Bus
Take care that everything is wired up before starting the exercise. The driver has to be connected to the BeagleBone and to a functional CAN bus.
If your device isn't connected to a bus, not a lot will happen physically.
My "functional CAN Bus" is a single Microchip CAN Bus analyser. But any physically correct circuit will work, as long as the voltage levels are compatible with the CAN driver you use.
On a BB Black or Green, the controller side CAN Rx is on P9.24 and CAN Tx on P9.26.
Once everything is wired, there are 3 activities:
1. Set the BeagleBone pins to CAN function
There are several ways to do that permanently. Thomas' article is very good, check there.
For this exercise, I chose to assign them to CAN function temporary, with the config-pin utility.
sudo config-pin p9.24 can sudo config-pin p9.26 can
2. Enable the Linux interface
CAN is implemented as a network in Linux. You use similar utilities as when defining a TCP/IP network.
sudo ip link set can1 up type can bitrate 125000 sudo ifconfig can1 up
Again, Thomas' instructions describe a way to do this permanently.
3. Send and Receive Data
The BeagleBone has Linux CAN utilities installed by default these days.
These can be used to try out the CAN network from the BB side. Both for sending and receiving traffic.
You'll need to have something on the bus to play the other role. In this case I used the Microchip analyser. An Arduino MKR with a MKR CAN shield and example sketches works equally well.
cansend can1 5A1#00.01.02.03.04 candump can1
The Logic and Physical Layer Signals
While doing this exercise, I captured some data on both sides of the BB driver.
The logic level has TX and RX signals separate. Both 3.3V logic signals. The physical layer is differential.
|CAN data: logic layer - Tx and Rx line||CAN data: physical layer - differential CAN signal|
I probed the HI and LO with a differential probe.