2023-10-30 08:53 AM
Hi,
I have an STM32F427ZGT6 and I am using both CAN peripherals to communicate on separate CAN networks.
When other devices exist on the CAN1 and CAN2 networks (acknowledging messages on the bus, and sending messages), everything works nicely (CAN1 and CAN2 send and receive the messages I expect them to).
Another device on the CAN1 network is sending data which is correctly received by the firmware and `HAL_CAN_RxFifo0MsgPendingCallback` is called.
If there are errors on the CAN2 network (for instance by the board being disconnected from the bus) then after a few failed send attempts on CAN2 peripheral, I reset the peripheral:
(This is the same process I go through once at the very beginning to start the peripheral, by the way).
However, once I do that reset of CAN2: CAN1 continues to send message correctly, but HAL_CAN_RxFifo0MsgPendingCallback stops being called at all (I would expect it to still be called for CAN1, because the other device on the network is still sending CAN messages - verified by inspecting the bus).
I found that I reset BOTH CAN1 and CAN2, then it works correctly (CAN1 continues to send and receive correctly).
My question is, why does resetting CAN2 only cause the receive callback on CAN1 to stop being called?
(I wonder if this is something similar as discussed here Solved: Using both CAN1 & CAN2 both in STM32F446RC - STMicroelectronics Community?)
Many thanks!
2023-10-30 09:04 AM
I found also that if I specify the FilterBank details as suggested by @MG.5 as:
can1FilterConfig.FilterBank = 0;
can1FilterConfig.SlaveStartFilterBank = 14;
can2FilterConfig.FilterBank = 14;
can2FilterConfig.SlaveStartFilterBank = 14;
then i don't need to reset both peripherals any more, resetting CAN2 by itself is sufficient, and CAN1 continues to operate normally.
I expect this is the more "correct" way to do it?
My question is why did failing to set the filter bank numbers cause this? Or is there some documentation that could explain this?