1.26.6.3 1.27.9.3 1.28.10.3 1.34.7.3 1.41.8.3 1.42.6.3 MCANx_BitTimingSet Function / Typedef
C
bool MCANx_BitTimingSet(MCAN_BIT_TIMING *bitTiming);
Summary
Configure the CAN bit timing at run time.
Description
This function allows the application to change the CAN bit timing parameters at run time. The application can thus override the MCC defined configuration for these parameters. The parameter are specified via the MCAN_BIT_TIMING type parameter. Each member of this parameter should be initialized to the desired value.Precondition
None.
Parameters
Param | Description |
---|---|
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
Calling this function will affect any ongoing communication. The application must thus ensure that there is no on-going communication on the CAN before calling this function.