A CAN frame sniffer system for the NUCLEO-H755ZI-Q board, implemented as a reusable C library.
Features include:
- Automatic CAN baud‑rate detection
- Manual CAN baud‑rate configuration
- CAN ID message filtering
The setup has been successfully tested on a vehicle’s OBD-II port, capturing live CAN data.
This README provides the essential steps needed to reconstruct the project inside STM32CubeIDE. For a full technical explanation, Hardware and Software overview, and detailed methodology, refer to the CAN_Sniffer.pdf report included in the repository, along with the documentation provided in the code files.
The repository contains:
-
Report/CAN_Sniffer.pdf– Full project documentation
-
Src/CAN_Sniffer.ioc– STM32CubeMX configuration file for project reconstructionmain.c– Main application source file for the CM7 core
-
My_Modules/– Custom drivers and feature modulesDrivers/can/– CAN handlingmy_can.cmy_can.h
debug/- Debug supportmy_debug.cmy_debug.h
stdio/- Lightweight I/O over UARTmy_stdio.cmy_stdio.h
uart/- UART supportmy_uart.cmy_uart.h
Features/settings/- CAN Sniffer settings menu interfacesettings_menu.csettings_menu.h
-
Speedometer/- Python code for Data Visualizationanalog_speedometer.pydigital_speedometer.py
git clone https://github.com/ZiakasSt/CAN-Sniffer.git
Place it anywhere you want on your system.
- Open STM32CubeIDE and choose a workspace.
- Go to: File → New → STM32 Project from an Existing STM32CubeMX Configuration File (.ioc)
- Select
Src/CAN_Sniffer.iocfrom the repository. - Finish wizard and let the IDE generate the base project.
Navigate to:
CAN_Sniffer/CAN_Sniffer_CM7/Core/Src/
and replace the generated main.c with the main.c from the repository.
-
In the Project Explorer, right‑click
CAN_Sniffer_CM7→ New → Folder. -
Name it:
My_Modules. -
Drag and drop into the new folder the modules from the repository:
DriversFeatures
Right‑click CAN_Sniffer_CM7 → Properties.
C/C++ Build → Settings → MCU/MPU GCC Compiler → Include Paths → Add directory path → Workspace
Then choose the following paths:
My_Modules/Drivers/canMy_Modules/Drivers/debugMy_Modules/Drivers/stdioMy_Modules/Drivers/uartMy_Modules/Features/settings
Click Apply (bottom right).
Still inside Properties:
C/C++ General → Paths and Symbols → Source Location → Add Folder
Select the entire folder:
My_Modules
Click Apply and Close.
- Right‑click
CAN_Sniffer_CM7→ Build Project - After a successful build: Run As → STM32 C/C++ Application
In case you want to test the Sniffer on your own car, once you identify the CAN frame that carries the vehicle speed, you can use the attached Python script as a speedometer. Adjust anything necessary in the script, such as the serial port.