From 08d066b618a499ab1124248dc2ccf9478075a123 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 26 Aug 2018 13:08:52 +0000 Subject: Fixed a corner case. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12232 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'os/hal/ports/STM32/LLD/CANv1') diff --git a/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c b/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c index 9d61f9952..5de18fcee 100644 --- a/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c +++ b/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c @@ -736,7 +736,7 @@ void can_lld_stop(CANDriver *canp) { CAN1->MCR = 0x00010002; /* Register reset value. */ CAN1->IER = 0x00000000; /* All sources disabled. */ #if STM32_CAN_USE_CAN2 - /* If CAND2 is not stopped then CAN1 clock is not stopped here.*/ + /* If CAND2 is stopped then CAN1 clock is stopped here.*/ if (CAND2.state == CAN_STOP) #endif { @@ -749,6 +749,13 @@ void can_lld_stop(CANDriver *canp) { if (&CAND2 == canp) { CAN2->MCR = 0x00010002; /* Register reset value. */ CAN2->IER = 0x00000000; /* All sources disabled. */ +#if STM32_CAN_USE_CAN1 + /* If CAND1 is stopped then CAN1 clock is stopped here.*/ + if (CAND1.state == CAN_STOP) +#endif + { + rccDisableCAN1(); + } rccDisableCAN2(); } #endif -- cgit v1.2.3