Skip to content

Commit 5bd641a

Browse files
Fixed busyloop in the STM32 CAN driver for ChibiOS
1 parent 4c03b29 commit 5bd641a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ uavcan::int16_t CanIface::configureFilters(const uavcan::CanFilterConfig* filter
467467

468468
bool CanIface::waitMsrINakBitStateChange(bool target_state)
469469
{
470-
#if UAVCAN_STM32_NUTTX
471-
const unsigned Timeout = 500;
470+
#if UAVCAN_STM32_NUTTX || UAVCAN_STM32_CHIBIOS
471+
const unsigned Timeout = 1000;
472472
#else
473473
const unsigned Timeout = 2000000;
474474
#endif
@@ -480,7 +480,10 @@ bool CanIface::waitMsrINakBitStateChange(bool target_state)
480480
return true;
481481
}
482482
#if UAVCAN_STM32_NUTTX
483-
::usleep(2000);
483+
::usleep(1000);
484+
#endif
485+
#if UAVCAN_STM32_CHIBIOS
486+
::chThdSleep(MS2ST(1));
484487
#endif
485488
}
486489
return false;

0 commit comments

Comments
 (0)