Skip to main content
Graduate
November 30, 2023
Question

STM32F072 CAN LoopBack error on logic analyzer

  • November 30, 2023
  • 1 reply
  • 1100 views
 

Dear reader,

I am trying to get the CAN peripheral on my STM32-NUCLEO board working. To start off i wanted to test the loopback mode before I hooked up my transceiver circuit.

Heres my init code for the can peripheral generated by CubeMX:

Oli98_1-1701379345715.png

Heres my CAN MSPinit code:

Oli98_2-1701379430426.png

Heres my main where im attempting to send a messaeg through the peripheral:

Oli98_3-1701379475889.png

I also used the CAN Bit Time Calculation (can-wiki.info) to find the correct settings for my CAN perpheral aswell as shown here: 

Oli98_4-1701379662680.png

 And this is the output from my logic analyzer, i of course checked that the bit rates matched aswell:

Oli98_5-1701379735891.png

The callback function to receive messages is never called as the RX pin on the CAN peripheral is always high, im very stumped by this and have seen various tutorials online and cant figure out if im missing something.

Any help would be greatly appreciated!

    This topic has been closed for replies.

    1 reply

    Graduate II
    November 30, 2023

    You haven't shown any CAN filter configuration

    Oli98Author
    Graduate
    December 1, 2023

    Hi Karl!

    Thankyou for the reply, my filter settings:

    Oli98_0-1701422607256.png

    My aplogies I didnt think these were important at this stage as I was trying to get my transmission working from the peripheral first.