Skip to content

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.

Step-by-Step Installation

1. Configure CAN

You will need CAN set up in your STM32 project to use this module, otherwise it won't work.

To set up CAN:

  1. Enable a CAN peripheral in your .ioc file under Pinout & Configuration > Connectivity.
  2. Configure your CAN peripheral as such:
    • In NVIC Settings, enable RX0 interrupt.
    • In Parameter Settings, set Prescaler (for Time Quantum) to 16.
    • In Parameter Settings, set Time Quanta in Bit Segment 1 to 5 Times.
    • In Parameter Settings, set Time Quanta in Bit Segment 2 to 4 Times.

⚠️ 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.

  1. Save & regenerate code.
  2. Ensure MX_CAN#_Init(); has been generated in main.c

2. Configure TIM16

CAN Wrapper requires a dedicated timer peripheral to work.

To set up TIM16:

  1. Enable TIM16 in your .ioc.
  2. In Parameter Settings, configure your timer as such:
    • Set Prescalar to 80 - 1.
    • Set Counter Period to 5000 - 1.
  3. Save & regenerate code.
  4. Ensure MX_TIM16_Init(); has been generated in main.c

3. Commit & Push Changes

Everything should be set up correctly. All you have to do is push your changes.

  1. Navigate to your project folder in your terminal:
    cd your/project/path
  2. Commit the changes (note this will commit ALL changes in your working directory):
    git add .
    git commit -m "Complete CAN Wrapper Module Installation"
  3. Push to the remote repository
    git push origin main

Clone this wiki locally