cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723ZG: FDCAN frame sent successfully but not received (Internal Loopback)

mpek29
Associate II

Hi everyone,

I'm having a hard time with the FDCAN on a NUCLEO-H723ZG. I’ve tried several setups (external with transceivers, external loopback with wires), but I’ve stripped everything back to Internal Loopback mode on FDCAN1 to simplify things.

Current situation: I can actually see that the frame is sent successfully (no TX errors), but the receive interrupt/FIFO never triggers. It’s like the frame is going out into the void and not looping back into the RX FIFO.

I'm using the HAL drivers.

Here are the errors/status I'm getting via printf:

mpek29_0-1768311707302.png

Full code is available here: https://github.com/mpek29/FDCAN-NUCLEO-H723ZG

Has anyone experienced this "TX works but RX fails" issue on the H7 series?

Thanks for any help! mpek29

1 ACCEPTED SOLUTION

Accepted Solutions
mƎALLEm
ST Employee

Hello @mpek29 and welcome to the ST community,

I detected many issues in your project:

1- You set the FDCAN peripheral to send Classic frame but you send an FDCAN frame with BRS OFF!:

  hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
  TxHeader.BitRateSwitch = FDCAN_BRS_OFF;
  TxHeader.FDFormat = FDCAN_FD_CAN;

It should be:

  TxHeader.BitRateSwitch = FDCAN_BRS_OFF;
  TxHeader.FDFormat = FDCAN_CLASSIC_CAN;

2- You didn't set tRxFIFO0 element size nor the Standard filter: number:

  hfdcan1.Init.StdFiltersNbr = 0;
  hfdcan1.Init.RxFifo0ElmtsNbr = 0;

They should be set at least to 1:

  hfdcan1.Init.StdFiltersNbr = 1;
  hfdcan1.Init.RxFifo0ElmtsNbr = 1;

3- Avoid setting 1TQ for one of the time segments:

  hfdcan1.Init.NominalTimeSeg2 = 1;

Try the following bit timing parameters @1Mb/s:

  hfdcan1.Init.NominalPrescaler = 3;
  hfdcan1.Init.NominalTimeSeg1 = 12;
  hfdcan1.Init.NominalTimeSeg2 = 3;

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.

View solution in original post

1 REPLY 1
mƎALLEm
ST Employee

Hello @mpek29 and welcome to the ST community,

I detected many issues in your project:

1- You set the FDCAN peripheral to send Classic frame but you send an FDCAN frame with BRS OFF!:

  hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
  TxHeader.BitRateSwitch = FDCAN_BRS_OFF;
  TxHeader.FDFormat = FDCAN_FD_CAN;

It should be:

  TxHeader.BitRateSwitch = FDCAN_BRS_OFF;
  TxHeader.FDFormat = FDCAN_CLASSIC_CAN;

2- You didn't set tRxFIFO0 element size nor the Standard filter: number:

  hfdcan1.Init.StdFiltersNbr = 0;
  hfdcan1.Init.RxFifo0ElmtsNbr = 0;

They should be set at least to 1:

  hfdcan1.Init.StdFiltersNbr = 1;
  hfdcan1.Init.RxFifo0ElmtsNbr = 1;

3- Avoid setting 1TQ for one of the time segments:

  hfdcan1.Init.NominalTimeSeg2 = 1;

Try the following bit timing parameters @1Mb/s:

  hfdcan1.Init.NominalPrescaler = 3;
  hfdcan1.Init.NominalTimeSeg1 = 12;
  hfdcan1.Init.NominalTimeSeg2 = 3;

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.