2025-06-18 6:51 PM - last edited on 2025-06-19 3:10 AM by Andrew Neil
Hi all,
I am Struggling with STM32L432 CAN Bus communication from one STM32L432 to another STM32L432 using MCP2551.
* I have checked loopback works.
*I am using HSE Clock (After soldering SB17) -
* I have also tried putting Oscilloscope at TX pins between STM32 Transmitter and MCP2551 but signal just stays high.
* Plus, i can see that this never triggers but putting it in debug mode and putting a breakpoint in there
I also tried following this guy: 115. STM32CubeIDE MCP2551 CAN BUS with STM32 F103C8T6
but to no avail.
* I also tried doing the same setup i.e. ADC on transmitter sending information to other side via CANBUS.
* I have quadrupled checked Hardware circuitry, and all seems to be right.
* CANBUS Distance is also less than a meter now with termination at both ends.
TX Code -
RX Code -
Any help would be much appreciated.
Thanks
2025-06-19 3:08 AM - edited 2025-06-19 3:13 AM
Hello @Dave001 and welcome to the ST community,
First in next time please use </> button to share your code instead of sharing screen shots. Please review how to post a code.
Second, these are a very bad bit timing parameters:
You need to decrease as much as possible the Prescaler and increase as much as possible BS1 and BS2 while having a simple point at around 87%;
Refer to this article: CAN (bxCAN) bit time configuration on STM32 MCUs
This link can help you to calculate the timings parameters. You need to select:
Hope that helps.
2025-06-19 5:18 AM
You should try playing with the parameters , increase the sample points , use internal/ external loop back mode and see if the RxCallback Triggers, you can refer to https://kvaser.com/support/calculators/bit-timing-calculator/ this website for the CAN bus timing parameters , works well with the ST Boards and is easy to use, You will most likely get the Communication started.