2021-03-23 02:40 PM
it generates the following init using the default parameters:
static void MX_CAN1_Init(void)
{
/* USER CODE BEGIN CAN1_Init 0 */
/* USER CODE END CAN1_Init 0 */
/* USER CODE BEGIN CAN1_Init 1 */
/* USER CODE END CAN1_Init 1 */
hcan1.Instance = CAN1;
hcan1.Init.Prescaler = 16;
hcan1.Init.Mode = CAN_MODE_NORMAL;
hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
hcan1.Init.TimeSeg1 = CAN_BS1_1TQ;
hcan1.Init.TimeSeg2 = CAN_BS2_1TQ;
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();
}
/* USER CODE BEGIN CAN1_Init 2 */
/* USER CODE END CAN1_Init 2 */
}
And it falls immediately into the Error_Handler();
What do I need to do to fix it?
My second question is:
My system needs to have a CAN Baud rate of 1,000,000 because the other devices are running that speed. I cannot figure out how to make that happen. I tell it 1000000 for the baud rate and then I cannot figure out the Time Quanta in Bit Segment 1 or Bit Segment 2. Does this chip not support that speed? If not what will?
Thanks,
Kip
2021-03-26 02:53 AM
HELLO,I'm the same as the link. what about you?
2021-03-29 07:21 AM
I have not changed the system clock, I left the defaults. For my chip the clock is 84 MHz.
"Not sure howbut i fixed it:
I removed the nodes from the canbus line and flashed them with the canbus not connected,
the nodes are back to normal behaviour, maybe something hardwarewise was happening in the canbus."
I do not understand what was changed.
2021-03-30 07:26 AM
If I understand it right. the other removed everything else connected tot he CAN bus. I do not have anything one the CAN bus yet. So it does not apply to my situation.
I just enabled the CAN1 interface and compiled and it failed the initialization.
Kip