-
Notifications
You must be signed in to change notification settings - Fork 0
CAN Wrapper Module Installation Guide
Kolosso edited this page May 25, 2024
·
11 revisions
Welcome to the CAN Wrapper Module installation guide. This guide will walk you through the process of setting up CAN Wrapper Module for your STM32 project.
You will need CAN set up in your STM32 project to use this module, otherwise it won't work.
To set up CAN:
- Enable a CAN peripheral in your
.iocfile underPinout & Configuration > Connectivity. - Configure your CAN peripheral as such:
- In
NVIC Settings, enableRX0 interrupt. - In
Parameter Settings, setPrescaler (for Time Quantum)to16. - In
Parameter Settings, setTime Quanta in Bit Segment 1to5 Times. - In
Parameter Settings, setTime Quanta in Bit Segment 2to4 Times.
- In
⚠️ Note: These Quanta settings are recommended for microcontrollers running at 80MHz to keep all subsystems synced. Should you decide to change your clock speed, you will need to modify these values accordingly.
- Save & regenerate code.
- Ensure
MX_CAN#_Init();has been generated inmain.c
CAN Wrapper requires a dedicated timer peripheral to work.
To set up TIM16:
- Enable
TIM16in your.ioc. - In
Parameter Settings, configure your timer as such:- Set
Prescalarto80 - 1. - Set
Counter Periodto5000 - 1.
- Set
- Save & regenerate code.
- Ensure
MX_TIM16_Init();has been generated inmain.c
Everything should be set up correctly. All you have to do is push your changes.
- Navigate to your project folder in your terminal:
cd your/project/path - Commit the changes (note this will commit ALL changes in your working directory):
git add . git commit -m "Complete CAN Wrapper Module Installation"
- Push to the remote repository
git push origin main