1.26.6.2 MCANx_BitTimingCalculationGet Function / Typedef

C

bool MCANx_BitTimingCalculationGet(MCAN_BIT_TIMING_SETUP *setup, MCAN_BIT_TIMING *bitTiming);

Summary

Calculate the CAN bit timing parameters which will be used to configure the CAN bit timing using MCANx_BitTimingSet() API.

Description

This function is used to calculate the CAN bit timing parameters at run time based on the parameter are specified via the MCAN_BIT_TIMING_SETUP type parameter. This function returns the calculated CAN bit timing parameters in the MCAN_BIT_TIMING type parameter.

Precondition

None.

Parameters

Param Description
setup defines parameters required for bit timing calculations
bitTiming CAN bit timing parameters structure

Returns

status of the request

true : request successful

false : request failed

Example

volatile bool status = false;
MCAN_BIT_TIMING_SETUP setup = {0};
MCAN_BIT_TIMING bitTiming = {0};
setup.nominalBitTimingSet = true;
setup.nominalBitRate = 250000;
setup.nominalPrescaler = 0;
setup.nominalSamplePoint = 75;
setup.dataBitTimingSet = true;
setup.dataBitRate = 1000000;
setup.dataPrescaler = 3;
setup.dataSamplePoint = 75;
status = MCAN1_BitTimingCalculationGet(&setup, &bitTiming);
if (status)
{
    status = MCAN1_BitTimingSet(&bitTiming);
}

Remarks

None.