Skip to main content
Visitor II
January 28, 2025
Solved

Issue with receiving FDCAN data with STM3232H750

  • January 28, 2025
  • 1 reply
  • 1656 views

I have debugged the whole code to send data from stm32h750b-dk between the two fdcan terminals fdcan1 and fdcan2 the data is appearing on live expressions of txdata1 but in rxdata only 1 bit is being transferred can somebody mention what the problem could be 
all my parameters are adjusted accurately 

Txdata[2]={7,8};

this is the output which is shown can somebody help me out on wtt could be done

kl.png

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

    Thank your for the sharing.

    You didn't activate the FDCAN2 IRQ:

    SofLit_1-1738159685333.png

    I'm attaching your project (modified) where FDCAN2 is receiving these two bytes.

    This is a screen shot of the debug session, the bytes 7 and 8 are well received with FDCAN2 and a counter counting the number of the reception I've added in the example:

    SofLit_2-1738160602391.png

    Another thing to add:

    In the sending operation you didn't wait for the Tx FIFO to be empty which will cause a send error.

    I've added it as the following:

     	while((hfdcan1.Instance->TXFQS & FDCAN_TXFQS_TFQF) != 0U); // wait for Tx FIFO to be empty
     	status = HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &TxHeader1, TxData1);
     if (status != HAL_OK)
     {
     Error_Handler();
     }
     }

    Don't forget to fit the jumpers JP6 and JP7 to connect the CAN terminating resistors (120ohm) on the board.

    A recommendation before running the example I shared, please update to the latest version of STM32CubeMx V6.13.0.

    Hope that helps.

    1 reply

    Technical Moderator
    January 28, 2025

    Hello @revvathi and welcome to the community,

    Not sure I've understood the case.

    You said :


    @revvathi wrote:

    I have debugged the whole code to send data from stm32h750d-bk between the two fdcan terminals fdcan1 and fdcan2


    So TxData1 is the buffer sent by FDCAN1 and RxData1 is the data received by FDCAN2?


    @revvathi wrote:

    the data is appearing on live expressions of txdata1 but in rxdata only 1 bit is being transferred


    What do you mean by only "1 bit" is transferred? do you mean 1 byte?

     


    @revvathi wrote:

    Txdata[2]={7,8};


    Here Txdata (do you mean Txdata1?) contains two bytes 7 and 8 but in the live expression it's showing 0 and 7. That's not clear.

    I propose to share your project to look at it closely.

    revvathiAuthor
    Visitor II
    January 29, 2025

    yes Txdata1 is from fdcan1 and rxdata1 being recieved from fdcan2 
    like an array of TxData1={7,8} is being transmitted in my live expressions it only sends '8' to RxData1 and the rest buffer  becomes 0 in TxData1 and other  becomes 7 so basically Rxdata1 is receiving only 1 byte of 8 

    Technical Moderator
    January 29, 2025

    Hello,

    You didn't share your project at least we can check.

    mƎALLEmAnswer
    Technical Moderator
    January 29, 2025

    Thank your for the sharing.

    You didn't activate the FDCAN2 IRQ:

    SofLit_1-1738159685333.png

    I'm attaching your project (modified) where FDCAN2 is receiving these two bytes.

    This is a screen shot of the debug session, the bytes 7 and 8 are well received with FDCAN2 and a counter counting the number of the reception I've added in the example:

    SofLit_2-1738160602391.png

    Another thing to add:

    In the sending operation you didn't wait for the Tx FIFO to be empty which will cause a send error.

    I've added it as the following:

     	while((hfdcan1.Instance->TXFQS & FDCAN_TXFQS_TFQF) != 0U); // wait for Tx FIFO to be empty
     	status = HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &TxHeader1, TxData1);
     if (status != HAL_OK)
     {
     Error_Handler();
     }
     }

    Don't forget to fit the jumpers JP6 and JP7 to connect the CAN terminating resistors (120ohm) on the board.

    A recommendation before running the example I shared, please update to the latest version of STM32CubeMx V6.13.0.

    Hope that helps.

    revvathiAuthor
    Visitor II
    January 29, 2025

    thank u so much it worked after fitting jumpers on jp6 and jp7

    <3