cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103C8T6 blue pill CAN does not work

GRosi.1
Associate

I'm trying to send CAN messages with the STM32F103C8T6 microcontroller (blue pill hardware with genuine ST chip) to a CAN analyzer without success.

I'm using STM32CubeIDE v1.12.0. I double checked the hardware, I'm using PB8 and PB9 pins to connect to the CAN transceiver (SN65HVD230 ) RX and TX pin respectively, I have 120 ohm resistor on both CAN line termination, I settled CAN baudrate to different baud but the result is always the same, no pin level changing on TX pin PB9, it remains always at 3.3V (looked with a scope meter), it seems that the CAN cell is not connected to the external pins. I'm not using the USB that is disabled, external 8 MHz crystal with PLL to have 72MHz clock. The code works because I have a LED that correctly toggle its status every 1 second, after a while the CANtransmit function HAL_CAN_AddTxMessage(..) return an error because it doesn't find a free trasmit mailbox. Attached the main function, please help

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

The value 1 is very small for BS1. Try to select a prescaler value as less as possible and BS1 and BS2 values as greater as possible with BS1 > BS2.

Example:


_legacyfs_online_stmicro_images_0693W00000binswQAA.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.

View solution in original post

12 REPLIES 12
SofLit
ST Employee

Hi,

See the thread.

How are you sure it is a genuine ST chip? you can see this link.

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.

Also CAN/USB can't be used concurrently on these F1 parts

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
APrim.2
Associate II

I answer from another account because the other one (GRosi.1) has problems.

@Community member​ : How are you sure it is a genuine ST chip? =>

  • I asked the seller before to buy if the microcontroller was a genuine ST and he answered it was
  • On the microcontroller there is stamped the model and the ST logo (may be you can understand if the char used is an ST one and/or if the ST logo is correct)
  • I had in the past a blue pill board with a non genuine microcontroller (but the microcontroller was not the STM32F103C8T6) and with the ST LINK it does not connect with the STM32CubeIDE while this one connect and correctly debug with STM32CubeIDE

For this reasons, I thought the chip is a genuine one.

Anyway, have you seen my code? is it correct? if it is supposed to be correct and should work, then for sure I have a counterfait microcontroller.

Is there a check (visual or digital) I can do to understand if the chip is genuine? I attach a picture of the microcontroller. Thank you for your support.

@Community member​ Also CAN/USB can't be used concurrently on these F1 parts => Did you carefully read my previous post? I'm not using the USB that is disabled

SofLit
ST Employee

Hi,

Did you try the Loopback mode before going to Normal mode? If not, I suggest to do it in order to, at least, validate the CAN cell.

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.
APrim.2
Associate II

Hi, I tested also the loopback mode, silent mode and loopback mode combined with silent mode and it is always the same, no message transmitted/received at all.

SofLit
ST Employee

Could you please share your project in loopback mode (not only the main file) including your IOC file? this helps community members to help you.

Thank you

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.
APrim.2
Associate II

Sure, here you have.

Thank you

Hi,

The value 1 is very small for BS1. Try to select a prescaler value as less as possible and BS1 and BS2 values as greater as possible with BS1 > BS2.

Example:


_legacyfs_online_stmicro_images_0693W00000binswQAA.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.

>>Did you carefully read my previous post? I'm not using the USB that is disabled

Generally I just skim things, weighting what is and is not said. The Blue Pill boards are often used with loaders that can/do use USB as a means to get data/applications loaded on them. Assuming you didn't have an ST-LINK attached, as it wasn't mentioned, so also assuming you didn't inspect any of the peripheral registers..

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