cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 (Blue Pill) CAN BUS Communication

Javier Parra
Associate II

Hi,

I´m trying to communicate two blue pills between them using CAN bus, but when I try to run it, it doesn´t even finish the start up, because I tried to use a blink program selecting the CAN in the .ioc and not using it and doesn´t work.

Does anyone knows why does this happen?

10 REPLIES 10

Perhaps you should use a debugger to establish what's going on?

I​ will note the F103 can't support CAN and USB concurrently.

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

Hello @Javier Parra​ and welcome to the Community :)

As @Community member​ said , it may be related to the use of USB and CAN with STM32F103:

Concurrent use of USB and CAN with STM32F103

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
SofLit
ST Employee

Hello,

Does "Blue Pill" board embed CAN transceiver (I think not) ? If not, did you add this external component?

If not, it will never work!

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.

@SofLit,

I think your statement is not correct: if on both side there is no tranceiver it can work for sure.

See "Beginning STM32, by Warren Gay ISBN978-1-4842-3623-9" P317 Chapter 18 CAN-bus"

RX and TX are connected to the same bus with a 4.7K pull up resistor.

Best Regards,

Johi.

@Johi,

We do NOT support this kind of "exotic" connections and we don't guarantee the behavior during the communication .. So, in normal mode, CAN bus SHOULD be used with transceivers in a complete bus configuration.

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.

Hello, thank you for your comment.

I'm not using the USB, I have the st-link v2 programmer but I don´t use the USB.

Hello,

Yes I´m using two transceivers with a 120 OHM resistance between CANH and CANL.

0693W00000UnkUjQAJ.pngI have a configuration like in the image but with both BluePills and the transceiver model is a TJA1050.

And when I program the boards the main doesn´

t even start due to the can

Ok then..

What is the voltage level of "S" pin (Silent mode)?

In the TJA1050 datasheet it was stated the following:

"Control pin S allows two operating modes to be selected: high-speed mode or silent mode....

In the silent mode, the transmitter is disabled. All other IC functions continue to operate. The silent mode is selected by connecting pin S to VCC and can be used to prevent network communication from being blocked, due to a CAN controller which is out of control."

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.

I´ve been trying to see what´s going on and its a HAL_Error.

When I init the can it enters here:0693W00000Uo62wQAB.pngAnd the HAL_GetTick () sets to -128 and there is the problem.

But i dont know why.