2023-01-06 17:10:33 -08:00
# HOWTO use custom build of rusEFI for CAN bus sniffing
2020-08-26 20:01:35 -07:00
In this HOWTO I will explain how to see raw CAN message flow with less than $30 in hardware & some free software.
## Step 1: shopping cart
2020-08-29 20:02:21 -07:00
1. Get an [STM32F4DISCOVERY ](http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/PF252419 ) micro-controller board - there are 'Order Now' buttons at the bottom of the official page.
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
![STM32F4Discovery ](Images/2014-08-21T15-20-24.645Z-stm32f4_discovery.jpg )
2020-08-26 20:01:35 -07:00
2020-08-29 20:02:21 -07:00
2. Get an [SN65HVD230 CAN Board ](http://www.wvshare.com/product/SN65HVD230-CAN-Board.htm )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
![SN65HVD230 CAN Board ](Images/sn65hvd230-can-board_l_1_5.jpg )
2020-08-26 20:01:35 -07:00
3. Get a "OBD2 16-Pin Male to Female Diagnostic Extension Cable" on eBay
2023-01-06 17:10:33 -08:00
![OBD2 16 Pin Male to Female Diagnostic Extension Cable ](Images/OBD2_16_Pin_Male_to_Female_Diagnostic_Extension_Cable.jpg )
2020-08-26 20:01:35 -07:00
4. Get a microUSB cable (one which comes with any Android phone)
## Step 2: putting hardware together
Cut the OBD extension cord into two pieces, we would need the part with the male connector. Find the wires for pins #6 and #14
![OBD2 Connector Pinout ](Images/obd2_connector.png )
Run some wires from these pins to CANH (high) and CANL (low) screw terminals of the can module.
Here is how the end result should look like:
2020-08-29 20:02:21 -07:00
![CAN hardware end result ](Images/CAN_hardware.jpg )
2020-08-26 20:01:35 -07:00
Ignore the white wire - we do not need it.
Run female-female jumper wires to connect TX on the CAN module with pin PB6 on the discovery board. RX on the module to pin PB12. GND to GND. +3v to +3v.
Hardware is ready!
2020-08-29 20:02:21 -07:00
![CAN hardware attached to Discovery ](Images/CAN_hardware2.jpg )
2020-08-26 20:01:35 -07:00
## Step 3: software
2023-01-02 11:22:23 -08:00
2020-08-29 20:02:21 -07:00
1. Download and install [STSW-LINK004 STM32 ST-LINK utility ](http://www.st.com/web/en/catalog/tools/PF258168 )
2020-08-26 20:01:35 -07:00
2020-08-29 20:02:21 -07:00
2. Firmware: download and unzip [rusefi_can_sniffer.zip ](http://rusefi.com/images/forum_posts/CAN/rusefi_can_sniffer.zip )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
3. Uploading the firmware: Connect stm32f4discovery to your laptop using a mini-USB cable (one should come with the board), install driver, start St-Link Utility.
2020-08-29 20:02:21 -07:00
2023-01-06 17:10:33 -08:00
![ST Link Utility ](Images/st_link_utility.png )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
click 'Target'>'Program...'
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
![ST Link Start ](Images/st_link_start.png )
2020-08-29 20:02:21 -07:00
2023-01-06 17:10:33 -08:00
Point the utility to the rusefi_can_sniffer.hex file and hit 'Start'
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
Close ST Link Utility.
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
4. Now it's time to connect the micro USB cable. Keep miniUSB cable connected - you should have two USB cables connected. When you do this for the first time your Windows would prompt for drivers, you should download & install [virtual COM driver ](http://www.st.com/web/en/catalog/tools/PF257938 )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
Once the driver is installed, you can verify serial connectivity by opening your Device Manager - we are expecting to see a Virtual COM Port.
![Device Manager ](Images/device_manager.png )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
Remember the number of the COM port.
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
5. Download and launch [Putty ](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html ) telnet application.
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
![Putty ](Images/putty.png )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
![CAN hardware attached to laptop ](Images/CAN_hardware3.jpg )
2020-08-26 20:01:35 -07:00
2023-01-06 17:10:33 -08:00
Now connect the obd connector to your vehicle and you should see the CAN messages flowing in putty.
![CAN messages on computer screen ](Images/CAN_end_result.jpg )