Skip to main content
Visitor II
October 12, 2025
Question

STM32 Blue Pill CAN Issues

  • October 12, 2025
  • 3 replies
  • 1086 views

The board has passed a authentication test so I currently believe it is a me issue. 

I have been trying to get a CAN bus going using the STM32 Blue Pill board with a TJA1050 CAN Transceiver, but for some reason even with basically copy pasted example code I don't even get activity on the lines. The transceiver modules I am using has the CAN bus terminating resistors built in resulting in a 60ohm resistance between the H and L lines. I've ended up putting together a basic test Tx and Rx bread board in hopes of figuring out whats going on with no clues. The Tx loop eventually goes dead for some reason which makes me think the HAL_addTx started locking up. Linked is a github repository with both projects. Also a video of the boards. 

    This topic has been closed for replies.

    3 replies

    Graduate
    October 13, 2025

    Looks like the baud rate is different for each board.  Both boards have to be using the same baud rate.  When I tried working with CAN, I followed the ControllersTech videos he did regarding CAN.


    STM32 CAN Communication Explained | Send & Receive Data Between Two Microcontrollers 

    Kindest regards

    RetroBuzzAuthor
    Visitor II
    October 13, 2025

    Thanks for the response. The baud rate was a missed clock config setting. Unfortunately there was no change and still no activity even in the canRx and canTx lines. I used their web tutorial when making this but tomorrow after work I will go through that video and what I have and see if I can figure it out.

    Graduate
    October 14, 2025

    @RetroBuzz 

    I tried your CAN Tx Test and it seems to be working fine:

    kumaichi_0-1760408050424.png

    I don't think I made any changes, but I attached the project to this message.  Note that I don't have anything connected to the STM32F103C8T6 except for the TJA1050.  I don't even have a 120 Ohm resistor.  I just have the output of the TJA1050 connected directly to the logic analyzer.  I would start there, remove everything and make sure the logic analyzer is showing the data being sent, at least then you know the data is being put out on the wire.

    Best of luck!

    Kindest regards

    Graduate II
    October 15, 2025

    First, check if loop back mode works so you know the CAN peripheral is working.

    Then run in debug mode on the Transmitting node. Check the CAN_ESR register. More than like the TEC counter is increasing probably due to something not connected correctly.  

    RetroBuzzAuthor
    Visitor II
    October 15, 2025

    Loopback has worked on at least one board type before. As soon as go into debug mode it runs what seems like half a loop and dies. I got the HiLetGo boards and they do the same. Can I get someone else to test the project on a known genuine board too. I should be getting CANTx data with just the board nothing else but I don't get anything on now 4 board variants. I think I am going to order genuine chips and swap them in. Maybe bluepill diagnostics just made fakes better. I have tried multiple code projects, boards, connections, data analyzer/scopes. I think I am getting nothing but non genuine boards. 

    RetroBuzzAuthor
    Visitor II
    October 16, 2025

    Just added Loopback to the Tx Test on GitHub and they seem to be failing. The peripheral is manually set to loopback with mx. There only is one chip that visually seems distinctly authentic. On the HiLetGo board but still it didn’t pass anything. Also in programmer they all show up the same 0x410 and Version X which isn't marked on any chip. 

    IMG_6772.jpeg

    image.jpg

    IMG_6770.jpeg

    RetroBuzzAuthor
    Visitor II
    October 26, 2025

    I’ve determined it is not because of non genuine chips. Bought some from mouser and replaced it. Still has the same activity. I plan on setting up CAN on another microcontroller to see if I can determine where my issue is. I may provide a wiring diagram soon.