From 5bd641a7440cc3a7ed7cd4a94c283d4a83c5c154 Mon Sep 17 00:00:00 2001 From: Pavel Kirienko Date: Mon, 4 Jan 2016 15:18:04 +0300 Subject: [PATCH] Fixed busyloop in the STM32 CAN driver for ChibiOS --- libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index d4de68496f..d8739bbc77 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -467,8 +467,8 @@ uavcan::int16_t CanIface::configureFilters(const uavcan::CanFilterConfig* filter bool CanIface::waitMsrINakBitStateChange(bool target_state) { -#if UAVCAN_STM32_NUTTX - const unsigned Timeout = 500; +#if UAVCAN_STM32_NUTTX || UAVCAN_STM32_CHIBIOS + const unsigned Timeout = 1000; #else const unsigned Timeout = 2000000; #endif @@ -480,7 +480,10 @@ bool CanIface::waitMsrINakBitStateChange(bool target_state) return true; } #if UAVCAN_STM32_NUTTX - ::usleep(2000); + ::usleep(1000); +#endif +#if UAVCAN_STM32_CHIBIOS + ::chThdSleep(MS2ST(1)); #endif } return false;