Decoding Mazda CAN bus

While working on my projects, I did several attempts to depict Mazda CAN protocol, to find useful information. For example, getting the shift position for the “smart “mirror project and the fuel level for the fuel reminder. There are many products available for the OBD2 protocol. One good product is TouchScan with Mazda extension, which allows you to access every module in the car for diagnostic purposes. Using this tool, I figured out how to get access to the fuel gauge on the console, instead of using the sensor in the tank. However, while it is a very useful tool, it does not provide access to real-time information available on CAN bus as broadcasted messages.

OBD2 protocol is query-respond based. You can get information by sending a request to the addressed module, but this is not the same as getting information from live broadcasted messages, without any delays.

Mazda uses two separate buses, HS-CAN or High-Speed 500khz and MS-CAN Medium Speed 125 kHz. It is well documented in the Mazda Work Shop manual, but without actual IDs for each module, which is proprietary Mazda’s information, not available for public.

I decided to make a dual-channel CAN logger/bridge, which will allow me to record messages from individual modules as well as logging from two buses. I found an old Raspberry Pi board, which will be perfect for this project. Two SPI CAN modules on top of it will do the job.



Assembled with CAN-SPI modules


“Black box” 3D printed enclosure with an illuminated push button to start/stop logging.


Accessible USB ports for memory stick and Wi-Fi dongle.


Logging started



Using Python programming language it will be easy to do filtering and bridging between CAN segments for separate logging on a common bus and individual modules.



My goal is to figure out how to control warning sounds, get access to the switches on the steering wheel and central console as well as some basic information, like speed, steering position, etc.,  in real-time.

First, I logged 10 minutes drive and converted it into an Excel spreadsheet. The next step will be logging from individual modules, using bridge option in my sniffer.


Started my list MX-5_CAN (updated on 3/14/17),  shift position,  wheels speed, steering column angle decoded,  work in progress…


Some useful links:

Wikipedia page CAN bus

Ameridian’s blog

Raspberry Pi

12 thoughts on “Decoding Mazda CAN bus

  1. Pingback: Raspberry Pi Zero W for car applications | Gadgets for my MX-5 2016 (ND)

    • MS-CAN must be configured for 125 kbps speed, otherwise was no problem. Also, I found that all the messages on MS-CAN you can catch on HS-CAN as well. Probably some device has bridge between them.


  2. This might be useful to you. I did some CAN sniffing today while developing a new aftermarket race car dash 🙂

    “Mazda 6 Skyactive 2.2 diesel, manual transmission 2017 model CAN definitions”

    “HS (500kHz bus), all wordss big endian”

    CAN i.d.

    0x78 “Bytes 0,1” “Bytes 2,3” “Bytes 4,5” “Bytes 6,7”
    Unknown | “Least significant 4 bits of byte 3, and byte 4 (12 bit value)” | Unknown
    Brake pressure – scaling/units unknown.
    Offset by 152 decimal – ranges from 0x98 to 0x1FF

    0x202 “Bytes 0,1” | “Bytes 2,3” | “Bytes 4,5” | “Bytes 6,7”
    Engine RPM x4 | “Vehicle speed, km/h x100″ |”Throttle position, TPS% x 640” | Unknown

    0x240 Byte 1 All other bytes unknown
    Steering torque – scaling/units unknown
    “7F in centre position – clockwise reduces value, anti-clockwise increases value”

    0x420 Byte 0 | Byte 7
    Engine coolant temperature | Ambient air temperature
    Scale = Deg C +30 Scale = DegC +30


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.