CAN project

I am starting working with the BBB in order it receive and send CAN messages in a University project that I`m developing. I have read a lot and a few questions are still confusing me.

  1. In the project I plan to make my own cape and as far as I understood the BBB has native CAN, so I would have only to add the transceiver to my cape and the other necessary stuff. Right?
  2. I am confused where the SocketCAN comes in. Do I have to enable CAN in my BBB or SocketCAN already does that? Or is it above another layer that takes care of the hardware part?
    Thanks in advance for your time

Dear Pedro,

I’m also working at this and I understand your confusion. :slight_smile:

@1.) I think so yes. Just a transceiver IC. I have just ordered one from TI (SN65HVD231D; you can get free samples for your project for sure :slight_smile: ). See also this:
https://groups.google.com/d/msg/beagleboard/2IGpEQYI7l4/Zum5rVkYrUYJ

@2.) There are two CAN interfaces available in general. But to use them you first must enable them (set the pinmux). This can be done by using the DTC (device tree compiler). Follow the following link to get more information

e.g. Check: https://groups.google.com/d/msg/beagleboard/IAkyHQOp8VA/HIya1-nTO6cJ
→ You can use the device tree compiler to generate DTB file which than will be used to enable the can interface you need.

[Do you know which kernel version you will use/need? If you are independent I suggest to use 3.19 form Robert Nelson and also the DTC compiler. Enabling the CAN interface will be easy then.]

After compiling and installing the DTB files you can run ‘ifconfig -a’ and the can0 interface will (hopefully) show up.

Best regards,
Marco

PS.: We are really working on the same thing here. Maybe we can support each other here. What do you think?

Hi Marco,

I’m working with on this. We are using the last Arch Linux for BBB.
We found this solution to compile the dtb as you said. We will try this on the next few hours.

Where We can get the image for 3.19 from Robert ? Or we need to clone and build ?

About support each other: Pedro, it’s better to answer you. I’m just helping him to get the project working. :slight_smile:

Thanks

Hey Marco,
I dont see any problems for us to help each other, in fact thats a great idea!
I tried to set can using socketcan via ubuntu 14.04 booting from the sd card and it appeared to me that it worked, but I haven`t done my cape yet, only the schematics.

Hi Pedro,

sounds great. Congrats!

It’s the same for me … there is no cape yet. I want to have some more functionalities on the cape/PCB. So it will me take some time till I have it and can test the CAN connection. But I will inform you about my results.

Do you already know which transceiver you are going to use in your project?

Best regards,

Marco

I am using the mcp2551, the same used in shields fos RPI and Arduino, so it`s easier to find one. Which kind of extra functionalities are thinking of?

Best Regards

Hi,
I also started a project using CAN on BBB. I am surprized how many people work at the same time for same topic :slight_smile:
I succesfully implemented it by following this page: http://www.koervernet.de/hausautomatisierung/97-beaglebone
I have ISO1050 from TI as CAN Transciever.
Because it is in german, I try to summirize all.

  1. CAN2 can not be used directly because it is muxed with other Bus I2C. Therefore CAN1 is activated but since it is the “first” activated CAN interface, we will speak with it as CAN0 in linux.
  2. Compile device tree source using this command: dtc -O dtb -o BB-DCAN1-00A0.dtbo -b 0 -@ BB-DCAN1-00A0.dts . You can download that file from that page.
  3. Copy the dtbo file into /lib/firmware using this command: sudo cp BB-DCAN1-00A0.dtbo /lib/firmware
  4. Load it: sudo modprobe can, sudo modprobe can-dev, sudo modprobe can-raw
  5. Activate it: echo BB-DCAN1 > /sys/devices/bone_capemgr.*/slots
  6. Start it with 125kBit/s: sudo ip link set can0 up type can bitrate 125000, sudo ifconfig can0 up
  7. Check if it is up: sudo ifconfig, in the first place you should see the can0 interface.
  8. Install SocketCAN if you don’t have: svn co svn://svn.berlios.de/socketcan/trunk, cd trunk/can-utils/, make, cd /home/socketcan/trunk/can-utils/
  9. Now you can send with cansend: ./cansend can0 5A1#1.2.3.4.5
  10. You can dump can network: ./candump can0

I hope this helps you.

Regards.

Dear Pedro,

I will use my BBB to connect it to the OBD interface as well as with an 802.15.4 WSN. So I will need a simple voltage conversion 12V vehicle battery → 5V BBB, the integration of an OBD controller ,and an interface to my WSN. Nothing really complex but I won’t be able to have it before the 20 of February (because I’m on vacation for the next 3 weeks :slight_smile: )

What are your plans?

Best regards,
Marco

Hi,
first of all we were able to enable the CAN bus on the Arch Linux and now it seems that it’s working. I will start building the cape to test it. If you are interested in using CAN in the Arch Linux, I can explain it to you!
Second, my project is all about getting CAN data and sending it via Wifi and I need a range of something like 1 km cause I’m building a telemetry system for the FSAE electric competition. I had thought to use a router to send this data via TCP/IP since the SocketCAN abstracts the CAN data as it were just another TCP/IP socket. However, this consumes a lot of power and it could become a problem. Do you have any other ideas for this issue?
Thanks in advance once again