2024-06-11 09:47 AM - last edited on 2024-06-12 02:33 AM by SofLit
Hello
I am having an weird issue and was hoping if someone could provide some guidance.
Hardware :
What works :
Issue :
What have i done to troubleshoot
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?
Solved! Go to Solution.
2024-06-12 09:59 AM - edited 2024-06-12 10:12 AM
Ah! How the FDCAN is clock sourced if there was no clock source then ;) ?
As per your ioc file FDCAN clock source is HSE and there is no external clock source!
I suggest to set the clock source in Bypass mode and
Use STLINK-MCO output as clock source for the system clock and select one of the PLLs output for FDCAN clock source.
For this you need to download ST-LINK firmware upgrade tool from here: https://www.st.com/en/development-tools/stsw-link007.html
connect to ST LINK and select one of the STLINK-MCO HSE clock source (to select 8MHz as external clock) as indicated in the following figure:
I propose you that clock config with a FDCAN timings at 500kb/s (ioc in attachment)
Hope I answered your question.
2024-06-11 06:08 PM
Have you check with oscilloscope to be sure the H7 is sending messages?
Have you checked the HAL status when you call HAL_FDCAN_AddMessageToTxFifoQ or HAL_FDCAN_AddMessageToTxBuffer?
How about communication between H7 and Nvidia Orin?
2024-06-11 06:51 PM - edited 2024-06-11 06:54 PM
Yea, so I connected two H7's /Nucleo's together and transferred Random #'s from 1 to other and vice-versa and checked on screen/serial monitor that they are received. So this implies CAN configuration is working but it seems I need to set a specific bit timing a generic baud rate. is there a recommended set of parameters for H7? Any baud rate is okay for now.
I dont have a oscilloscope, but so far H7 and Nvidia Orin is also not working. Nvidia Orin to CAN Adapter is working.
2024-06-12 01:52 AM - edited 2024-06-12 01:58 AM
Hello,
As you're using a NUCLEO board, what about your clock config? What is the FDCAN clock source: HSI? or HSE in BYPASS mode using STLINK MCO? If STLINK MCO you need also to check the clock source of the ST-LINK. For this you need to specify what is the NUCLEO board you're using.
Could you please attach your ioc file?
I'm suspecting something related to the clock source/ clock config.
PS: as you're in CLASSIC mode no need to configure data phase timing as it is discarded in that mode:
FDCAN1.DataPrescaler=2
FDCAN1.DataSyncJumpWidth=4
FDCAN1.DataTimeSeg1=10
FDCAN1.DataTimeSeg2=3
2024-06-12 05:53 AM - edited 2024-06-12 05:55 AM
Hello,
Thank you for reading the issue and responding!!
Thank you in advance!
Have a good day!
2024-06-12 06:31 AM
Humm well and thank you for the sharing.
Still one thing to check:
In the schematics HSE crystal is not fitted:
and in your clock config you set HSE to 24MHz as an external clock source. Did you solder that 24MHz crystal with its respective capacitors?
2024-06-12 06:33 AM - edited 2024-06-12 07:39 AM
Hi again,
Just noticed that your RCC clock source is set to HSI (64MHz) in your ioc file:
Could you please confirm/check?
2024-06-12 07:43 AM
Sorry: Discard my previous comment about HSI clock source in your ioc file as your FDCAN clock source is HSE:
So please tell if you've already soldered a 24MHz crystal with its respective capacitors!
2024-06-12 09:32 AM - edited 2024-06-12 09:43 AM
No I havent soldered anything yet on the Nucleo board. I dint really think HSE would require me solder anything on the nucleo board... My Apologies!!
To resolve the can bus issue now, should I use PLL1Q (42.6667 Mhz)? If yes, can you please recommend some Bit Timing Parameters as well for a few common baud rates.
2024-06-12 09:59 AM - edited 2024-06-12 10:12 AM
Ah! How the FDCAN is clock sourced if there was no clock source then ;) ?
As per your ioc file FDCAN clock source is HSE and there is no external clock source!
I suggest to set the clock source in Bypass mode and
Use STLINK-MCO output as clock source for the system clock and select one of the PLLs output for FDCAN clock source.
For this you need to download ST-LINK firmware upgrade tool from here: https://www.st.com/en/development-tools/stsw-link007.html
connect to ST LINK and select one of the STLINK-MCO HSE clock source (to select 8MHz as external clock) as indicated in the following figure:
I propose you that clock config with a FDCAN timings at 500kb/s (ioc in attachment)
Hope I answered your question.