cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L5 CANBUS timing setting optimization

Linas L
Senior II

Hello. This is my first project with CANBus and i have some questions:

I need to interface to motorcycle canbus system, and it is running at 500kbps.

All i did is tuned parameters based on scope timings to get 2us/bit. and yes, it did start working, can read messages no problem, as well as send it.

Question is is there optimum register setting, or any setting will do the trick ? (running110MHz 9ns)

  hfdcan1.Instance = FDCAN1;
  hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
  hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
  hfdcan1.Init.AutoRetransmission = DISABLE;//;
  hfdcan1.Init.TransmitPause = ENABLE;
  hfdcan1.Init.ProtocolException = DISABLE;
  hfdcan1.Init.NominalPrescaler = 1;
  hfdcan1.Init.NominalSyncJumpWidth = 50;
  hfdcan1.Init.NominalTimeSeg1 =160 ;
  hfdcan1.Init.NominalTimeSeg2 = 60;
  hfdcan1.Init.DataPrescaler = 1;
  hfdcan1.Init.DataSyncJumpWidth = 4;
  hfdcan1.Init.DataTimeSeg1 = 5;
  hfdcan1.Init.DataTimeSeg2 =4;
  hfdcan1.Init.StdFiltersNbr = 1;
  hfdcan1.Init.ExtFiltersNbr = 0;
  hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;

Is this setting correct ? also what should i do with :

  hfdcan1.Init.DataPrescaler = 1;
  hfdcan1.Init.DataSyncJumpWidth = 4;
  hfdcan1.Init.DataTimeSeg1 = 5;
  hfdcan1.Init.DataTimeSeg2 =4;
  hfdcan1.Init.StdFiltersNbr = 1;
  hfdcan1.Init.ExtFiltersNbr = 0;

I did not change this part from example that says it runs 1Mbps

Thank you all for insight !

0 REPLIES 0