From 6e33910c258a0dffb26606f4701bdda964981609 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 2 Sep 2021 20:27:09 +1000 Subject: [PATCH] AP_Periph: use a longer loop delay on non-H7 the short delay broke the F412 based CUAV_GPS --- Tools/AP_Periph/can.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Tools/AP_Periph/can.cpp b/Tools/AP_Periph/can.cpp index 24443807fb6dbf..927999547c5f15 100644 --- a/Tools/AP_Periph/can.cpp +++ b/Tools/AP_Periph/can.cpp @@ -82,6 +82,15 @@ extern AP_Periph_FW periph; #define HAL_CAN_POOL_SIZE 4000 #endif +#ifndef HAL_PERIPH_LOOP_DELAY_US +// delay between can loop updates. This needs to be longer on F4 +#if defined(STM32H7) +#define HAL_PERIPH_LOOP_DELAY_US 64 +#else +#define HAL_PERIPH_LOOP_DELAY_US 512 +#endif +#endif + #define DEBUG_PRINTS 0 #define DEBUG_PKTS 0 #if DEBUG_PRINTS @@ -1623,7 +1632,7 @@ void AP_Periph_FW::can_update() #endif const uint32_t now_us = AP_HAL::micros(); while ((AP_HAL::micros() - now_us) < 1000) { - hal.scheduler->delay_microseconds(64); + hal.scheduler->delay_microseconds(HAL_PERIPH_LOOP_DELAY_US); processTx(); processRx(); }