CAN Problems with STM32 and STM8S

Hi.

I’m having a very hard time trying to get my CAN system to work properly.

I have successfully made the firmware for the Host (STM32) and for the device (STM8S). And when I connect only one device to the host, the system works fine, and they can communicate as programmed. I’ve probed the CAN signals (CANH & CANL) too, and they are as they should be - high when no data is transmitted, and data signal when transmitting.

But when I connect another device to the CAN-bus, both CAN signals are driven low, and they are kept low even when transmitting. Therefor no data is recieved on either device!

I have remembered the 120ohm termination resistor, so that can’t be the problem. Both devices is running as they should, though I’m not sure if there is a firmware setting, need to be set, if there is going to be more than just one device.

Do you know if there can be any “firmware”-related setting for this in general (doesn’t have to be for STM32 or STM8S)?

I really hope someone can point me in the right direction. Thank you :slight_smile:

Best Regards

Thomas Jespersen

The problem is on the device you add on the bus. If it works correctly, it will not drive the bus lines low.

Angelo

Polux rsv:
The problem is on the device you add on the bus. If it works correctly, it will not drive the bus lines low.

Angelo

But both devices works fine If they are individually connected to The host (only one device at a time. They run The same code too.

Thomas

Sorry, I didn’t read corectly your first post :lol:

Second try :mrgreen: :If both devices try to send frames with same ID, it could result in bus error if I remember correctly. As your devices use the same firmware, same ID are probably used. Try changing ID’s of one device.

Angelo

Problem solved!

The wires in the cable I was using, between the two device boards, was twisted - so the CAN connection was wrong.

Best Regards

Thomas Jespersen