stm32h7xx-hal icon indicating copy to clipboard operation
stm32h7xx-hal copied to clipboard

fdcan implementation takes rec::Fdcan, so the other fdcan can't use it

Open SDEEV opened this issue 3 years ago • 1 comments

can.rs:242

impl Can<FDCAN2> { pub fn fdcan2( rb: FDCAN2, prec: rec::Fdcan, ) -> fdcan::FdCan<Self, fdcan::ConfigMode> { prec.enable(); // Enable APB1 peripheral clock

prec is taken and never returned

The underlying trait CanExt forces this behaviour

SDEEV avatar Jul 08 '22 03:07 SDEEV

Unfortunately the clock to all FDCAN peripherals are controlled by a single memroy-mapped bit in hardware. Therefore in the HAL abstraction it's not possible to safely clock multiple FDCAN blocks.

It is possible with unsafe using this method

richardeoin avatar Aug 03 '22 19:08 richardeoin