For the Formula Student VCU - Inverter, Sensor & BMS communications
This repository lays the foundation for the VCU development of the Black Forest Formula Team located in Offenburg. You can find an overview to get started in this ReadMe, for more information we suggest to refer to the Wiki you can find in this Repo.
This project represents the VCU development of the Formula Student Team from Hochschule Offenburg (Germany). The focus lays on the documentation for new team members which allows them a smooth start to improve our software. Our VCU is a STM32-F767ZI board which uses the HAL-Lib for CAN-Communication.
First of all check out the project structure in the Wiki.
- To work on the project use the STM32CubeIDE. Install the latest version for your system.
- Clone this project when you are using GitHub Desktop or download the ZIP-file.
- Open the project in the STM32IDE
- For the VCU development use the "BFFT_Architecture_STM32_FreeRTOS(in VCU-STM32F767ZI-master)" only as you can see in the project structure also. Do not touch the others.
HAL gets initialized in the main.c, the rest of the CAN-communication happens in mymain.ccp for now. In the future, CAN-communication has to be handled in seperate functions.
To enable the CAN-communication start CAN and activate notification to receive messeges.
if (HAL_CAN_Start(&hcan1) != HAL_OK)
{
Error_Handler();
}
if (HAL_CAN_ActivateNotification(&hcan1,CAN_IT_RX_FIFO0_MSG_PENDING | CAN_IT_RX_FIFO1_MSG_PENDING | CAN_IT_TX_MAILBOX_EMPTY) != HAL_OK)
{
Error_Handler();
}
In mymain.ccp you can find a simple example for sending one CAN-Message.
// prepare header
CAN_TxHeaderTypeDef header;
// set standard id
header.StdId = 42;
// use standard id
header.IDE = CAN_ID_STD;
// this is a data frame, not a remote frame, because we have data to send
header.RTR = CAN_RTR_DATA;
// data length, we send eight bytes
header.DLC = 8;
uint8_t data[] = {1, 2, 3, 4, 5, 6, 7, 8};
uint32_t txMailbox_used_to_store;
if (HAL_CAN_AddTxMessage(&hcan1, &header, data, &txMailbox_used_to_store) != HAL_OK)
{
Error_Handler();
}
Interrupt routine is implemented and tested.
TX/RX load check on Hil-Box .
Dokumentation for inverterhandling (left and right inverter). Here you can find it in detail.
Handle the control of the inverters and e-machine via CAN.
Implementation of saftey and monitoring function which triggers e.g. derating.
Validate and check if the VCU works properly. Create test cases with our HiL-Box if all the functions are correctly implemented and applied.
The driver interface shows important data e.g. velocity. Implement classes/functions in the VCU to send sensor data to a display via CAN.
Implementation of classes and functions to handle the sensor data (receiving).