2023-04-20 03:45 AM
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
Solved! Go to Solution.
2023-04-25 09:45 AM - edited 2023-11-20 07:36 AM
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:
2023-04-20 06:37 AM
2023-04-20 06:39 AM
Also CAN/USB can't be used concurrently on these F1 parts
2023-04-20 11:44 PM
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? =>
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
2023-04-25 04:33 AM
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.
2023-04-25 09:10 AM
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.
2023-04-25 09:24 AM
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
2023-04-25 09:30 AM
2023-04-25 09:45 AM - edited 2023-11-20 07:36 AM
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:
2023-04-25 09:45 AM
>>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..