2022-05-19 11:44 PM
Hello.
I'm currently researching can communication with stm32f407vg
currently, i want to use can1 and can2 at the same time, but only one of them works.
canfilter is used, and the test is currently in progress through timer interupt.
maybe the can filter part is wrong, but i couldn't find the answer, so I want to ask for help.
thanks you for your help
2024-12-11 5:01 AM
Thanks for the reply. There are two separate ADM3055E transceivers. One on each bus.
2024-12-11 5:04 AM
Hi, the hardware is ok. Both busses are transmitting valid CAN messages. Just that FDCAN2 is sending a wrong message which indicates that it is not using the correct buffer.
2024-12-11 5:06 AM - edited 2024-12-11 5:08 AM
Sorry, please ignore my comments. I posted in the wrong thread! Have a similar one open in another tab and thought it was replies to that one. Can a moderator please delete my answers in this thread. Thanks.
2025-07-08 1:46 AM
Same. The master-slave filter bank. You can start any one of the CAN peripherals with any filter bank (0 or 1, etc.), it will work. The slave filter may start from anywhere, doesnt matter, it wont work. I dont understand why
2025-07-08 1:55 AM
I’ve already answered your question in your thread here: https://community.st.com/t5/stm32-mcus-products/stm32f407-dual-can-first-can-instance-both-tx-rx-works-second/td-p/819950
2025-07-08 2:07 AM
@KHyun.1 @mƎALLEm @Nickelgrass @Tesla DeLorean @Andrew Neil
I know my solution sounds crazy, but I did find a solution to this problem. Every time before uploading/debugging the code, use the STM32Cube programmer/utility tool to fully erase the flash. It worked for me. Figured there must be some issue in HAL when rewriting the code during re-upload, so I erased the code itself. Works for me.
Here is my filter config snippet that doesn't filter any data out:
void can_init(void) {
CAN_FilterTypeDef sFilterConfig1 = {
.FilterBank = 0,
.FilterMode = CAN_FILTERMODE_IDMASK,
.FilterScale = CAN_FILTERSCALE_32BIT,
.FilterIdHigh = 0x0000,
.FilterIdLow = 0x0000,
.FilterMaskIdHigh = 0x0000,
.FilterMaskIdLow = 0x0000,
.FilterFIFOAssignment = CAN_RX_FIFO0,
.FilterActivation = ENABLE,
.SlaveStartFilterBank = 14
};
HAL_CAN_ConfigFilter(&hcan1, &sFilterConfig1);
sFilterConfig1.FilterBank = 14;
sFilterConfig1.FilterFIFOAssignment = CAN_RX_FIFO1;
HAL_CAN_ConfigFilter(&hcan2, &sFilterConfig1);
HAL_CAN_Start(&hcan1);
HAL_CAN_Start(&hcan2);
// Activate notifications for both CAN interfaces
if (HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK) {
Error_Handler();
}
if (HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO1_MSG_PENDING) != HAL_OK) {
Error_Handler();
}
}
Just ensure you erase full chip before uploading/debugging and it will work!
2025-07-08 2:32 AM
Sounds like you have something else stored in Flash that's causing the problem.
@Kunaalkk1 wrote:@KHyun.1 @mƎALLEm @Nickelgrass @Tesla DeLorean @Andrew Neil
There's no need to tag everyone - people get notified of any reply in the thread
@Kunaalkk1 wrote:Figured there must be some issue in HAL when rewriting the code during re-upload, !
No, that's not it.
HAL is not involved in code download - unless you've written a custom bootloader using it?