{"id":15416957,"url":"https://github.com/blueandi/beaglebone_black_socketcan","last_synced_at":"2025-04-14T14:43:47.571Z","repository":{"id":89190829,"uuid":"125219977","full_name":"BlueAndi/beaglebone_black_socketcan","owner":"BlueAndi","description":"How to get access to the CAN bus on a BeagleBone Black via socketcan interface.","archived":false,"fork":false,"pushed_at":"2018-03-19T22:53:13.000Z","size":2,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T03:41:23.214Z","etag":null,"topics":["beaglebone-black","can-bus","howto","howto-tutorial","socketcan"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlueAndi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-14T13:51:12.000Z","updated_at":"2023-12-23T12:30:04.000Z","dependencies_parsed_at":"2023-06-14T09:00:28.598Z","dependency_job_id":null,"html_url":"https://github.com/BlueAndi/beaglebone_black_socketcan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Fbeaglebone_black_socketcan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Fbeaglebone_black_socketcan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Fbeaglebone_black_socketcan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlueAndi%2Fbeaglebone_black_socketcan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlueAndi","download_url":"https://codeload.github.com/BlueAndi/beaglebone_black_socketcan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248898754,"owners_count":21179832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beaglebone-black","can-bus","howto","howto-tutorial","socketcan"],"created_at":"2024-10-01T17:14:18.716Z","updated_at":"2025-04-14T14:43:47.539Z","avatar_url":"https://github.com/BlueAndi.png","language":null,"readme":"[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)\r\n\r\n# BeagleBone Black CAN bus communication via socketcan\r\nThis tutorial is based on a Debian Stretch distribution from 2017-12-12 on the Beaglebone Black. The description is independent of the used CAN cape.\r\nI used this CAN cape: [BeagleBone Serial Cape from Logic Supply](http://www.logicsupply.com/de-de/cbb-serial)\r\n\r\n## Setup Debian image\r\n* Download latest BeagleBone Black image from [BeagleBone Images](https://beagleboard.org/latest-images), e.g. the Debian Stretch IoT (non-GUI).\r\n* Following the [software update guide](https://beagleboard.org/getting-started#update).\r\n  * For short: Program image to the sd card by using a sd card programming utility.\r\n  * Hold the user/reset button pressed, while powering the board.\r\n* Connect to the BeagleBone Black via ssh.\r\n  * hostname: **beaglebone**\r\n  * user: **debian**\r\n  * password: **temppwd**\r\n* Next important step is to change the password via ```passwd```.\r\n* Update the packages: ```sudo apt-get update```\r\n* Upgrade the distribution: ```sudo apt-get upgrade```\r\n\r\n## SocketCAN drivers\r\nThe BeagleBone should already have the SocketCAN drivers installed, so to use the CAN bus you just need to set the bitrate 125 kBit/s and bring up the CAN0 interface with:\r\n```\r\nsudo ip link set can0 up type can bitrate 125000\r\nifconfig\r\n```\r\nYou should see now the can0 interface, similar as shown in the following example.\r\n```\r\ncan0: flags=193\u003cUP,RUNNING,NOARP\u003e  mtu 16\r\n        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)\r\n        RX packets 0  bytes 0 (0.0 B)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 0  bytes 0 (0.0 B)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n        device interrupt 166\r\n```\r\n## CAN utilities\r\nif ```candump``` is not available, it looks like the CAN utilities are not installed. In this case follow the instructions, otherwise just skip this chapter.\r\n* ```git clone https://github.com/linux-can/can-utils```\r\n* ```cd can-utils```\r\n* ```apt-get install automake```\r\n* ```./autogen.sh```\r\n* ```./configure```\r\n* ```make```\r\n* ```make install```\r\n\r\n## Network interface\r\n* Update the network interface for CAN, to start it automatically during startup: ```sudo nano /etc/network/interfaces```\r\n* Add the following at the end:\r\n```\r\nallow-hotplug can0\r\niface can0 can static\r\n    bitrate 125000\r\n```\r\n\r\n## Test\r\nTo test whether its working or not, lets dump all CAN messages to the console: ```candump can0```\r\nAbort it with strg + c.\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Fbeaglebone_black_socketcan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueandi%2Fbeaglebone_black_socketcan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueandi%2Fbeaglebone_black_socketcan/lists"}