2020-01-28 09:48 AM
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();
}
}
2020-01-28 11:32 AM
Pretty sure you need a crystal to hit +/- tolerance on the bus, check specs for CAN bus