can-bus

How to write a CanOpen stack?

久未见 提交于 2020-01-02 20:03:28
问题 I have a similar problem with this. How to program a simple CANopen layer . I read the answers but I have to program a CANopen layer on my own I cannot get a commercial one. So are there any basics of writing a CANopen stack (or layer I'm not certain about the difference)? I don't know even where to start.. If it's required here's some information : My master device is a beagle bone black with QNX. QNX has a generic CAN library I think but not specific to CANopen. And my slave is a

Synchronizing different messages

巧了我就是萌 提交于 2019-12-25 17:48:24
问题 I think it's a general software paradigm problem, so it's not related that much to embedded software. I have 3 Messages that I get at different time slices, the three messages are Odo, velocity, gps. each one has timeslice 20ms, 1sec, and 1sec. My problem is how would I sync and get a complete message only when the three are already fetched. My current approach is to have three circural queues, and put three boolean variables and check if they are all in sync, but that doesn't work if for

CAN bus arbitration backoff time

丶灬走出姿态 提交于 2019-12-25 09:38:06
问题 I am aware of the way CAN bus does its arbitration. In a nutshell the CAN node ID having more '0' 's in its indentifier wins the rite to transmit on the bus and the rest of contending nodes back off. But i dont find any details of how long the backed out node waits before re-trying to win the bus back. I consulted a few sources but still cant find the answer. Any experimental evidence for this ? Bosch CAN Introduction to the Controller Area Network 回答1: It is free to try again after the

Is it possible to generate CAN message in one device and dump CAN message in another device using SocketCAN?

﹥>﹥吖頭↗ 提交于 2019-12-25 00:38:34
问题 I am using SocketCAN and CANtact toolkit to send and receive CAN message. I am using two CANtact toolkits one to send CAN message and other to receive the CAN message both the CANtact toolkits are connected by DB9 female to DB9 female and the other ends are connected to the USB port of the laptop. I used the following SocketCAN commands to first configure them sudo modprobe can sudo modprobe can_raw sudo modprobe slcan sudo slcand -o -s6 -t hw -S 3000000 /dev/ttyACM0 slcan0 sudo ip link set

RAW CAN decoding

懵懂的女人 提交于 2019-12-24 22:18:24
问题 I'm trying to import CAN data using a virtual CAN network and am getting strange results when I unpack my CAN packet of data. I'm using Python 3.3.7 Code: import socket, sys, struct sock = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) interface = "vcan0" try: sock.bind((interface,)) except OSError: sys.stderr.write("Could not bind to interface '%s'\n" % interface) fmt = "<IB3x8s" while True: can_pkt = sock.recv(16) can_id, length, data = struct.unpack(fmt, can_pkt) can_id &=

Understanding the CAN filters

帅比萌擦擦* 提交于 2019-12-14 04:09:00
问题 I am unable to understand the CAN filter configuration for the stm32f4-discovery. CAN_FilterInitStructure.CAN_FilterNumber = 0; CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask; CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit; CAN_FilterInitStructure.CAN_FilterIdHigh = 0x0000; CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000; CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x0000; CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000; CAN_FilterInitStructure.CAN

Sending Periodic CAN signals on button press using CAPL and CANalyzer

我只是一个虾纸丫 提交于 2019-12-13 20:21:30
问题 I am trying to send a set of CAN frames on to CAN bus. I am using CAPL to program and CANalyzer8.5 to simulate and Panel designer to create a button. My requirement is to first create a button using PANEL designer. Only on button press it should start sending periodic CAN frames on to the bus. I am a bit confused as to how to achieve it. So far I have managed to write two separate programs using CAPL. First program sends data at start periodically. Second code sends data only once when the

Trying to receive data over Python CAN

北城余情 提交于 2019-12-13 04:26:29
问题 I am trying to receive data over a CAN bus. I am sending data from my windows laptop over to a raspberry pi. For some reason, the python script on the raspberry pi just hangs endlessly and it does not display the message. I have taken the sample code from the canard docs, but I have no luck. Code to receive: """Connect to CANable; print and echo any received frames""" from canard import can from canard.hw import cantact dev = cantact.CantactDev("/dev/ttyACM0") # Connect to CANable that

CAN bus communication with System.Net.Sockets

邮差的信 提交于 2019-12-12 01:47:08
问题 I want to convert some C/C++ code to C# so that I can use it on Linux with MONO instead of using a DLLImport with a *.so. It seems that System.Net.Sockets doesn't support CAN-bus communication but I'm not sure if that means we cannot solve it anyway!? // Create a socket with the CAN-protocol. int _canSocket = socket(PF_CAN, SOCK_RAW, CAN_RAW); // Get current flags for the socket and add non-blocking to it. int flags = fcntl(_canSocket, F_GETFL, 0); fcntl(_canSocket, F_SETFL, flags | O

convert from hex to decimal Arduino

拜拜、爱过 提交于 2019-12-11 18:41:17
问题 I am extracting the weight of a Reach Stacker , for the moment this is my result : get data from ID: 18FFF227 2 1 F0 3C 0 0 1 0 what I need is to take F0 3C 0 0 and change it to 0 0 3C F0 then convert it to number to decimal. 003CF0 = 15600 according to this page: enter link description here this would be my number in decimal 15600 this my code : #include <SPI.h> #include "mcp_can.h" #include <SoftwareSerial.h> SoftwareSerial mySerial (3,2); // the cs pin of the version after v1.1 is default