CanTxMsgTypeDef TxMessage;
CanRxMsgTypeDef RxMessage;
/* CAN init function */
static void MX_CAN_Init(void)
{
hcan.Instance = CAN1;
hcan.pTxMsg = &TxMessage;
hcan.pRxMsg = &RxMessage;
hcan.Init.Prescaler = 12;
hcan.Init.Mode = CAN_MODE_NORMAL;
hcan.Init.SJW = CAN_SJW_1TQ;
hcan.Init.BS1 = CAN_BS1_3TQ;
hcan.Init.BS2 = CAN_BS2_2TQ;
hcan.Init.TTCM = DISABLE;
hcan.Init.ABOM = DISABLE;
hcan.Init.AWUM = ENABLE;
hcan.Init.NART = ENABLE;
hcan.Init.RFLM = DISABLE;
hcan.Init.TXFP = DISABLE;
if (HAL_CAN_Init(&hcan) != HAL_OK)
{
Error_Handler();
}
}
CanTxMsgTypeDef TxMessage;
CanRxMsgTypeDef RxMessage;
/* CAN init function */
static void MX_CAN_Init(void)
{
hcan.Instance = CAN1;
hcan.pTxMsg = &TxMessage;
hcan.pRxMsg = &RxMessage;
hcan.Init.Prescaler = 12;
hcan.Init.Mode = CAN_MODE_NORMAL;
hcan.Init.SJW = CAN_SJW_1TQ;
hcan.Init.BS1 = CAN_BS1_3TQ;
hcan.Init.BS2 = CAN_BS2_2TQ;
hcan.Init.TTCM = DISABLE;
hcan.Init.ABOM = DISABLE;
hcan.Init.AWUM = ENABLE;
hcan.Init.NART = ENABLE;
hcan.Init.RFLM = DISABLE;
hcan.Init.TXFP = DISABLE;
if (HAL_CAN_Init(&hcan) != HAL_OK)
{
Error_Handler();
}
}
举报