AS USB2CAN

I. Project Goal

This project is AS demo USB2CAN device built on stm32f107vc. The core of this project is based on the source code generated by STM32CubeMX and this project is part of AS.

This USB2CAN device implements 2 virtual CAN bus, the virtual CAN bus 0 will process the CAN mesages of the AUTOSAR COM stack, while the virtual CAN bus 1 will process the CAN messages on the real hardware CAN1. So that the virtual CAN bus 1 is a real USB2CAN device, let's name it USB2CAN1, and the virtual CAN bus 0 is a real virtualized CAN bus for the purpose to study AUTOSAR COM stack, let's name it USB2CAN0.

The goals of this project are:

    1. USB2CAN0 for AUTOSAR COM stack study purpose.
    1. USB2CAN1 is a real USB2CAN device like ZLGCAN, Vector CANcaseXL etc.

Limitations:

    1. This USB2CAN is based on USB CDC serail protocol, no optimization.
    1. The CAN baudrate is fixed to 1000Mbps, can't be dynamically changed.

II. How to build and load firmware

Follow this page as-study-platform to set up build environment.

    1. Launch the J-Link GDB Server in the backgroud.
    1. In the panel asboot of AS console, run below commands to build the asboot.
set BOARD=stm32f107vc
scons
    1. In the panel ascore of AS console, run below commands to build the ascore.
set BOARD=stm32f107vc
scons
    1. In the panel ascore of AS console, run below commands to flash firmware to target stm32f107vc
scons run

III. Play with USB2CAN

demo usb2can

In the panel of asone, run below command to launch the tool asone.

python main.py

A. Play with USB2CAN0

1. open USB2CAN0

open-usb2can0

2. play AUTOSAR COM stack on USBCAN0

play-usb2can0

3. update the stm32f107vc firmware over USBCAN0

update-firmware-over-usbcan0

B. Play with USB2CAN1

1. open USB2CAN1

open-usb2can1

2. play AUTOSAR COM stack on USBCAN1

play-usb2can1-com-rx play-usb2can1-com-tx

3. update the mpc5634 firmware over USBCAN1

update-mpc56xx-over-usbcan1