Browse Source

[stm32F4] adapt 168M frequency of 1M can baud, remember to add the define of BSP_USING_CAN168M in kconfig while using 168M frequency

zuozuojia 3 years ago
parent
commit
10b71175eb
1 changed files with 4 additions and 0 deletions
  1. 4 0
      bsp/stm32/libraries/HAL_Drivers/drv_can.c

+ 4 - 0
bsp/stm32/libraries/HAL_Drivers/drv_can.c

@@ -54,7 +54,11 @@ static const struct stm32_baud_rate_tab can_baud_rate_tab[] =
 #else  /* APB1 45MHz(max) */
 static const struct stm32_baud_rate_tab can_baud_rate_tab[] =
 {
+#ifdef BSP_USING_CAN168M
+    {CAN1MBaud, (CAN_SJW_1TQ | CAN_BS1_3TQ  | CAN_BS2_3TQ | 6)},
+#else
     {CAN1MBaud, (CAN_SJW_2TQ | CAN_BS1_9TQ  | CAN_BS2_5TQ | 3)},
+#endif
     {CAN800kBaud, (CAN_SJW_2TQ | CAN_BS1_8TQ  | CAN_BS2_5TQ | 4)},
     {CAN500kBaud, (CAN_SJW_2TQ | CAN_BS1_9TQ  | CAN_BS2_5TQ | 6)},
     {CAN250kBaud, (CAN_SJW_2TQ | CAN_BS1_9TQ  | CAN_BS2_5TQ | 12)},