can-bus

boost::asio over SocketCAN

喜夏-厌秋 提交于 2019-12-05 02:13:44
I was thinking of making use of Boost Asio to read data from a Socket CAN . There's nothing fancy going on in linux/can.h , and the device should behave like the loopback interface, and be used with a raw socket. Looking at the basic_raw_socket interface it seems that I can make use of basic_raw_socket::assign to assign the native socket created with socket( PF_CAN, SOCK_RAW, CAN_RAW ); This is what I have so far namespace can { class CanSocket { public: typedef boost::asio::ip::basic_endpoint<CanSocket> endpoint; typedef boost::asio::ip::basic_resolver_query<CanSocket> resolver_query; typedef

elm327 CAN command to switch headlights pernament ON

不打扰是莪最后的温柔 提交于 2019-12-04 10:01:31
问题 I want to send AT command to switch my headlights pernament ON in Nissan Leaf. It is located in ID 625 0x00 - OFF 0x60 - ON 0x40 - Parking lights ON 0x68 - Headlights & fog lights ON how to change this by sending commands through Terminal Can you help step by step? 回答1: If your Nissan is talking CAN (i.e. your ELM 327 device will reply with a number between 6 and 9 when you send AT DPN ), then you can: AT Z AT E0 AT L1 AT SP 0 0100 AT SH 625 Up to here you have: reset the chipset ( AT Z )

Python threading with queue: how to avoid to use join?

邮差的信 提交于 2019-12-04 06:37:41
问题 I have a scenario with 2 threads: a thread waiting for messages from a socket (embedded in a C library - blocking call is "Barra.ricevi") then putting an element on a queue a thread waiting to get element from the queue and do something Sample code import Barra import Queue import threading posQu = Queue.Queue(maxsize=0) def threadCAN(): while True: canMsg = Barra.ricevi("can0") if canMsg[0] == 'ERR': print (canMsg) else: print ("Enqueued message"), canMsg posQu.put(canMsg) thCan = threading

Socket-CAN virtual bus

痴心易碎 提交于 2019-12-04 05:20:21
How can I create several virtual sockets and link them together to create a virtual bus? I want to simulate an application in which many nodes communicate to each other via CAN. All you need is cangw tool from can-utils . Create two virtual interfaces: ip link add dev vcan0 type vcan ip link add dev vcan1 type vcan ip link set up vcan0 ip link set up vcan1 Create routing rule, so that all packets coming to vcan0 will be sent to vcan1 : cangw -A -s vcan0 -d vcan1 -e Listen to vcan1 in one terminal: candump vcan1 And send packet from another terminal: cansend vcan0 123#0011 You'll see, that

Java and CANopen

荒凉一梦 提交于 2019-12-03 12:04:07
问题 Background I am required to create a Java program on a laptop to receive/send CANopen messages. RJ45 is chosen to be the network's physical medium. I am new to CANopen and Java communications programming. Pardon me if I appear to be uninitiated. The truth is, I have been reading up a lot, but I still do not know how to get started. Questions Other than connecting a PC to the CANbus network, what else does the CAN-PC adapter do? Is it possible to connect the laptop to the CANbus network

Start and run CANoe from Command Prompt

断了今生、忘了曾经 提交于 2019-12-01 19:23:48
Is it possible to start and run Vector CANoe from the Command Prompt and/or by using any other external script? This document tells you how to control CANoe from C++, C# etc. This by making use of the CANoe as a COM Server utilities. http://www.vector.com/portal/medien/cmc/application_notes/AN-AND-1-117_CANoe_CANalyzer_as_a_COM_Server.pdf CANOE simply loads a .cfg configuration file. For jenkins, I am using the Visual Basics script and using this loading perticular configration file. In this was it bypasses the "I accept" and other windows and loads the desired configuration also also using

How to program a simple CANopen layer

梦想与她 提交于 2019-11-30 01:52:22
We have a robot project where the motor controllers use CANopen for communication. I need to communicate with these motor controllers using a master microcontroller. The problem is that I need to develop a CANopen layer in this microcontroller, but I only know how to send and receive at the low level (CAN). I don't know much about the CANopen (PDO, SDO, Heartbeat, object dictionary, etc.). I tried to read the CiA specifications, but it was very complicated. I would appreciate it if someone could point me in the right direction or give me a good tutorial to program a simple CANopen layer. Since

How to create virtual CAN port on linux? (C++)

帅比萌擦擦* 提交于 2019-11-29 23:18:08
I want to create program that would emulate CAN port for testing purposes for another big application. Program should send previously recorded data through this virtual CAN. Anyone has any experience with such thing? I'm thinking to establish virtual COM, and send through it data packed in CAN Frames. Could it work? And how could I establish virtual COM on linux? Found this thread Virtual Serial Port for Linux but sadly I don't get how could it be implemented into source code of program (beginner linux user and programmer under linux). Would love to read your experience and suggestions.

Transmitting data over ISO-TP (transport protocol) in CANoe using CAPL

僤鯓⒐⒋嵵緔 提交于 2019-11-29 12:38:35
Using CAPL with CANoe to transmit big amount of data via ISO-TP on CAN. Is there a routine, that provides the handling of data segmentation embedded in CAPL or do I need to write my own interpretation? Take a look at the OSEK_TP CANoe demo. It shows how to transmit and receive data over ISO-TP ( Transport Protocol, ISO 15765-2 ). See the nodeA.can file and the OSEL_TP API reference for implementation details. Here is minimal example: Create and configure a connection: long handle; handle = CanTpCreateConnection(0); // 0 = Normal mode CanTpSetTxIdentifier(handle, 0x700); // Tx CAN-ID

Flow control message while receiving CAN message with ELM327

三世轮回 提交于 2019-11-29 12:34:08
I am trying to make a software, which runs under Windows and communicates with an ELM327 device. I created the first version and I went in my SMART ForTwo (SMART 451) vehicle and I managed to connect with the Instrument Cluster (Transmit CAN ID is 782, Receive CAN ID is 783). However I have a huge problem with Flow Control. Here is the log: TX: ATI RX: ELM327 v1.5a TX: ATE0 RX: ATE0 OK TX: ATSP6 RX: OK TX: ATH1 RX: OK TX: ATL1 RX: OK TX: ATCFC1 RX: OK TX: ATFCSM0 RX: OK TX: ATAL RX: OK TX: ATSH782 RX: OK TX: ATCRA783 RX: ? TX: ATST64 RX: OK TX: 1092 RX: 783 02 1A 87 TX: 1A87 RX: 783 10 16 5A