Skip to main content
Visitor II
August 22, 2024
Solved

CAN TX Error

  • August 22, 2024
  • 2 replies
  • 3431 views

Hi,

I am new to ST, trying CAN TX RX Code.

Every time I Transmit Error frame is getting generated instead of Data .

Please  suggest what i am doing wrong in the below code. 

I am sharing my main file

 

Thanks

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,

    These are bad configurations and not recommended values as they are too low.

    Need to increase BS1 and BS2 as match as possible where sample point is around 75% to 85%.

    I'm proposing these values: Prescaler=4, BS1=14, BS2=3.

    SofLit_0-1724659666203.png

    If still having issues you need to share your schematics especially the CAN part including the transceiver and the terminating resistors.

     

    2 replies

    Technical Moderator
    August 22, 2024

    Hello @ssalvi and welcome to the community.

    As you are using Normal mode, you didn't tell if you already established a CAN bus where at least two nodes (your L4 MCU is among them + a CAN transceiver) are connected to it. Did you do that? if not, you cannot use CAN as UART or SPI to use it in standalone as it is or connect externally CAN_Tx to CAN_Rx. You need to use one of the test modes example the LoopBack mode in that case.

     

     

     

    ssalviAuthor
    Visitor II
    August 25, 2024

    Hi @mƎALLEm ,

    This time I have connected my node(Nucleo+MC2551 Transceiver) to another external CAN Bus where i want to receive and send data. I am still sending Error frame.

    I am also not able to put recive in interrupt. I want to read data from 0x100 and 0x200 Msg ID on my bus.

    Also tried by pulling Up RX pin internally, but didnt work.

    PS:- This time i am using NUCLEO-F103RB insted of L476, i guess CAN Configuration on both are same.

     

    regards,

    mƎALLEmAnswer
    Technical Moderator
    August 26, 2024

    Hello,

    These are bad configurations and not recommended values as they are too low.

    Need to increase BS1 and BS2 as match as possible where sample point is around 75% to 85%.

    I'm proposing these values: Prescaler=4, BS1=14, BS2=3.

    SofLit_0-1724659666203.png

    If still having issues you need to share your schematics especially the CAN part including the transceiver and the terminating resistors.

     

    ssalviAuthor
    Visitor II
    August 30, 2024

    Hi @mƎALLEm ,

    Issue resolved thanks .

     

    regards