cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN not working with STM32U5F7

Hareesh_S
Associate II

I'm using a custom board with an STM32U5F7. Written a program(with nothing else configured other than clock and FDCAN) that simply sends out a message via FDCAN (in classis mode, 500kbps) which I'm hoping to receive using a P-CAN. When probing the TX line going to my transceiver using an oscilloscope there seems to be no data being transmitted, the line is just pulled high to 3V3. 

 

The same board populated with an STM32U599 running a new project with the same configuration and same code is able to successfully send messages which I can scope on the TX line.

 

With the STM32U5F7, I have tried internal loopback mode to rule out any hardware related issues (following the FDCAN loopback walkthrough on ST's YouTube) but I'm not receiving messages as well.

 

Not sure what to make of this or how to diagnose and fix the issue I'm facing any further than this. Any input would be highly appreciated 

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello @Hareesh_S ,

Another customer faced an issue with FDCAN with the same part number.

After an internal task force, it turns out that STM32U5F7 part number doesn't support FDCAN. It's disabled by hardware. 

What we propose is to use STM32U5G7 part number instead.

Sorry for any inconvenience.

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.

View solution in original post

21 REPLIES 21
SofLit
ST Employee

Hello @Hareesh_S and welcome to the ST community.

As loopback is not working, are you sure about the filter config?

If possible to attach your project including the ioc file.

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.

Hello,
I've attached my project file below, including the IOC file - this project is curently setup to use external loopback, but I tried internal prior to it, with no avail.
With regards to filter config - I'm not exactly sure myself - which is why my initial test for bring-up was only to send out messages from my board, discarding the need of filter configuration in the first place. Regardless, for loopback mode, I have copied the filter configuration from tutorials I was following - though I have omitted seemingly deprecated code.

Thank you for your reply!
(And apologies for the delay in mine - time zone differences)

Hello,

1- You configured your CAN interface in Classic mode, while you are transmitting frames in FD mode:

hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;

And you are transmitting data in FD mode

TxHeader.FDFormat = FDCAN_FD_CAN;

So change it to FDCAN_CLASSIC_CAN.

2- Data lenght needs to be =< 8 but your DLC is set to 12:

TxHeader.DataLength = FDCAN_DLC_BYTES_12;

 So, change it to 8.

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.
Hareesh_S
Associate II

Hello,

Not sure what happened there, was trying to botch together an example project to send and messed up a few things.
I have made the corrections you have highlighted, but still don't see anything in my RXData buffer.

Do you find anything else wrong in the project I have attached? Reattaching with the changes made for clarity.

I have another project that only sends CAN messages (the code and config for which I know works with the STM32U599, but isn't with the STM32U5F7. Should I attach that project as well?)

Thank you for your reply

Hello,

You are using Interrupts/callback, but you didn't activate the RXFIFO notification interrupt:

Add this line after HAL_FDCAN_ConfigFilter()

 

HAL_FDCAN_ActivateNotification(&hfdcan1, FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0);

 

And no need to activate this notification in the callback as you did:

 

void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs) {
	if ((RxFifo0ITs & FDCAN_IT_RX_FIFO0_NEW_MESSAGE) != RESET) {
		/* Retrieve Rx messages from RX FIFO0 */
		if (HAL_FDCAN_GetRxMessage(hfdcan, FDCAN_RX_FIFO0, &RxHeader, RxData)
				!= HAL_OK) {
			Error_Handler();
		}
		if (HAL_FDCAN_ActivateNotification(hfdcan,
		FDCAN_IT_RX_FIFO0_NEW_MESSAGE, 0) != HAL_OK) {
			Error_Handler();
		}
	}
}

 

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.
Hareesh_S
Associate II

Hello,
I have made the changes you have pointed out, including a screenshot as I think it would be easier for you to access, given that I have not changed anything else. I am still not getting any data in my RXData buffer though.

Hareesh_S_0-1726488262902.png

Hareesh_S_1-1726488301745.png

 

I appreciate your patience in assisting me solve my issues,
Thank you!

Hello,

First, please don't use screeshots to show your code. You need just to paste your code using </> button.

Second, unfortunately I don't have a STM32U5F7 board to test.

Try to change the filter config either:

By replacing:

sFilterConfig.FilterType = FDCAN_FILTER_MASK;

by:

sFilterConfig.FilterType = FDCAN_FILTER_DUAL;

 or keeping filter mask config and replace:

	sFilterConfig.FilterID2 = 0x11;

by:

sFilterConfig.FilterID2 = 0x7FF;

 

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.
Hareesh_S
Associate II

Hello

1) Apologies, I will keep in mind henceforth to avoid screenshots.
2) Tried both suggestions, isn't working.
3) I think it would be more productive at this point if instead of loopback, we simply try sending out a CAN message instead, since I have access to an oscilloscope and a P-CAN and can verify if it is functioning as intended + it removes any extra variables from the equation.

I have attached a project below that only sends out a standard CAN message every 100ms. If you don't mind, please check this one out.

Thanks again


@Hareesh_S wrote:

3) I think it would be more productive at this point if instead of loopback, we simply try sending out a CAN message instead, 


I don't recommend that. If you didn't succeed in loopback mode, I don't think you can succeed with Normal mode.

As you have an oscilloscope, and with external loopback mode do you get any frame on CAN_Tx?

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.