aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-08-26 13:06:05 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-08-26 13:06:05 +0000
commit44d3a3a9c32f216a26abbf77591f829b2e1b90eb (patch)
treefa7f84dbe38016c2aaa816ca8dc8841cd49c7f2f /os/hal/ports/STM32/LLD
parentcfb36c168f4cdae15e568ac134f67e320ef6ef72 (diff)
downloadChibiOS-44d3a3a9c32f216a26abbf77591f829b2e1b90eb.tar.gz
ChibiOS-44d3a3a9c32f216a26abbf77591f829b2e1b90eb.tar.bz2
ChibiOS-44d3a3a9c32f216a26abbf77591f829b2e1b90eb.zip
CAN1-CAN2 conflicts tentative fix.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12231 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r--os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c17
1 files changed, 8 insertions, 9 deletions
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 d951ccb4f..9d61f9952 100644
--- a/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c
+++ b/os/hal/ports/STM32/LLD/CANv1/hal_can_lld.c
@@ -688,9 +688,7 @@ void can_lld_start(CANDriver *canp) {
#if STM32_CAN_USE_CAN2
if (&CAND2 == canp) {
-
- osalDbgAssert(CAND1.state != CAN_STOP, "CAN1 must be started");
-
+ rccEnableCAN1(true); /* CAN 2 requires CAN1, so enabling it first.*/
rccEnableCAN2(true);
}
#endif
@@ -735,14 +733,15 @@ void can_lld_stop(CANDriver *canp) {
if (canp->state == CAN_READY) {
#if STM32_CAN_USE_CAN1
if (&CAND1 == canp) {
-
-#if STM32_CAN_USE_CAN2
- osalDbgAssert(CAND2.state == CAN_STOP, "CAN2 must be stopped");
-#endif
-
CAN1->MCR = 0x00010002; /* Register reset value. */
CAN1->IER = 0x00000000; /* All sources disabled. */
- rccDisableCAN1();
+#if STM32_CAN_USE_CAN2
+ /* If CAND2 is not stopped then CAN1 clock is not stopped here.*/
+ if (CAND2.state == CAN_STOP)
+#endif
+ {
+ rccDisableCAN1();
+ }
}
#endif