Skip to content

Commit 581cd80

Browse files
authored
Fix for calculating CAN timing settings.
NominalPrescaler value needs to be as high as possible to ensure a good approximation of the target CAN speed. Previous usage of macro IS_FDCAN_DATA_TSEG1 refers to (unsupported by Mbed ) FDCAN CAN controller settings and leads to too low prescaler values. Usage Macro IS_FDCAN_NOMINAL_TSEG1 yields optimum results. See also correct macro usage in line #158.
1 parent 9ca5383 commit 581cd80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

targets/TARGET_STM/can_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ int can_frequency(can_t *obj, int f)
335335
// !When the sample point should be lower than 50%, this must be changed to
336336
// !IS_FDCAN_DATA_TSEG2(ntq/nominalPrescaler), since
337337
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%
338-
while (!IS_FDCAN_DATA_TSEG1(ntq / nominalPrescaler)) {
338+
while (!IS_FDCAN_NOMINAL_TSEG1(ntq / nominalPrescaler)) {
339339
nominalPrescaler ++;
340340
if (!IS_FDCAN_NOMINAL_PRESCALER(nominalPrescaler)) {
341341
error("Could not determine good nominalPrescaler. Bad clock value\n");

0 commit comments

Comments
 (0)