cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with receiving FDCAN data with STM3232H750

revvathi
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions

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.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

View solution in original post

10 REPLIES 10
SofLit
ST Employee

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.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

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 

Hello,

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

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

You can check out the code copy attached below

 

Better to share the complete project.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

it isnt supporting the file type

 

Compress your project with .rar or .zip format

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

you can find the attached zip file for the whole test sample project 

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.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.