Skip to main content
Associate
November 23, 2023
Solved

CAN interface between two STM32F373C8 microcontrollers

  • November 23, 2023
  • 2 replies
  • 1155 views

Hi, I want to use CAN interface to transfer integer data from one micro controller to another. I am using STM32F373C8 microcontrollers. Please brief me the hardware connection too, from google I understand following.

uC1-------------------uC2

CAN_H----------------CAN_H

CAN_L------------------CAN_L

GND----------------------GND

But in our case we have , CAN_Tx and CAN_Rx pins. I have also swapped the pins for transmission. The boards are placed quite close to each other. I have implemented the ChatGPT code, but it stucks some where in receiving. I am attaching my main file here. Please guide me as soon as possible

    This topic has been closed for replies.
    Best answer by STTwo-32

    Hello @Hassanfraz and welcome to the ST Community :smiling_face_with_smiling_eyes:.

    I suggest you to use this exemple as a start for your project. This Can guide you on the configurations of your project. 

    PS: don't forget to take a look at the README file of the project.

    Best Regards.

    STTwo-32 

    2 replies

    STTwo-32
    STTwo-32Best answer
    Technical Moderator
    November 23, 2023

    Hello @Hassanfraz and welcome to the ST Community :smiling_face_with_smiling_eyes:.

    I suggest you to use this exemple as a start for your project. This Can guide you on the configurations of your project. 

    PS: don't forget to take a look at the README file of the project.

    Best Regards.

    STTwo-32 

    To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    Associate
    November 24, 2023

    Please look at my question again, I think there is any hardware issue. I am not using any discovery board, I have two independent controllers and connections are as below. 

            uC1         ------------------       uC2

    CAN_TX(A12)------------------CAN_RX(A11)

    CAN_RX(A11)------------------CAN_TX(A12)

    GND----------------------GND

    Furthermore when i compile the software it struck in the transmit routine, on the following line.

    if (HAL_CAN_AddTxMessage(&CanHandle, &TxHeader, TxData, &TxMailbox) != HAL_OK)

    {

    /* Transmission request Error */

    Error_Handler();

    }

     Please guide me about the hardware as well.