使用can1原来使用baud rate:1Mbit,通讯正常
改为:250k ,就无法正常收发数据,请各位帮忙看看问题点所在
#if 0
Can1_Handle.Instance = CAN1;
Can1_Handle.Init.Prescaler = 6;
Can1_Handle.Init.Mode = CAN_MODE_NORMAL;
Can1_Handle.Init.SyncJumpWidth = CAN_SJW_1TQ;
Can1_Handle.Init.TimeSeg1 = CAN_BS1_5TQ;
Can1_Handle.Init.TimeSeg2 = CAN_BS2_3TQ;
Can1_Handle.Init.TimeTriggeredMode = DISABLE;
Can1_Handle.Init.AutoBusOff = ENABLE;
Can1_Handle.Init.AutoWakeUp = ENABLE;
Can1_Handle.Init.AutoRetransmission = DISABLE;
Can1_Handle.Init.ReceiveFifoLocked = DISABLE;
Can1_Handle.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&Can1_Handle) != HAL_OK)
{
Error_Handler();
}
#endif
//250kbps --> CAN_BS1_7TQ ,CAN_BS2_1TQ ,Prescaler =24
#if 1
Can1_Handle.Instance = CAN1;
Can1_Handle.Init.Prescaler = 24;
Can1_Handle.Init.Mode = CAN_MODE_NORMAL;
Can1_Handle.Init.SyncJumpWidth = CAN_SJW_1TQ;
Can1_Handle.Init.TimeSeg1 = CAN_BS1_7TQ;
Can1_Handle.Init.TimeSeg2 = CAN_BS2_1TQ;
Can1_Handle.Init.TimeTriggeredMode = DISABLE;
Can1_Handle.Init.AutoBusOff = ENABLE;
Can1_Handle.Init.AutoWakeUp = ENABLE;
Can1_Handle.Init.AutoRetransmission = DISABLE;
Can1_Handle.Init.ReceiveFifoLocked = DISABLE;
Can1_Handle.Init.TransmitFifoPriority = DISABLE;
if (HAL_CAN_Init(&Can1_Handle) != HAL_OK)
{
Error_Handler();
}
#endif
|