From 7715a4ab4c685120785cc614e72aefe5e14e02c2 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 15 Jan 2026 10:51:51 +1300 Subject: [PATCH] AirBrainH743: configure for active buzzer We can't use passive buzzers because the timer to drive the PWM would conflict with the motor outputs M7 and M8. --- boards/gearup/airbrainh743/src/board_config.h | 11 +++++++++-- boards/gearup/airbrainh743/src/timer_config.cpp | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/boards/gearup/airbrainh743/src/board_config.h b/boards/gearup/airbrainh743/src/board_config.h index 1515f395ad..f6317c8c0f 100644 --- a/boards/gearup/airbrainh743/src/board_config.h +++ b/boards/gearup/airbrainh743/src/board_config.h @@ -112,9 +112,16 @@ #define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS -/* Tone alarm output - PA15 */ +/* Tone alarm output (directly connected to transistor switch of external buzzer) + * + * GPIO mode only (active buzzer) - passive buzzer with different tones is not + * supported because PA15 can only use TIM2, which is also used for motor outputs + * M7 (PB10, TIM2_CH3) and M8 (PB11, TIM2_CH4). The PWM tone alarm driver changes + * the timer's prescaler and auto-reload registers (shared across all channels), + * which would affect M7/M8 PWM frequency during tone playback. + */ #define GPIO_TONE_ALARM_IDLE /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15) -#define GPIO_TONE_ALARM_GPIO /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN15) +#define GPIO_TONE_ALARM_GPIO /* PA15 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN15) /* ICM42688P FSYNC - directly connected to IMU via GPIO (no timer). diff --git a/boards/gearup/airbrainh743/src/timer_config.cpp b/boards/gearup/airbrainh743/src/timer_config.cpp index e91005bb7a..2fcea89362 100644 --- a/boards/gearup/airbrainh743/src/timer_config.cpp +++ b/boards/gearup/airbrainh743/src/timer_config.cpp @@ -45,6 +45,10 @@ * M7: PB10 (TIM2_CH3) * M8: PB11 (TIM2_CH4) * M9: PA2 (TIM5_CH3) - LED strip + * + * Note: TIM2 is shared with buzzer pin PA15 (TIM2_CH1). The buzzer is disabled + * by default because the tone alarm driver would change the timer prescaler/ARR + * which affects M7/M8 PWM frequency. See board_config.h for details. */ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = {