E-Bike system – Part 2 – CAN Interface

The first part of the E-bike system will be a computer interface to connect to all the nodes using the CAN-bus. This will be used for diagnostics, parametrization and software flashing. This makes it the logical starting point before developing the other parts of the system.

There are several commercial tools for this. Of course I could have used one of them, but it’s more fun, and cheaper to build my own. The tool I’m used to, is CANalyzer from Vector which is extremely competent but also extremely expensive. CANalyzer woll be a big inspiration for the windows application I build to communicate with the hardware interface.

Windows application

The windows application will have some basic features for setting up a signal database and debug generic messages, but also some specific features for communication with the different parts of the E-bike system. The application is created in C# .NET using Microsofts free Community edition of Visual Studio

Hardware Interface

The hardware will be built around the STM32F042C6 processor which have built in crystal-less USB and a CAN-interface which makes for a very low part-count device. Apart from some LEDs and passives, its only a processor, can transceiver and voltage regulator. For low volume production the BoM cost of the v0.1 prototype is around $10.

I’ve already designed and built the first prototype hardware and ordered the boards from OSH Park.

USB2CAN PCB v0.1 top
Top view of the USB2CAN board prototype v0.1
USB2CAN PCB v0.1 bottom
Bottom view of the USB2CAN board prototype v0.1

Firmware

The embedded firmware is built on top of the ChibiOS RTOS using ChibiStudio which is a great tool for getting started with ARM Cortex-M development. Functions for communicating with the USB and CAN hardware and task synchronization is already done in the RTOS with the corersponding HAL.

The first version of the firmware works fine for sending and receiving CAN messages. There is still some work on the bootloader and the windows application. But I’m far enough to move on to the next part of the e-bike system, the BMS.

Leave a Reply

Your email address will not be published. Required fields are marked *