cancel
Showing results for 
Search instead for 
Did you mean: 

Issue getting two ST micro controllers to communicate with each other using CAN BUS

PatTheTrickster
Associate III

I currently have two STM32 Micro controllers, One is the NUCLEO-L4A6ZG and the other is the NUCLEO-L4R5ZI-P

I want to communicate between the two using the CAN Transmission but I am confused about a couple errors that I have been hitting, So for reference I've been following this website

Google: Mattewtrendev, Setting Up the CAN Bus on STM32

And I designed my circuit without using a transceiver and instead using resistors and diodes. The tutorial unfortunately doesn't explain how to actually run the programs to see if it's working. I'm kind of a noob when it comes to STM32CUBEIDE programming so I have it right now that both boards are connected to my computer through USBs and in the IDE I have it so each board is two separate projects. IN order to get it running I will run the main form CAN_BUS1 then debug the main from CAN_BUS2 unfortunately when I do this I hit a hard fault and I've been kind of stuck on how to actually run something like this?

2 REPLIES 2

https://matthewtran.dev/2020/01/setting-up-the-can-bus-on-stm32/

Keil had this one too, describing the diode method.

https://www.keil.com/appnotes/files/apnt_236.pdf

Should probably fix the Hard Fault first, usually a gross error with pointers or memory access.

Get some serial output working so you can instrument the fault and the see the instructions and registers.

One of the CAN devices should be a listener, instrument so you can observe reception.

You could perhaps connect CAN1 and CAN2 on a single board if that makes things simpler. The CAN2 will use the upper half of the filter bank.

Make the other CAN device the squawker, perhaps every few seconds, or on a button press. Instrument this too, and output any error or status code. If the receiver is not responsive you won't get an acknowledgement and the transmission will fail.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SofLit
ST Employee

Hello,

Using CAN in Normal mode without transceivers is not a common HW configuration for CAN bus.

It's used only for quick tests and the distances between nodes SHOULD NOT EXCEED few centimeters.

ST does not support this kind of config.

Meanwhile, (just a courtesy), I remember I did this kind of config years ago with STM32 MCUs and succeeded to establish the communication.

Attached two methods I remember I used for this kind of HW.


_legacyfs_online_stmicro_images_0693W00000dJuhoQAC.png

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.