Allow configuration of FDCAN_CKDIV register on STM32G4xx Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
preisi
Posts: 3
Joined: Mon Sep 27, 2021 2:48 pm
Has thanked: 2 times

Allow configuration of FDCAN_CKDIV register on STM32G4xx

Post by preisi »

Hey,

as of now, FDCANv1 already allows basic functionality on STM32G4xx. However, it is not yet possible to configure the global CKDIV register which is required to change the clock divider for the FDCAN-peripheral. Said CKDIV register can only be written as part of the FDCAN1 interface configuration.
After previous consultation with you, I've written a small patch, allowing for static configuration of aforementioned CKDIV register inside can_lld_init() and added appropriate checks as part of the configuration options, etc.

The patch itself already runs on my system, but there are a few points that could be improved upon depending on your liking:

  • Add defines for all possible values of the CKDIV's PDIV field (32 defines in total)
  • Autoenable FDCAN1 instead of only checking whether it's enabled

If you want me to, I'll gladly change anything.

Best regards,
preisi
Attachments
STM32G4_FDCAN_CKDIV.zip
(988 Bytes) Downloaded 435 times
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Allow configuration of FDCAN_CKDIV register on STM32G4xx

Post by Giovanni »

Hi,

Committed.

Giovanni
Post Reply