Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAN FIlter Configuration #55

Open
andreapefe opened this issue Dec 15, 2022 · 0 comments
Open

CAN FIlter Configuration #55

andreapefe opened this issue Dec 15, 2022 · 0 comments

Comments

@andreapefe
Copy link

Hello,

I have written some code to try and modify the fdcan0 filters without success.
My code to configure the can is as follows :

let can1 = {

       let rx = gpioa.pa11.into_alternate().set_speed(Speed::VeryHigh);
       let tx = gpioa.pa12.into_alternate().set_speed(Speed::VeryHigh);

       let can = FdCan::new(dp.FDCAN1, tx, rx, &rcc);

       let mut can = can.into_config_mode();
       can.set_protocol_exception_handling(false);

       can.set_nominal_bit_timing(btr);

       //Create new Standard Filter
       let filtre = StandardFilter {
           filter: FilterType::BitMask {
               filter: 0x004,
               mask: 0x7FF
           },
           action: Action::StoreInFifo0,
       };

       can.set_standard_filter(
           StandardFilterSlot::_0,
           filtre,
       );

       //Set fdcan to reject all frames that do not match the filter
       can.set_global_filter(GlobalFilter::reject_all());

       hprintln!("-- Current Config: {:#?}", can.get_config());

       can.into_normal()
   };

The code builds without issues or warnings but when I try to print the messages received by the can using the can-echo.rs example I receive everything. The messages I am supposed to get and those that I don't. Also the receiver header does not have the right ID. Sending messages using a Raspberry Pi with different ID, the STM always sends back an ID equal to 0.
Furthermore, using GDB I have looked at the register configuration values at the address 0x4000A480 where the FDCAN_RXGFC (Global FIlter COnfiguration) register is located and the register has the reset value. No configuration has been applied.

Am I doing something wrong ? I some kind of configuration wrong ? I am using a testbench where I used to test the bus CAN using STM32F103 without any problems so it is not a hardware problem. The logic analyzer also reads the correct Standard ID so the problem is also not on the message sent by the Raspberry Pi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant