Page 1 of 1

STM32F405 canStart/canStop

Posted: Wed Sep 07, 2016 12:58 pm
by omcdr
There is problem with canStop function, this code works corectly:

Code: Select all

   canStart(&CAND1, &cancfg500k_36Mhz);
   canStart(&CAND2, &cancfg500k_36Mhz);

   chThdSleepMilliseconds(500);

   canStop(&CAND2);
   canStop(&CAND1);


but this not:

Code: Select all

   canStart(&CAND1, &cancfg500k_36Mhz);
   canStart(&CAND2, &cancfg500k_36Mhz);

   chThdSleepMilliseconds(500);

   canStop(&CAND1);
   canStop(&CAND2);


I got panic message at line
#if STM32_CAN_USE_CAN2
osalDbgAssert(CAND2.state == CAN_STOP, "CAN2 must be stopped");


and debug stop at :
/* Pointing to the passed message.*/
ch.dbg.panic_msg = reason;

Re: STM32F405 canStart/canStop

Posted: Wed Sep 07, 2016 1:19 pm
by efuentes
In the STM32F405, CAN1 must be enabled for CAN2 to operate correctly. The panic is there to prevent you from assuming that CAN2 will operate correctly if CAN1 has been stopped.

Re: STM32F405 canStart/canStop

Posted: Wed Sep 07, 2016 1:22 pm
by omcdr
Ok, I see, there is for intended effect