langroodi / CANBus

Open CAN-Bus USB Sniffer by hiring a MCP2515 controller over a RISC-V board and taking advantage of FreeRTOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open CAN Sniffer

The aim of this project is to make a prototype of a open-hardware/software CAN Bus to USB Sniffer for Linux/Windows-based machines. The CAN communication goes through a MCP 2515 controller which is connected to a RI5CY processor. The processor hosts a FreeRTOS kernel which provides a Virtual COM on the end-user machine as shown below:

Architecture diagram

There is no dynamic (heap) allocation at the application layer, but still there are heap allocations at the official middleware/driver layer due to using dynamic semaphores. A polling mechanism is designed for almost efficient data fetching from the SPI (not as efficient as the DMA mechanism), but due to lack of succifient stability the usage has been ignored in the final version.

Dependecies

The dependencies of the project in hardware and software categories are as follows:

Hardware dependecies

Software dependecies

Steps to run the project

  1. Connect the MCP2515 module to the VEGAboard SPI0 pins (i.e., J2 pin 6, 8, 10, and 12) with a common ground;
  2. Connect the other CAN device to the MCP2515 module with a common ground while setting the bus speed to 5 kbps;
  3. Set the RISCV32SDK_DIR environment variable to the path where the RV32M1 SDK has been installed;
  4. Use the mentioned RISC-V Toolchain to compile the firmware;
  5. Flash the compiled firmware (open_can_sniffer.elf) to the VEGAboard using the JTAG programmer;
  6. Connect the VEGAboard USB port to the PC;
  7. Connect the VEGAboard OpenSDA port to the PC to see the debugging logs (optional);
  8. Power up the MCP2515 module and the VEGAboard;
  9. Use the in-house USBCAN-GUI software on the PC to see the received CAN packets;
  10. Use a 3rd-party serial port terminal (e.g., Putty) on the PC to connect to the OpenSDA COM port for monitoring the logs (optional).

About

Open CAN-Bus USB Sniffer by hiring a MCP2515 controller over a RISC-V board and taking advantage of FreeRTOS

License:MIT License


Languages

Language:C 94.1%Language:CMake 5.9%