2018-05-30 12:08 PM
Hi,
I am using STM32L496 with Nucleo-144/STM32CubeMX.
Is there any CAN BUS example with HAL Drivers? I can't even find how to setup the baudrate.Thanks,
****
Note: this post was migrated and contained many threaded conversations, some content may be missing.2018-05-31 02:36 PM
I found this on the internet for 48 MHz clock. Why the setting is different than what you said?
/* CAN cell init */
CAN_InitStructure.CAN_TTCM = DISABLE;
CAN_InitStructure.CAN_ABOM = DISABLE;
CAN_InitStructure.CAN_AWUM = DISABLE;
CAN_InitStructure.CAN_NART = ENABLE;
CAN_InitStructure.CAN_RFLM = DISABLE;
CAN_InitStructure.CAN_TXFP = ENABLE;
CAN_InitStructure.CAN_Mode = CAN_Mode_Normal;
CAN_InitStructure.CAN_SJW = CAN_SJW_1tq;
/* CAN Baudrate = 500kbps (CAN clocked at 48 MHz) */
CAN_InitStructure.CAN_BS1 = CAN_BS1_6tq;
CAN_InitStructure.CAN_BS2 = CAN_BS2_5tq;
CAN_InitStructure.CAN_Prescaler = 16;
CAN_Init(CAN1, &CAN_InitStructure);
// 48Mhz / ( 8 * ( 1 + 6 + 5) ) = 500Kbps
// 48Mhz / 96
2018-06-20 01:49 PM
Three weeks later...
https://community.st.com/0D50X00009XkYGHSA3
2018-06-20 02:18 PM
Yeah. First we are using our own dev kit which CANH./L 5V. Then I wasn't get the SystemClock_Config() function correctly.
Then purchase CAN transceiver, enable PEAK termination.
It's painful.
Now I am moving to flash. Thx