cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 FDCAN node sees nothing on bus when CAN-to-USB adapter removed

aqua_dev
Associate

Board & Setup:

  • STM32H563RGT6 running FDCAN2 in Normal mode (HAL_FDCAN_Init, Mode=FDCAN_MODE_NORMAL)

  • SN65HVD230 transceiver in silent mode (Rs pin connected to 3.3V) (120 Ω intergrated) wired with a single 120 Ω terminator at the far end

  • No other pull-up/down or termination changes when the USB–CAN dongle is unplugged

  • Filters configured (Reading the data from the BMS of a custom battery):

    • FIFO0 → IDs 0x1E0 (BMS_STATE), 0x1E2 (PACK_MINMAX), 0x1E3 (PACK_AVG)

    • FIFO1 → ID 0x1E1 (PACK_VALUES)

Symptom:

  • With the USB–CAN adapter or another node on the bus, everything works: the real BMS sends all four messages, our STM32 ACKs them, and they appear in Cangaroo.

  • As soon as the USB–CAN dongle is unplugged (or if our transceiver is switched to any other mode -> Slope control or High speed (no slope control)), no messages are observed on the bus—even though the BMS should still be broadcasting at 1 Hz (it constantly spits out data at a 1 Hz rate) and our STM32 is in Normal mode.

What I need:

  1. Keep the SN65HVD230 in Normal (ACK-capable) mode—tie its RS pin LOW (or drive it low in GPIO init).

  2. Still “ignore” any frames I transmit (because I’m not sending any), so that I only see the BMS frames.

How do I ensure my SN65HVD230 is always in normal, ACK-capable mode (so the BMS sees at least one ACK and keeps talking), while my STM32 itself continues to filter out any of its own (non-existent) messages so I only capture IDs 0x1E0–0x1E3?

***My STM32CubeIDE "main.c" is given in attachments.

26 REPLIES 26

Your seg2 is almost the same as seg1. So your sampling point is almost in the middle. You want to sample close to 87% give or take

 

If the FDCAN clock is 50MHz, then try these values

KarlYamashita_0-1748622752374.png

 

 

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

I changed to the typedef union which is practical, but does not eliminate the problem of the communication. Also I changed to HSE clock which is 12 MHz in my case so I now have different parameters for the same bitrate (250 kbits/s), but it does not seem to be the solution.

Please attach your 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.

I'm using my 12 MHz HSE with these parameters.

Here's my .ioc file as of now.

If you are using HSE for the FDCAN, do you actually have an external oscillator? If so, what frequency?

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.
Karl Yamashita
Principal

Assuming you have an external clock at 12MHz, try the attached IOC changed to use 66MHz and use the values below. I have values for 12MHz as well

 

 Baud 250000 bit/s
FDCAN clock freq(kHz)seg1seg2 prescaler
120003981
66000219441
Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.