David-OConnor / stm32-hal

This library provides access to STM32 peripherals in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CAN read_status() not cross compatible

revilo196 opened this issue · comments

The CAN Peripheral function

    pub fn read_status(&self) -> u32 {
        unsafe { self.regs.psr.read().bits() }
    }

is not compatible with F1, L4, ... and similar chips that use the older bxCAN peripheral they don't have a PSR register.
The PSR is only present in the much larger FDCAN Hardware like in H7 chips.

bxCAN has the following status registers.
msr master status register
tsr transmit status register

maybe its just as easy as to check for the feature and use msr instead.
for my quick lookup only G4 H5 H7 L5 U5 use FDCAN