cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32H7 Can bus communication issue

Amogh
Associate III

Hello

I am having an weird issue and was hoping if someone could provide some guidance.

Hardware :

  1. Two Stm32 H7 with CAN Transciever
  2. Nvidia Orin
  3. Can Adapter/Sniffer (Canable)


What works : 

  1. Stm32H7 to Stm32H7 Nucleo Board Can Bus works.
  2. Nvidia Orin < - > Canable Adapter Can bus works.

Issue :

  1. Can bus communication from stm32 H7 to Canable Adapter are not coming through. neither Tx nor Rx.


What have i done to troubleshoot

  1. Checked wirings for High to High and Low to Low and Tx and Rx as well.
  2. Checked voltages for Rx pins at 3.3v( using level shifters wit h transciever)
  3. Checked termination resistance and have tested the connections in isolation with both ends terminated with 120ohms ie (stm32- > stm32, Stm32-> adapter, Stm32 -> Orin)
  4. I have tested with different baud baud rate like 250, 444, 450, 440, 500k.
  5. Tried different Bit Timing Parameters but to no avail.


Below are my FDCan Parmeters from ioc file.

FDCAN1.AutoRetransmission=ENABLE
FDCAN1.CalculateBaudRateNominal=444444
FDCAN1.CalculateTimeBitNominal=2250
FDCAN1.CalculateTimeQuantumNominal=187.5
FDCAN1.ClockCalibrationCCU=DISABLE
FDCAN1.DataPrescaler=2
FDCAN1.DataSyncJumpWidth=4
FDCAN1.DataTimeSeg1=10
FDCAN1.DataTimeSeg2=3
FDCAN1.FrameFormat=FDCAN_FRAME_CLASSIC
FDCAN1.IPParameters=CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,Mode,AutoRetransmission,FrameFormat,NominalSyncJumpWidth,DataSyncJumpWidth,DataTimeSeg1,DataTimeSeg2,StdFiltersNbr,RxBuffersNbr,RxBufferSize,TxEventsNbr,TxBuffersNbr,TxElmtSize,NominalPrescaler,NominalTimeSeg1,NominalTimeSeg2,DataPrescaler,RxFifo1ElmtsNbr,TxFifoQueueElmtsNbr,RxFifo0ElmtsNbr,ClockCalibrationCCU,ProtocolException
FDCAN1.Mode=FDCAN_MODE_NORMAL
FDCAN1.NominalPrescaler=8
FDCAN1.NominalSyncJumpWidth=1
FDCAN1.NominalTimeSeg1=6
FDCAN1.NominalTimeSeg2=5
FDCAN1.ProtocolException=ENABLE
FDCAN1.RxBufferSize=FDCAN_DATA_BYTES_12
FDCAN1.RxBuffersNbr=10
FDCAN1.RxFifo0ElmtsNbr=10
FDCAN1.RxFifo1ElmtsNbr=10
FDCAN1.StdFiltersNbr=0
FDCAN1.TxBuffersNbr=10
FDCAN1.TxElmtSize=FDCAN_DATA_BYTES_12
FDCAN1.TxEventsNbr=10
FDCAN1.TxFifoQueueElmtsNbr=10


can anyone please advise on what to do to make STM32 communication work with other CAN devices?

17 REPLIES 17

Don't forget to check:

SB72 and R5 should be soldered:

SofLit_1-1718213195992.png

 

SofLit_0-1718213103852.png

 

 

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.

Thank you once again for the response and all the help thus far!

I tried what you suggested, but seems like I am still missing something.

  • configured HSE to use Nucleo Clock.
  • Changed clock configuration for HSE ->PLL1Q and PLL1Q -> FDCAN
  • Input clock changed to 8 mhz.
  • Set Bit parameters for 500k as shown in 3.FDCan.png
  • Verified SB72 is jumped and R5 is present. do I need to remove R5 and jump it?

    can you please review one more time and provide some more ideas as to what might not be going right..

8. SB.jpg

10. clock page 1.png

11. clock page 2.png

   

Karl Yamashita
Lead III

draw a block diagram of how you're connecting the H7/CAN transceiver to the Canable. Include the terminating resistors, ground reference. Is the terminating resistor on the Canable enabled? 

 

Canable are made from all kinds of 3rd party vendors. Some have isolation circuits. Do you have V1, V1 Pro or V2 of the Canable? A link to the Canable would help. 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Hello,

"do I need to remove R5 and jump it?"

-> No need for that.

Could you please check with an oscilloscope the HSE frequency using MCO pin (PA8)? Do you get 8MHz?

I've attached your ioc file where I enabled MCO on PA8 to output a mirror of the HSE signal.

Need also to share with us more details about your HW, the transceivers part number (if possible the schematics of that part) you are using and as stated by @Karl Yamashita a block diagram of your connections and check the availability termination resistors at each node side: you need only two terminating resistors (no more nor less) of 120 ohm at both sides of the bus.

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,

Good evening,

Sorry I could not get back earlier.   

Please see below for the transceivers and the schematics of the circuits.     

12. MCP Transciever.jpg

13. NXP Tranciever.jpg

14.Can Sniffer.jpg

15. Level Shifter.jpg

16. stm32 to stm32 works.png

17. stm32 to laptop.png

18. stm32 to Orin.png

Please note I don't have a scope, and I have just ordered one and will take me a couple days to report the results.

Meanwhile, can you please give me any other ideas to try? I am going to try again with a with a different baud rates, but other than that I don't have any other ideas...

Have a good evening!!

Thank you for all your help thus far!!

 

Karl Yamashita
Lead III

More than likely the level shifter is causing an issue. An oscilloscope will help determine what is going on.

Also, I assume that you didn't connect the 3.3V to ground as shown in the schematic?

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
Amogh
Associate III

Hi Karl,

Yea, in first image stm32 to stm32 where can bus works there was an error with wiring. please see attached revised.  

 

In my opinion level shifter is not the culprit because stm32->stm32 can bus works. Would you not agree?

So to conclude, I will report how does HSE/MCO on PA8 mirror looks like tomorrow once the scope arrives. 

 

Thank you!

 

 

Amogh
Associate III

Thanks @Karl Yamashita @SofLit 

My Can BUS works. I think it was a combination of clock, Bit timing parameters, and (maybe) RCC Prescaler disabled.

 

Thank you soo very much!!