2025-08-13 12:24 AM - last edited on 2025-08-21 1:36 AM by mƎALLEm
The goal of my project is to turn on an LED on the recieving side through CAN. Both my reciever and transmitter have the transciever circuit. Both are Nucleo boards, TX: F303RE, RX: F446RE.
The data i am sending through is 16-bit, but as long as my reciever is not in reset copnstantly (as in me holding the reset button when the program is running), the transmitted and recieved data is not correct, its far to short. The data is the same on TX and RX, but wrong. But when i hold reset on the reciever the data that comes through looks right.
I cant figure out what the problem is, i have measured the connections on the transcievers a million times, measured the RX, TX pin, CAN_H and L and always come back to the same issue.
I am programming the boards in Cube_IDE. The pictures below are of the boards and the signals i recieve. Please help. I dont see how this could be a hardware problem but maybe I missed something, i am still a begginer.
The reciever board is part of another project, but i used it, since it has the transciever circuit and that way there was no soldering needed. And the reciver board worked on the previous project of my friend.
The boards
The signal when the RX is not reset:
The signal when it is reset:
Any help is appreciated ! The codes i put as txt files.
Solved! Go to Solution.
2025-08-20 1:04 AM
where do i check this counters? It realyy shouldnt be a hardware problem, since the boards i used worked on a previous project. And now i have confirmed, that i recieve data on the RX pin, but there is no data visible on the TX pin, eventhough it shoudl be? (because of the 120 Ohm terminator). Is there a way to recieve CAN data without an interrrupt?
2025-08-20 1:38 AM
> where do i check this counters?
> It realyy shouldnt be a hardware problem, since the boards i used worked on a previous project.
But obviously there is.
Besides of the already mentioned termination resistor, you can swap the CAN_H and CAN_L lines on one side, this does no harm to the hardware. And you can try with and without CAN_GND.
> ... but there is no data visible on the TX pin ...
What exactly do you mean here ?
If one sides receives something, the other (or one other) side must send something.
CAN is not deterministic, by the way. A transmit will often not happen when you trigger it, but only when the bus becomes free, and the respective peripheral "wins" the bus arbitration.
Perhaps the timing parameters on one side are not correct (I assume you have chaeck for identical baud rates).
You probably have different core clock frequencies, and thus the bit timing parameters (SYNC_SEG, BS1, BS2) might differ.
2025-08-20 2:24 AM
Generally if there are no hardware issues two possibilities are
a. Baud rate mismatch
b. Improper filter configuration
Check the above two then you may solve the problem.
2025-08-20 12:01 PM
@tim_licen123 wrote:Now i tottaly redid the code and the issue is, I never recieve data/enter the interrupt?. On the reciever, the data on the TX pin is the same as on the transmitter, but on the RX pin, there is just one single pulse from logic high to low, what could be the issue here. It seems as if I transmit data to the TX pin instead of the RX pin?
Please help, bellow is the main.c, for my reciever. The TX part now works perfectly, with no need to reset anything, now the problem is not recieving the data.
Set your filter to receive all CAN messages. Then once you get that working then you can add CAN filters for specific ID's, though not even necessary if you don't have much processing/calculations going on.
2025-08-20 11:26 PM
Did You resolve the Hardware problem?
2025-08-21 1:29 AM
Yes the hardware problem is resolved. I know recieve on one end and the answer comes back to the other nucleo, but the other nucleo doesnt read the message (i can see it on the osciloscope), and therefore does not enter the interrupt function to blink the LED. So in short, i have one way communication, i want to have it both ways. What could be the problem here?
2025-08-21 1:43 AM - edited 2025-08-21 1:43 AM
Hello,
Not possible to help you efficiently if your don't share the two projects of both F303 and F446RE. Please attach them in the thread.
Please share the projects including the ioc files instead of attaching .txt files of part of codes.
2025-08-21 2:10 AM
2025-08-21 3:26 AM - edited 2025-08-21 4:44 AM
Hello,
1- However I'm wondering how F446 is reading CAN data?! You have this filter configuration for CAN1:
cancanfilter.FilterBank = 10;
cancanfilter.SlaveStartFilterBank = 0;
SlaveStartFilterBank = 0 means all the filters are allocated to CAN2 which is not used!
Refer to this article: STM32 in dual CAN configuration: bxCAN Filter bank explanation and relation with CAN2 Start Bank parameter : "If SlaveStartFilterBank = 0: all filters are allocated to CAN2. In that case CAN1 is not usable, but CAN1 APB clock should be enabled since it is a master as mentioned previously."
In the case of CAN1 instance, SlaveStartFilterBank needs to be > FilterBank
2- For F3:
You have an issue with the filter setting especially the FIFO number. You seems using FIFO1 but you are setting FIFO0 for the filter:
cancanfilter.FilterFIFOAssignment = CAN_FILTER_FIFO0;
Change it as the following:
cancanfilter.FilterFIFOAssignment = CAN_FILTER_FIFO1;