-
Notifications
You must be signed in to change notification settings - Fork 5
CVC Project Overview
The CVC is a central computer that primarily determines the vehicle’s powertrain output and monitors its complex safety- critical systems.
The CVC firmware is the C program that runs on the STM32F7 microcontroller (MCU), which interfaces with the other hardware on the board to provide the desired functionality of the CVC. The program functions as a state machine that executes the vehicle’s start-up sequence and fault handling. The MCU’s SPI and CAN hardware drivers allow the program to send and receive data to/from the vehicle. The CVC also logs data to an SD card through the SDIO peripheral. The program uses FreeRTOS, an open-source real-time operating system kernel, to schedule tasks and meet its strict timing requirements.
The firmware functions on several levels to operate the CVC:
- Driver Layer: hardware drivers send and receive data to/from the vehicle through the MCU’s peripherals (SPI, CAN, SDIO, I2C, ADC, Timer I/Os)
- Middleware Layer: implements the FreeRTOS operating system, FatFs file system, and USB on-the-go protocol
- CVC API: implements CVC-specific functions and provides a layer of abstraction between the driver and middleware layers and the application layer
- Application: implements user-specific code that may be modified to add or change features
The CVC requires drivers for the MCU’s SPI, CAN, SDIO, Analog-to-Digital Converter, and timer I/O peripherals. Each peripheral and its purpose is listed below:
Peripheral | Purpose |
---|---|
SPI | communication between MCU and 12V discrete I/Os |
CAN | communicate over CAN to send torque commands and monitor data from drive inverter, BMS, engine ECU, and vehicle sensors |
SDIO | write data to SD card for data logging |
I2C | communicate with on-board accelerometer |
Analog-to-Digital converter | receive analog inputs from vehicle sensors |
Timer I/O | accept pulse-train inputs from wheel-speed sensors; generate PWM output to control servo motor for engine throttle control |
ST provides drivers for the STM32F7 MCU in the Hardware Abstraction Layer (HAL) and Low Layer (LL) APIs of the STM32 Cube library.
- FreeRTOS Operating System
- FatFs Filesystem
- USB