2024-11-04 03:53 AM - last edited on 2024-11-04 04:30 AM by SofLit
Hello!
I followed this video for CAN-bus https://www.youtube.com/watch?v=JfWlIY0zAIc&t=918s
but as simply as it looks, my configuration doesnt seem to work,
I'm working on the NUCLEO-F767zi, I started a new project with default config simply adding CAN1, no other pin configured or device added.
With the oscilloscope, I can see the CAN_TX pin toggling, but nothing received in LoopBack Mode.
I attached the main.c file and the .ioc file.
I read the discussion on this post but I cant use the same solution, not really sure why (I'm no expert in clock configuration).
Thank to whoever will give his opinion about it.
Solved! Go to Solution.
2024-11-04 04:39 AM - edited 2024-11-04 05:11 AM
Hello @vFazzi and welcome to the community,
First, start with a pass all messages. At the moment and in your code, replace:
.FilterMaskIdHigh=0xFFF<<5,
by :
.FilterMaskIdHigh=0,
Second, set the internal pull-up on CAN_Rx pin:
Hope it helps.
2024-11-04 04:39 AM - edited 2024-11-04 05:11 AM
Hello @vFazzi and welcome to the community,
First, start with a pass all messages. At the moment and in your code, replace:
.FilterMaskIdHigh=0xFFF<<5,
by :
.FilterMaskIdHigh=0,
Second, set the internal pull-up on CAN_Rx pin:
Hope it helps.
2024-11-04 06:00 AM
Hello SofLit and thanks for the quick reply, it worked immediately.
Can you please describe the relationship between the TxHeader.StdId and the filterMaskIdHigh?
2024-11-04 06:09 AM
TxHeader.StdId is what you are transmitting.
filterMaskIdHigh is a parameter of the filter. As you are in loopback mode, the trasmitted frame with TxHeader.StdId value needs to match the filter config.
and what I suggested is to set all to 0 to pass all the IDs, so you will receive all the sent message in loopback mode.
For filtering mechanism you need to refer to the reference manual of the product, section "40.7.4 Identifier filtering".