2025-11-06 4:22 PM - last edited on 2025-11-07 1:46 AM by Andrew Neil
I’m testing a very simple setup with two STM32F103C8T6 (Bluepill) boards.
The goal is just to send data from my PC to one STM32 through UART, and then transmit it over CAN to another STM32 board.
Data flow:
Hardware used:
Two STM32F103C8T6 boards
MCP2551 CAN transceivers
120 Ω termination resistors at both ends
Common ground between boards
UART baud: 115200
CAN bit rate: 1 Mbps (Prescaler = 2, BS1 = 15, BS2 = 2)
The PC is successfully sending UART data using Python (PySerial).
The STM32 transmitter receives the data correctly — UART works fine.
The DMA callbacks trigger as expected, showing that data reception over UART is confirmed.
The CAN bus is not showing any transmission or response.
The transmitter’s CAN doesn’t seem to send anything, even though initialization completes without errors.
The receiver board also does not detect or print anything over UART.
No CAN interrupts are triggered on either board.
UART communication from PC to STM32 is verified and working.
However, the CAN side shows no activity — no transmission, no reception, and no response from either STM32 board.
I just need help understanding why the CAN is completely silent even though everything initializes correctly in CubeIDE..... All codes are below
:white_heavy_check_mark:In short:
PC → UART → STM32 works fine,
but STM32 → CAN → STM32 shows no response at all.
Solved! Go to Solution.
2025-11-07 4:09 PM
Yes, so the setup is working now ... turns out it was problem with my hardware..... my usb cable extender was old and gave a lot of error..... after shifting to a usb hub i got proper responsive echo ......no problem with the bluepills
2025-11-06 7:42 PM
You can create a software loopback of CAN and see if the data is received back. Same data can be repeated..
2025-11-06 10:31 PM
> However, the CAN side shows no activity — no transmission, no reception, and no response from either STM32 board.
> I just need help understanding why the CAN is completely silent even though everything initializes correctly in CubeIDE..... All codes are below
I recommend to check out other threads related to CAN here.
Not sure if you understand that, but a CAN node cannot work on a bus alone.
Check the Txe and Txe counters in the CAN peripheral when you try to send.
2025-11-06 11:31 PM
So you mean to say that CAN loopback wont work...
"Check the Txe and Txe counters in the CAN peripheral when you try to send."....Im fairly new to C programming and stm32 .....Can you please elaborate on how I can debug the bluepill
2025-11-06 11:34 PM
I tried to do that but whenever I went to debug and see SFR for CAN registers .... then ran the code it didnt work ....Ig it switches between the debug mode and running mode ..... I have an stlinkv2 ....please help as well....Is there anything else you found
2025-11-07 12:41 AM
24.5.2 Loop back mode
The bxCAN can be set in Loop Back Mode by setting the LBKM bit in the CAN_BTR
register. In Loop Back Mode, the bxCAN treats its own transmitted messages as received
messages and stores them (if they pass acceptance filtering) in a Receive mailbox.
Figure 226. bxCAN in loop back mode
This mode is provided for self-test functions. To be independent of external events, the CAN
Core ignores acknowledge errors (no dominant bit sampled in the acknowledge slot of a
data / remote frame) in Loop Back Mode. In this mode, the bxCAN performs an internal
feedback from its Tx output to its Rx input. The actual value of the CANRX input pin is
disregarded by the bxCAN. The transmitted messages can be monitored on the CANTX pin
2025-11-07 12:48 AM
Another suggestion is to pump data to a known CAN bus such as Arduino using mcp2515 which is sure to work in all modes. There you can test the RX data and TX data easily. or use any CAN Analyzer.
2025-11-07 12:59 AM
https://controllerstech.com/can-protocol-in-stm32/
2025-11-07 2:13 AM - edited 2025-11-07 2:19 AM
Hello,
Unfortunately, you are using STM32F103C8T6 (Bluepill) which I almost sure it contains a counterfeit STM32 product.
It was discussed many times here in this community.
I suggest to use boards from ST, Ex: NUCLEO-F103RB instead.
+
You can refer to these articles:
Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 1)
Using CAN (bxCAN) in Normal mode with STM32 microcontrollers (Part 2)
2025-11-07 4:09 PM
Yes, so the setup is working now ... turns out it was problem with my hardware..... my usb cable extender was old and gave a lot of error..... after shifting to a usb hub i got proper responsive echo ......no problem with the bluepills