Skip to main content
Mattkai45
Visitor II
January 28, 2020
Question

STM32F446 CAN bus 500kbps Crystal/Crystal-less

  • January 28, 2020
  • 1 reply
  • 882 views

I am working on an automotive product that will interface with the vehicle's CAN bus network running at 500kbps. My question is, is the STM32F446 capable of reliable communication without a crystal? Or is it absolutely necessary? The last thing I would want is the MCU crashing the vehicle's network.

Currently I have the CAN peripheral clock at 45Mhz, Prescaler = 5, TimeSeg1 = 13, TimeSeg2 = 4.

/***********************************************
 * Baud Rate: 500kbps
 * Clock Speed: 45Mhz
 * Prescalar: 5
 * CAN periph. clock speed: 9Mhz => (45Mhz / 5)
 * Time Quanta (Tq): 18 => (13 + 4 + 1)
 * Time Quanta seg 1: 13
 * Time Quanta seg 2: 4
 * Time Quanta sync width: 1
 ***********************************************/
 
/* USER CODE END 0 */
 
CAN_HandleTypeDef hcan1;
 
/* CAN1 init function */
void MX_CAN1_Init(void)
{
 
 hcan1.Instance = CAN1;
 hcan1.Init.Prescaler = 5;
 hcan1.Init.Mode = CAN_MODE_NORMAL;
 hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
 hcan1.Init.TimeSeg1 = CAN_BS1_13TQ;
 hcan1.Init.TimeSeg2 = CAN_BS2_4TQ;
 hcan1.Init.TimeTriggeredMode = DISABLE;
 hcan1.Init.AutoBusOff = DISABLE;
 hcan1.Init.AutoWakeUp = DISABLE;
 hcan1.Init.AutoRetransmission = DISABLE;
 hcan1.Init.ReceiveFifoLocked = DISABLE;
 hcan1.Init.TransmitFifoPriority = DISABLE;
 if (HAL_CAN_Init(&hcan1) != HAL_OK)
 {
 Error_Handler();
 }
}

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
January 28, 2020

Pretty sure you need a crystal to hit +/- tolerance on the bus, check specs for CAN bus

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..