UTILS FDCAN How to Use

group UTILS_FDCAN_How_To_Use

How to use the UTILS FDCAN Timing module

This module provides utility functions for FDCAN timing calculations covering two main use cases:

A. Computation of Bit Timings from Bus Parameters

Compute the FDCAN bit timing parameters (prescaler, time segments, etc.) from desired bus parameters such as bitrate, sample point, and clock frequency.

Steps:

  1. Fill a stm32_utils_fdcan_input_bus_param_t structure with the desired bus parameters:

    • FDCAN kernel clock (kHz)

    • Desired bitrate (kbit/s)

    • Desired sample point (per mille)

    • Maximum allowed bitrate tolerance (per mille)

  2. Call STM32_UTILS_FDCAN_ComputeBitTiming() with:

  3. Apply the computed timings to the FDCAN peripheral configuration:

B. Computation of Bus Parameters from Bit Timings

Compute the resulting bus parameters (bitrate, sample point) from known bit timing parameters (prescaler, time segments, etc.).

Steps:

  1. Fill a stm32_utils_fdcan_bit_timing_t structure with the bit timing values:

  2. Call STM32_UTILS_FDCAN_ComputeBitrate() with:

  3. Use the computed bus parameters as needed in the application.