J2534 drivers for various Macchina hardware

Overview

Macchina-J2534

J2534 drivers for various Macchina hardware

This is a experimental driver which is built in Rust, and is unofficially ported to Linux and OSX as well as Windows.

The Linux and OSX port can be utilized by OpenVehicleDiag

Demo videos

Odysee Youtube

Feature matrix

- Feature is not supported by the adapter

TODO - Feature is supported by the adapter, but work is needed on the driver side in order to utilize it

- Feature works, however some parts of the full implementation are missing, so some bugs might exist

✔️ - Feature works fully according to the J2534 specification

J2534 feature M2 UTD A0
Read battery voltage ✔️ ✔️
Read programming voltage
ISO-TP ✔️ ✔️
CAN
ISO9141 WIP
ISO14230-4 WIP
J1850PWM TODO
J1850VPW TODO
SCI

How to install

The process is generally the same for all supported hardware.

Requirments

Important information for windows users

You will need to install the i686-pc-windows-msvc toolchain!

$ rustup run stable-i686-pc-windows-msvc

Linux users

You need to install libudev-dev prior to building!

Installing the driver on Windows

  1. Create the directory C:\Program Files (x86)\macchina\passthru\
  2. Give the created passthru directory write permissions for your user account
  3. From the repositories driver folder, run build.bat. This will compile and install the drive
  4. Depending on your hardware, either open driver_m2.reg or driver_a0.reg, and modify the COM-PORT attribute in the reg file to match that of your adapter as listed in device manager
  5. Merge the driver.reg file with the Windows registry

Installing the driver on Linux and OSX

  1. Create the directory ~/.passthru/
  2. From the repositories driver folder, run build.sh
  3. In your ~/.passthru/ folder, you will find 2 JSON files. One for the M2 (macchina_m2.json) and one for the A0 (macchina_a0.reg). Change the COM-PORT attribute in the JSON to match that of your TTY port your adapter uses.

Installing the adapter firmware

  1. Install FlexLED and esp32_can libraries (instructions are on the repo links)
  2. be sure you have read the setting up docs for your relivent adapter on Macchina's website here for the A0 or here for the M2.
  3. Open the firmware folder in Arduino IDE
  4. Modify MACCHINA_CONFIG.h, such that the file looks like the following depending on your target device:

For A0

//#define CFG_MACCHINA_M2
#define CFG_MACCHINA_A0
//#define CFG_MACCHINA_ESP32_TEST

For M2

#define CFG_MACCHINA_M2
//#define CFG_MACCHINA_A0
//#define CFG_MACCHINA_ESP32_TEST
  1. Upload the sketch to your target board and enjoy! On both the A0 and M2, a red LED will be activated upon successful upload. This means the adapter is ready to be used!
Issues
  •  usize = 8192 to 4096/512

    usize = 8192 to 4096/512

    hi, ccan change PCOMM frame size ?, to 512 or 4096 bytes. to get faster communication.

    see: simple receive CAN frame 8bytes, send to PCCOMM 8192 bytes.

    I changed the value in firmware and driver, but it didn't work.

    thanks, Carlos.

    opened by autoprog 3
  • channel.cpp compile error

    channel.cpp compile error

    channel.cpp:36:20: error: #if with no expression
     #if CFG_MACCHINA_M2
                        ^
    exit status 1
    #if with no expression
    
    

    This is my MACCHINA_CONFIG.H:

    #ifndef MACCHINA_CONFIG_H_
    #define MACCHINA_CONFIG_H_
    
    //#define FW_TEST
    
    
    #define CFG_MACCHINA_M2
    //#define CFG_MACCHINA_A0
    //#define CFG_MACCHINA_ESP32_TEST
    
    #endif
    

    (on Windows 10-64)

    opened by exekutive 3
  • How to test dll c#

    How to test dll c#

    hi, compiling Firmware.ino = ok, test PCOMM ok (usb) compiling driver = ok on vscode macchina_pt_driver.dll =ok

    how to test dll with c# [ loader dll ] or other way

    thanks, Carlos

    opened by autoprog 2
  • ISO15765 not receive in PC

    ISO15765 not receive in PC

    hi, CAN test setup, send/recv frame =ok ISO15765 setup ok, get vin ok in hw.

    problems, programa on pc not receive frama can iso.

    see log serial: leg- END= pc cmd, LOD= log send to pc, CAN = frame CAN.

    00 aa 01 00 01 45 4e 44 0d 0a 02 02 10 00 00 00 .ª...END........ 00 00 06 00 00 00 20 a1 07 00 00 00 00 00 45 4e ...... ¡......EN 44 0d 0a 00 01 16 00 53 74 61 6e 64 61 72 64 20 D......Standard 43 41 4e 20 64 65 74 65 63 74 65 64 21 20 4c 4f CAN detected! LO 47 0d 0a 00 01 22 00 4e 6f 72 6d 61 6c 20 49 53 G....".Normal IS 4f 2d 54 50 20 41 64 64 72 65 73 73 69 6e 67 20 O-TP Addressing 64 65 74 65 63 74 65 64 21 20 4c 4f 47 0d 0a 03 detected! LOG... 04 24 00 00 00 00 00 00 00 00 00 03 00 00 00 04 .$.............. 00 00 00 04 00 00 00 04 00 00 00 00 00 ff ff 00 .............ÿÿ. 00 07 e8 00 00 07 e0 45 4e 44 0d 0a 04 06 0e 00 ..è...àEND...... 00 00 00 00 40 00 00 00 00 00 07 df 09 02 45 4e [email protected]ß..EN 44 0d 0a 00 07 09 00 00 01 00 00 00 00 00 07 df D..............ß 20 43 41 4e 0d 0a 00 07 09 00 00 02 00 00 00 00 CAN............ 00 07 e8 20 43 41 4e 0d 0a 00 07 1d 00 00 00 00 ..è CAN......... 00 00 00 00 07 e8 49 02 01 39 42 57 44 42 34 35 .....èI..9BWDB45 55 34 45 54 30 39 38 37 36 35 20 43 41 4e 0d 0a U4ET098765 CAN..

    [ log can bus data: 3-frame 0x7E8 and 1-frame 0x7E0 ]

    [00]ª[01][00][01]END [02][02][10][00][00][00][00][00][06][00][00][00] ¡[07][00][00][00][00][00]END [00][01][16][00]Standard CAN detected! LOG [00][01]"[00]Normal ISO-TP Addressing detected! LOG [03][04]$[00][00][00][00][00][00][00][00][00][03][00][00][00][04][00][00][00][04][00][00][00][04][00][00][00][00][00]ÿÿ[00][00][07]è[00][00][07]àEND [04][06][0E][00][00][00][00][00]@[00][00][00][00][00][07]ß [02]END [00][07] [00][00][01][00][00][00][00][00][07]ß CAN [00][07] [00][00][02][00][00][00][00][00][07]è CAN [00][07][1D][00][00][00][00][00][00][00][00][07]èI[02][01]9BWDB45U4ET098765 CAN

    read vin = 9BWDB45U4ET098765 send to pc ok

    in programa, received rxMsgs.Count = 3 frame ( void , zero bytes )

    thanks, Carlos.

    opened by autoprog 1
  • Fix URL reference to OpenVehicleDiag repo.

    Fix URL reference to OpenVehicleDiag repo.

    GitHub added the old to the current and we ended up with this URL:

    https://github.com/FransUrbo/Macchina-J2534/blob/main/github.com/rnd-ash/OpenVehicleDiag
    

    Instead, we need to prefix the URL with https:// to "terminate" it properly.

    opened by FransUrbo 0
  • Linux? Requirments

    Linux? Requirments

    Ran into compile errors running the build.sh in linux. Not sure if this is linux specific. os-release: NAME="Pop!_OS" VERSION="20.10"

    Ended up being a missing dependency, apt install libudev-dev, resolved the issue. Still got a good number of warnings, but the script succeeded.

    opened by MArabie 0
  • iso9141 / 14230

    iso9141 / 14230

    Nice to see you guys have made lots of progress over the years.

    FYI I had started work on an opensource J2534 interface a few years ago and never finished it. The code for K-line was almost complete, maybe it can be useful for reference ? https://github.com/fenugrec/oj2534-fw/blob/master/src/iso_tx.c

    It may look strangely constructed, because I was aiming for excellent compliance to timing parameters. That meant putting a timestamp on all bus activity (to enforce P3min, P4min) as well as all incoming bytes (P1max, P2...). It also did firmware-level handling of periodic messages - the idea was to keep all timing-sensitive stuff on the firmware side.

    opened by fenugrec 0
  • Not able to build due to different dependency issues

    Not able to build due to different dependency issues

    Hi,

    I'm struggling to build the sketch for me M2 -> I've already tried to resolve multiple dependencies (FreeRTOS, PWM_Lib, ...) but I'm still not able to build:

    Before installing FreeRTOS lib: firmware:1:30: fatal error: Arduino_FreeRTOS.h: No such file or directory

    After installing (and resolving some path issues): esp32_can_builtin.h:39:25: fatal error: driver/gpio.h: No such file or directory

    Could you maybe list the libraries needed for compilation? I'm not sure if I'm using the correct ones ...

    Thank you!

    opened by tlowcode 0
  • Unable to compile for M2 - 'calc_cs' was not declared in this scope

    Unable to compile for M2 - 'calc_cs' was not declared in this scope

    Greetings! As the title above indicates, I have been unable to successfully compile for the M2 as of commit c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae. The merge at commit df450532f4d17fdc6a241bd5b6a6b1f55423dc75 compiles fine, but then the LIN changes afterwards breaks things for me.

    The A0 compiles without issue on both builds. The hardware is standard retail M2 with no modifications. I have installed all of the libraries from the M2 documentation, as well as pwm_lib.

    MacOS Big Sur (latest) Arduino IDE 1.8.15 (latest)

    Arduino: 1.8.15 (Mac OS X), Board: "Macchina M2"
    
    In file included from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channels.h:8:0,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:1:
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/j2534_mini.h:11:0: warning: "CAN" redefined [enabled by default]
     #define CAN    0x05 // CAN protocol (Uses CAN-D)
     ^
    In file included from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/custom_can.h:8:0,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channels.h:7,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:1:
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/due_can.h:45:0: note: this is the location of the previous definition
     #define CAN  Can0
     ^
    In file included from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/custom_can.h:8:0,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channels.h:7,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/channel.h:6,
                     from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/firmware.ino:3:
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/due_can.h:45:0: warning: "CAN" redefined [enabled by default]
     #define CAN  Can0
     ^
    In file included from /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/firmware.ino:2:0:
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/j2534_mini.h:11:0: note: this is the location of the previous definition
     #define CAN    0x05 // CAN protocol (Uses CAN-D)
     ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp: In member function 'void Iso9141Channel::write_data(uint8_t*, uint8_t, bool)':
    comm_channel_iso9141.cpp:96:48: error: 'calc_cs' was not declared in this scope
             new_buf[buf_len] = calc_cs(buf, buf_len);
                                                    ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp: In member function 'virtual void Iso9141Channel::ioctl_get(uint32_t)':
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:114:85: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         PCCOMM::respond_err(MSG_IOCTL_GET, ERR_FAILED, "ISO9141 IOCTL get unimplemented");
                                                                                         ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp: In member function 'virtual void Iso9141Channel::wakeup(uint8_t, uint8_t*, uint8_t)':
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:118:41: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         PCCOMM::log_message("Wakeup started");
                                             ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:121:84: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
             PCCOMM::respond_err(MSG_INIT_LIN_CHANNEL, ERR_FAILED, "Five baud init TODO");
                                                                                        ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:162:81: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
                 PCCOMM::respond_err(MSG_INIT_LIN_CHANNEL, ERR_TIMEOUT, "ECU TIMEOUT");
                                                                                     ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:170:81: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
                 PCCOMM::respond_err(MSG_INIT_LIN_CHANNEL, ERR_TIMEOUT, "ECU Timeout");
                                                                                     ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp: At global scope:
    comm_channel_iso9141.cpp:175:61: error: no 'uint8_t Iso9141Channel::calc_cs(uint8_t*, uint8_t)' member function declared in class 'Iso9141Channel'
     uint8_t Iso9141Channel::calc_cs(uint8_t* buffer, uint8_t len) {
                                                                 ^
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp: In member function 'virtual void Iso9141Channel::ioctl_set(uint32_t, uint32_t)':
    /Users/savant/Desktop/Macchina-J2534-c9e2ffb6a0f00c01fbdd448c66af42ec92a915ae/firmware/comm_channel_iso9141.cpp:219:89: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
             PCCOMM::respond_err(MSG_IOCTL_SET, ERR_FAILED, "ISO9141 IOCTL set unimplemented");
                                                                                             ^
    exit status 1
    'calc_cs' was not declared in this scope
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    

    I've confirmed these same results in Windows 10 as well.

    Cheers!

    opened by thesavant42 1
  • Wifi support?

    Wifi support?

    Hi Ashcon! Just curious: did you already think about adding some wireless support to this firmware? I'm not sure if this is at all possible... But maybe in a similar way to the one ESP32 RET is doing it (Serial communication disabled as soon as wifi is connected)?

    opened by Daniboum 0
  • Unable to communicate with various applications

    Unable to communicate with various applications

    Hello, first and foremost thank you for all your work on this project. I just received my A0 about 2 hours ago and this was the first thing I wanted to test out.

    I appear to have compiled the driver and firmware correctly.

    I tested J2534 connectivity in 3 different applications and no joy on any of them-- I took separate logs of each. For reference I have been using the 3 applications below with good success on a Tactrix Openport.

    savvycan: device "connects", LED turns green, but no OBD data. If I try to change any settings (such as bitrate to 500K), application crashes.

    VW_Flash: "setconfig param name is reserved / tool specific?" is what sticks out to me in the log? Application has a simple "read ECU info" button, which returns no result

    Vehical: datalogging software, crashes upon initialization. What sticks out to me:

    [WARN ] - Clear message filters unimplemented [WARN ] - Clear periodic messages unimplemented

    Any thoughts or ideas? Logs below. Driver issue, firmware issue?Disclaimer I'm not an expert at this, it was my first time installing Rust or Arduino IDE, so user fail is a definite possibility.

    macchina_savvycan.txt macchina_log_vw_flash.txt macchina_log_vehical.txt

    opened by ghost 1
  • missing arduino library

    missing arduino library

    the sketch compile failed

    pt_device_m2.cpp:5:10: fatal error: M2_12VIO.h: No such file or directory
     #include <M2_12VIO.h>
              ^~~~~~~~~~~~
    compilation terminated.
    exit status 1
    M2_12VIO.h: No such file or directory
    

    The https://github.com/TDoust/M2_12VIO library should probably be added to the instructions edit: oops disregard. I had the wrong board selected

    opened by exekutive 1
Owner
Ashcon Mohseninia
Undergraduate student at University of Reading
Ashcon Mohseninia
A framework for implementing block device drivers in user space

BDUS is a Linux 4.0+ framework for developing block devices in user space. More specifically, it enables you to implement block device drivers as regu

Alberto Faria 26 May 24, 2022
Synology DSM 7 USB serial drivers

Missing USB serial drivers for DSM 7 Supported drivers cp210x ch341 Supported platforms apollolake (linux-4.4.x) armada38x (linux-3.10.x-bsp) armadaxp

Robert Klep 81 Jun 16, 2022
Open Redragon drivers for Linux. Currently only supporting some mice.

OpenDragon Open Redragon drivers for Linux. Currently only supporting some mice. Table of contents Support Installation Building from source Usage Sou

Alexa Ognjanovic 70 May 19, 2022
fortnite cheat external that uses efi drivers and is updated

fortnite-external-efi-drivers fortnite cheat external that uses efi drivers and is updated ALL CREDITS TO CHASE: https://github.com/Chase1803 i just u

null 11 Jun 5, 2022
Generic force-feedback vibrator HAL for upstream haptics drivers

vibrator-ff, a generic vibrator HAL for force feedback haptics. Most downstream haptics / vibrator drivers are implemented as LED class devices, this

AOSP Mainline 4 Feb 2, 2022
BSOD: Binary-only Scalable fuzzing Of device Drivers

bsod-kernel-fuzzing This repository contains the implementations described in "BSOD: Binary-only Scalable fuzzing Of device Drivers". The paper and th

Fabian Toepfer 128 May 24, 2022
Full Firmware Package for the STM32WB series: HAL+LL drivers, CMSIS, BSP, MW, plus a set of Projects

STM32Cube is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost.

STMicroelectronics 119 Jun 15, 2022
Free and Open Source API and drivers for immersive technology.

OpenHMD This project aims to provide a Free and Open Source API and drivers for immersive technology, such as head mounted displays with built in head

null 1.1k Jun 22, 2022
Aims to be an accurate C port of Impulse Tracker 2.15's IT replayer (with selectable IT2 sound drivers)

it2play Aims to be an accurate C port of Impulse Tracker 2.15's IT replayer (with selectable IT2 sound drivers). This is a direct port of the original

Olav Sørensen 17 May 21, 2022
GraphicsFuzz provides tools for automatically finding and simplifying bugs in graphics drivers, specifically graphics shader compilers.

GraphicsFuzz GraphicsFuzz is a set of tools for testing shader compilers GraphicsFuzz provides tools for automatically finding and simplifying bugs in

Google 499 Jun 22, 2022
Collection of additional Ethernet drivers for ESP-IDF

Collection of additional Ethernet drivers for ESP-IDF This repository aims to store additional Ethernet drivers which are not available directly in ES

Espressif Systems 3 May 9, 2022
image_projection is a ROS package to create various projections from multiple calibrated cameras.

image_projection Overview image_projection is a ROS package to create various projections from multiple calibrated cameras. Use cases involve: Rectify

Technische Universität Darmstadt ROS Packages 104 Jun 23, 2022
Supercharged USB bootloader for various PIC24/dsPIC33 MCUs.

PICoBoot Supercharged USB bootloader for various PIC24/dsPIC33 MCUs. Features Community version Supports all PIC24/dsPIC33 MCUs with USB module No dri

SudoMaker 6 Jun 11, 2022
Fix for various issues in the PC port of Ace Attorney Chronicles.

Hackfix for a few issues in the PC port - Animation framerate can now be set to arbitrary rate. (defaults to 60 but can be freely adjusted in the ini

Admiral H. Curtiss 71 Jun 19, 2022
Various tweaks for Beat Saber.

AikaTweaks Various tweaks for Beat Saber. Credits zoller27osu, Sc2ad and jakibaki - beatsaber-hook raftario Lauriethefish and danrouse for this templa

Aika 21 Apr 25, 2022
old 'cross' project of DooM for various platforms

README - DOOM assembly code Okay, I add the DOS assembly module for the historically inclined here (may rec.games.programmer suffer). If anyone feels

null 2 Nov 5, 2021
Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature

About This repository contains: Set of examples how to use CLion with various unsupported compilers using Custom Defined Compiler feature Public set o

JetBrains 30 Jun 15, 2022
Various UI tools/tweaks.

Various UI tools/tweaks.

null 79 Jun 21, 2022
Shell program written in C to implement various system calls, with support of executing commands, output redirection and signals.

Use ./shell command to start the shell. $<space>path/executable to run the executable(please specify the path without beginning it with "/"). Eg. type

Ayuj Panchal 1 Nov 15, 2021