Vehicle CAN Analysis: I made my own software to see "bit changes" in real-time with a CAN bit Viewer!
Introduction
In the previous article, I introduced a method to calculate "which bits are set from a byte value" using an 8-bit to 1-bit expansion sheet.
If you continue doing CAN analysis, you will definitely think this.
Expanding in Excel takes time, so I want to see bit changes in real-time (´・ω・`)
Switch ON/OFF, ECU flags, vehicle state transitions...
I want to track 1-bit changes in chronological order.
So, the main topic this time is the real-time 1-bit Viewer.
Conventional workflow
View 8-bit values in a CAN viewer
↓
Convert HEX/DEC with a separate tool
↓
Visually confirm which bits are set
↓
Take notes in a notebook
↓
Use for analysis
...is the workflow.
I was doing this every time too (´・ω・`)
But honestly,it takes too much time to deal with. So,I made a measurement part and software to visualize 1-bit in real-time (`・ω・´)!!!
Overview of CAN data measurement and calculation
CAN data is measured in the following flow.
CAN data
↓
CAN transceiver + microcontroller (ESP32)
↓
CAN 8-bit data measurement
↓
Send to PC → 1-bit expansion in Viewer
The measured data is converted to 1-bit using the 8-bit to 1-bit calculation method from the previous article.
The software communicates with the microcontroller to send data to the PC,
and displays the calculated 1-bit data in real-time.
Below is the software screen of the CAN 1-bit Viewer I made.

The video of the operation looks like this.
Software feature introduction
COM port selection function
The COM port is automatically recognized.
I made it so that the previously connected port number is selected automatically.
I made it possible to select the baud rate, just in case (though I don't use it).

Bitrate settings (500kbps / 1Mbps)
I made it possible to select the bitrate so that communication is possible at either speed.
If you leave it alone, it will automatically recognize and connect (a mysterious feature).

1-bit / 8-bit / Simultaneous display tabs
You can select the display bits.
Locations where time-based changes occurred → Red
Locations where there has been no change for 5 seconds or more → Gray
1-bit display

8-bit display

You can also choose between decimal and hexadecimal display.

Log start / stop
I made it save 8-bit data as CSV data.
Because 1-bit data can be recalculated later.
I save data that I don't understand when looking at it, and analyze it later.
The log time and frame count are also displayed, so it's reassuring to see how much is being measured (mysterious).

Hardware configuration
The ESP32-C3 receives CAN frames through a CAN transceiver.
I used a thumb-sized microcontroller to make it compact.
There are also WiFi models, but I prioritized stability with a wired USB connection.

CAN transceiver
……Please choose whichever one you like.
I once bought Chinese CAN transceivers, and they were all defective and I threw them away, so
please look for a stable one (exhausted).
Hardware appearance

I put a microcontroller and a CAN transceiver into a Takachi case.
It's convenient to attach a DTM 2-pole connector.
It's easy to use if you make a 4-pole to 2-pole conversion connector.
Termination resistor ON/OFF switch
Assuming you are reading while communication is happening,
I also added a termination resistor ON/OFF switch to the side of the case so it can be used for CAN analysis on its own.
Why a 1-bit viewer is useful
No need for Excel expansion
Since you can see 1-bit in real-time,
you don't need to do mental math like "Bit 7=128... Bit 6=64...".
You can track changes in chronological order
The moment a switch is turned ON/OFF,
or the moment an ECU sets a flag, you can tell by the color.
You can also tell at a glance which ID has changed
It also includes a feature to sort only the IDs that have changed.
You can save logs and analyze them later
I take logs and throw them at an AI (mysterious).
Summary
This time, I introduced a viewer that lets you see 1-bit in real-time.
CAN analysis becomes much easier to understand when you look at bit values rather than byte values,
so a 1-bit viewer will skyrocket your analysis efficiency.
If you know of any better methods, let me know in the comments.
いいなと思ったら応援しよう!
チップは新たな技術向上や計測設備導入に活用し、その内容はNoteの記事としてフィードバックされる予定です。