Commit Graph
4075 Commits
Author SHA1 Message Date
Peter Barker 51b1948755 AP_HAL_ChibiOS: only enable AP_Airspeed on periphs with airspeed support
AP_Periph only instantiates an AP_Airspeed object when
AP_PERIPH_AIRSPEED_ENABLED is set, but AP_AIRSPEED_ENABLED defaulted to
1 regardless, leaving the singleton null on other periph builds.  Tie
the two together as is already done for other sensor libraries.
2026-09-22 14:16:42 +10:00
yyzh a1ecb8b0ee hwdef: add SVehicle-E2-mini flight controller board 2026-09-22 10:28:26 +10:00
Andy Piper 663fc09bb2 hwdef: all TBS_LUCID_H7 variants can contain DPS368 or BMP390 2026-09-21 10:25:35 +10:00
Peter Barker c05eb925b1 AP_HAL_ChibiOS: prepare for reboot at the HAL rc output level
ensures that the 0s get to the hardware

significantly reduces the race conditions which might allow a thread to write after values are zeroed
2026-09-18 00:10:02 +10:00
Peter Barker 5efdf54920 Revert "hwdef: keep PA15 pulled up in the YJUAV_A6SE_H743 bootloader"
This reverts commit 2f87db990f.

PR #34359 was merged by mistake.  On the bench, with an ESC on
YJUAV_A6SE_H743 output 1, the hold presents a continuous high (full
throttle to a PWM ESC) for about 10.5s after every reset, and for as
long as safety is engaged when output 1 is a motor outside
BRD_SAFETY_MASK, which is Copter's default.  The ESC started to enter
throttle calibration.  Back the change out until the hold can be
chosen per output.
2026-09-18 00:04:45 +10:00
Peter Barker e4f836b315 Revert "AP_HAL_ChibiOS: add HOLD_HIGH PWM pins handed to their timer at first output"
This reverts commit 239f5c1f97.

PR #34359 was merged by mistake.  On the bench, with an ESC on
YJUAV_A6SE_H743 output 1, the hold presents a continuous high (full
throttle to a PWM ESC) for about 10.5s after every reset, and for as
long as safety is engaged when output 1 is a motor outside
BRD_SAFETY_MASK, which is Copter's default.  The ESC started to enter
throttle calibration.  Back the change out until the hold can be
chosen per output.
2026-09-18 00:04:45 +10:00
Peter Barker 0fae5cc03b Revert "hwdef: hold YJUAV_A6SE_H743 PWM1 high until its first frame"
This reverts commit 67fd60ce26.

PR #34359 was merged by mistake.  On the bench, with an ESC on
YJUAV_A6SE_H743 output 1, the hold presents a continuous high (full
throttle to a PWM ESC) for about 10.5s after every reset, and for as
long as safety is engaged when output 1 is a motor outside
BRD_SAFETY_MASK, which is Copter's default.  The ESC started to enter
throttle calibration.  Back the change out until the hold can be
chosen per output.
2026-09-18 00:04:45 +10:00
Peter Barker 67fd60ce26 hwdef: hold YJUAV_A6SE_H743 PWM1 high until its first frame
PWM1 is on PA15, the JTDI pin, whose reset and power-on pull-up gave the
M1 servo a short pulse on every boot. Declare it HOLD_HIGH so the
application keeps it a pulled-up input until RCOutput's first real
frame, matching the bootloader, which already keeps the pull-up.
2026-09-17 22:56:37 +10:00
Peter Barker 239f5c1f97 AP_HAL_ChibiOS: add HOLD_HIGH PWM pins handed to their timer at first output
The STM32 JTAG pins JTDI (PA15) and NJTRST (PB4) come out of every
reset, and out of power-on, with an internal pull-up enabled, and 84
hwdef directories in the tree route a PWM output through one of them:
61 through PA15, 38 through PB4, 15 through both.  A servo on such an
output sees the line pulled high from then until firmware reconfigures
the pin.  On the H743 that measured 692us to the bootloader's board init
on a warm reset, and 496us and 520us on two cold power-ons.  Each is a
pulse inside the range servos accept, so the servo drives to an endpoint
and holds it through the rest of the boot.  Nothing can shorten that
window, since no code runs during it.

Give hwdef a HOLD_HIGH keyword for PWM pins.  The generator emits such a
pin as a pulled-up input with its timer alternate function preset, and a
HAL_PWM_HOLD_HIGH_MASK of the channels concerned.  It rejects the keyword
on any pin RCOutput will never hand back to a timer: anything other than
a PWM(n) timer output in the main configuration, so also an RC input, the
alarm and an ALT(n) pin.  One predicate decides both that and which pins
get a mask bit, so the two cannot disagree.  The check is made when the
pin is parsed, which covers bootloader builds too.  STM32F1 is rejected
outright, since its pin setup does not honour the keyword at all.

RCOutput keeps each channel an input until the first non-zero value is
pushed to it, in the PWM and DShot output paths, and only then switches
the pin to the timer.  With the bootloader also keeping the pull-up, the
line is high continuously from the reset until the first real frame,
which for a channel outside BRD_SAFETY_MASK means until safety is
disarmed, so the servo sees a high far longer than any valid pulse
rather than a plausible short one followed by seconds of silence.  On
the bench the test servo did not move at all across ten reboots.

The mode switch is an unlocked read-modify-write of the port registers,
and other threads change the modes of other pins on the same port, so
a single write can be lost.  The channel is therefore not marked handed
over until a later output finds the pin already in alternate mode; until
then each output writes the mode again, so a lost write is repaired one
output later rather than leaving the pin an input until reboot.

Several other owners of a pad have to take it explicitly, because none
of them goes through the normal output path:

 - the alarm driver configures a timer and never the pad, and disables
   the group's channels first, so the hold on the alarm's own channel is
   released before that.  Only that channel: no real frame will ever
   arrive for the rest of the group, so a HOLD_HIGH pin among them is
   correctly left held;
 - soft serial saves and restores the pad's mode, so BLHeli passthrough
   hands the pin over when it selects it, or it would save "input" and
   transmit nothing;
 - neopixel and ProfiLED output is chosen at runtime by SERVOx_FUNCTION
   on an ordinary PWM(n) pin and is sent without push_local(), so the
   serial LED path releases its group's pads before driving them;
 - DShot commands such as beeps are sent before arming, when nothing has
   released the pad yet, so the command path releases every channel it
   transmits on;
 - bidirectional DShot, when enabled at runtime, takes the pads of a
   whole group during init, so it clears the pending bit there.  A pin
   merely declared BIDIR keeps its hold; one whose group has bidirectional
   DShot enabled gets no protection.  The hwdef allows HOLD_HIGH and BIDIR
   together deliberately.

Verified under Renode on YJUAV_A6SE_H743 with ArduPlane: the
application's board init leaves PA15 an input, it stays one through
24.8s of init, and the mode write that puts it on TIM2 lands at the same
microsecond as the first non-zero CCR1 write.  With the first mode write
dropped on purpose, the next output found PA15 still an input and wrote
it; unmodified, the second output sees the mode has held and later
outputs no longer read the port.  MatekF405-TE and the IOMCU
firmware still build, and a no-mask board's firmware is byte-identical.
2026-09-17 22:56:37 +10:00
Peter Barker 2f87db990f hwdef: keep PA15 pulled up in the YJUAV_A6SE_H743 bootloader
PA15 drives PWM1 on this board and is also JTDI, which the STM32H743
brings out of every reset, and out of power-on, with its internal
pull-up enabled. The M1 servo line is therefore held high from then
until the bootloader's board init reconfigured the pin as a floating
input. On logic-analyser captures of the real board that is 692us on a
warm reset, and 496us and 520us on two cold power-ons, one over USB and
one at 12V. Each of those is a pulse inside the range most servos
accept, and it sent the servo to an extreme.

Configure PA15 as an input with pull-up in the bootloader instead, so
the line stays high continuously until the application switches the pin
to its timer, whose idle level is low. The servo then sees one high
lasting the whole bootloader, far outside any valid pulse width, rather
than a plausible command. Verified under Renode with the bootloader
held: PA15 reads input with pull-up while the bootloader owns the pins.
2026-09-17 22:56:37 +10:00
Brown 4b84bc3bb3 AP_HAL_ChibiOS: update hwdef for Holybro Pixhawk6X Rev8
Use the Rev8 board type for the pin-compatible ICM45686 and LSM6DSV-family IMUs that share the same buses, chip selects, and rotations.
2026-09-15 16:59:33 +10:00
Brown 0252d304ed AP_HAL_ChibiOS: support LSM6DSV on Pixhawk6X 45686 layout
Add LSM6DSV SPI aliases and fallback probes while preserving the
existing slot rotations.
2026-09-15 16:59:33 +10:00
Brown 7e631ecc71 AP_HAL_ChibiOS: KakuteH7Mini add LSM6DSV IMU support
Add SPI device and IMU probe line for the LSM6DSV on KakuteH7Mini.
2026-09-15 16:56:31 +10:00
Brown ed74303314 AP_HAL_ChibiOS: KakuteH7 add LSM6DSV IMU support
Add SPI device and IMU probe line for the LSM6DSV on KakuteH7.
2026-09-15 16:56:31 +10:00
zhoujinhuaandClaude Opus 5 d95d3c1f5f hwdef: add CoreWingF405WMiniV2
The CoreWing F405 Wing Mini V2 is a compact variant of the
CoreWingF405WingV2. The hwdef inherits from the base target and only
overrides the Mini-specific hardware differences.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 09:23:34 +10:00
247974be1a hwdef: add CoreWingF405WingV2
The CoreWing F405 Wing V2 is a fixed-wing and QuadPlane/VTOL flight
controller with an STM32F405 MCU, ICM-42688P or BMI270 IMU, SPA06-003
baro, AT7456E OSD, integrated PDB and a USB extender connector for an
optional BLE/WiFi telemetry module.

Co-authored-by: Henry Wurzburg <hwurzburg@yahoo.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 09:23:34 +10:00
rubikscube05 a5cd5f7981 AP_HAL_ChibiOS: fix bdshot_encoder bitwise shift bug
Fixes #34176
2026-09-11 10:29:57 +01:00
gradvizor 98e0837b5c hwdef: ZenFC743 2026-09-10 14:38:28 +01:00
alexklimaj 610521d4de hwdef: ARK_FPV: add LSM6DSV32X as IIM-42653 alternative
Hardware revision 1 replaces the IIM-42653 with an LSM6DSV32X on the
same SPI1 CS and DRDY pins. Probe both devices so a single firmware
image supports both revisions.
2026-09-07 11:37:51 +10:00
Peter BarkerandClaude Fable 5 cd5c3b458b hwdef: remove defines which are consumed nowhere in the codebase
Each of these "define NAME value" lines creates a macro which no code,
script or ChibiOS source references, so they have no effect:

 - ALLOW_ARM_NO_GPS (AeroCogito-H7Digital): no such macro (unlike
   ALLOW_ARM_NO_COMPASS, which is consumed by AP_Arming_Copter.cpp)
 - AP_BATTERY_TIBQ76952_I2C_DEVICE (VM-L431-BMS): driver uses
   AP_BATTMON_TIBQ76952_BUS/_ADDR
 - AP_COMPASS_IST8308_DEFAULT_ROTATION (GreenSightUltraBlue): no such
   macro; rotation comes from the COMPASS line
 - HAL_BLHELI_PASSTHROUGH_ENABLED/_UART and
   HAL_ESC_TELEMETRY_UART/_ENABLED (NucleoH753ZI): no such macros
 - HAL_CAN_ENABLED, HAL_CAN_NUM_DRIVERS (SkyRukh_Surge_H7): obsolete;
   CAN interface count is derived from the CAN pin definitions
 - HAL_HEATER3_GPIO_PIN, HAL_HEATER4_GPIO_PIN (rFCU): IMU_heater.cpp
   only supports HAL_HEATER_GPIO_PIN and HAL_HEATER2_GPIO_PIN
 - HAL_BL_IOMCU_FW_DETECT and HAL_IO_FMU_COMMS_TX_DMA_CHANNEL/
   _RX_DMA_STREAM/_RX_DMA_CHANNEL (CubeRedSecondary-IO): iofirmware
   only consumes HAL_IO_FMU_COMMS_TX_DMA_STREAM and
   HAL_IO_FMU_COMMS_TX_IRQ_PRIORITY, which are retained
 - HAL_LED_OFF (OrqaH7QuadCore, SkystarsH7HD bootloaders): bootloader
   uses HAL_LED_ON and derives off as !HAL_LED_ON
 - HAL_BOOTLOADER_NAME, HAL_BOOTLOADER_BOOT_FROM_SDCARD
   (PilotGaeaSH7V1-bdshot): no such macros; SD-card boot would be
   AP_BOOTLOADER_FLASH_FROM_SD_ENABLED
 - HAL_BUZZER_ON (SIMPLIFLYH7): no buzzer-polarity macro exists
 - HAL_NEOPIXEL_COUNT (KakuteF4): no such macro; LED count comes from
   the NTF_LED_LEN parameter
 - VDD_BRICK2_VALID (sparknavi-blue): only meaningful as a pin label,
   which this board does not have; as a bare define it does nothing
 - HAL_HEATER_MAG_OFFSET_RM3100 (ZeroOneX6): the consuming
   HAL_HEATER_MAG_OFFSET define is commented out, and the offset
   vector is zero in any case

All affected boards still process cleanly through chibios_hwdef.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 14:00:50 +10:00
tompsontan 3cbed584de AP_HAL_ChibiOS: add hwdef X-MAV-AP-H743v3. 2026-09-04 09:29:53 +10:00
Peter BarkerandClaude Opus 5 f13b52f3d0 hwdef: SkyViper-v2450: disable copy-from-EKF compass calibration
The SkyViper has a single fixed compass and is tight on flash.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 09:29:27 +10:00
Andrew Tridgell 280ddc960a AP_HAL_ChibiOS: fix F4 SD crash dump build
Some STM32F4 CMSIS headers omit the unsupported SDIO start-bit error flag. Define it as zero when absent, matching the ChibiOS SDIO driver and allowing DrotekP3Pro builds to compile.
2026-09-04 05:49:07 +10:00
Andy Piper 23f42788ba AP_HAL_ChibiOS: narrow the GCR decode table to uint8_t
The entries are all nibbles or the 0xff invalid marker, and the uint32_t
locals still promote, so the quintet check is unaffected. Saves 96 bytes.
2026-09-02 19:52:59 +01:00
Andy Piper 2e0ee77b4d AP_HAL_ChibiOS: share GCR telemetry decode with the IOMCU F1 path
RCOutput_iofirmware.cpp carried a second copy of the decode table, used by
the reversed-channel decoder on STM32F1. That copy is live: PB8 and PA1 are
declared BIDIR on iomcu-f103-dshot, so those channels kept the old
one-in-sixteen false accept rate while the main path was fixed.

Hoist the table, the quintet check and the checksum into one helper so the
two cannot drift again. Removing the duplicate saves 172 bytes on the F103,
which has 8k of flash left.
2026-09-02 19:52:59 +01:00
Andy Piper 69e1f8214f AP_HAL_ChibiOS: reject invalid GCR quintets in DShot telemetry
The GCR decode table used 0 for the sixteen quintets the encoding never emits,
which is indistinguishable from the legitimate 0 at index 25. A corrupt quintet
therefore decoded silently to nibble 0, leaving only the checksum between it and
a bad eRPM - and four bits of checksum let roughly one in sixteen corruptions
through.

Mark the impossible quintets and reject any word containing one. Betaflight
reports 5-8% of frames failing to decode with motors running, so this path is
exercised constantly, and a bad eRPM feeds RPM-referenced harmonic notch
tracking.
2026-09-02 19:52:59 +01:00
Andrew Tridgell 4c6183c566 hwdef: allow disarmed script heap expansion on periph 2026-09-02 15:58:06 +10:00
msli-dev 9a48603214 hwdef: add Tustin MACH flight controller 2026-09-01 14:33:48 +01:00
Andy Piper 055d39522f AP_HAL_ChibiOS: enable ground effect compensation on luminousbee5 2026-09-01 20:09:07 +09:00
Andrew Tridgell cf57b7c86a AP_HAL_ChibiOS: add early USB microSD service
Add an early boot service that exports the microSD block device over
USB mass storage before the filesystem and normal flight application
start. The service retains exclusive ownership until a power cycle and
continues servicing the watchdog.

Enable the service on supported boards, provide explicit build control,
increase the MSD worker stacks for the SD wait path, scope the ChibiOS
fixed-width serial warning suppression to the MSD object, and reject
explicit enable requests on unsupported boards.
2026-08-28 17:18:39 +10:00
Andy Piper fd93d8307e AP_HAL_ChibiOS: lower CubeNode IMU probe clock to 2MHz
The shared module inc probed the ICM-45686 at 24MHz, the part's rated
maximum. Every other icm45686 in the tree probes at 2MHz and only steps
up afterwards. The high-speed clock is unchanged at 24MHz.
2026-08-26 17:52:06 +10:00
Andy Piper b4f875e782 hwdef: add NWBLUE_PROH757 board support
30x30 mm multirotor flight controller built on the CubePilot CubeNode
H757 module. See README for the full feature set and connector pinout.
2026-08-26 17:52:06 +10:00
Andy Piper 07c4d73f64 AP_HAL_ChibiOS: refactor CubeNode hwdef into shared inc files
Pull module-fixed pins (MCU type, oscillator, CAN1, USB, SWD, RMII
Ethernet PHY, on-module SPI3 IMU pads, CAN sleep/shutdown) into
hwdef.inc and hwdef-bl.inc so additional carrier boards built on the
CubeNode H757 module can reuse them without duplicating the module
pinout. The existing CubeNode AP_Periph dat files become thin wrappers
over the shared inc plus their AP_Periph-specific config.

CubeNode-ETH continues to include CubeNode/hwdef.dat unchanged.
2026-08-26 17:52:06 +10:00
Andrew Tridgell cbe0c39d5d hwdef: enable parameter defaults for PPP gateways 2026-08-25 12:58:58 +10:00
Andrew Tridgell bcb572f53d AP_HAL_ChibiOS: reset crash handler without watchdog 2026-08-25 10:46:36 +10:00
Andrew Tridgell 0992ff02f2 AP_HAL_ChibiOS: refresh SD crash dump hardware state 2026-08-25 10:46:36 +10:00
Andrew Tridgell e644fdad79 AP_HAL_ChibiOS: move CrashCatcher core in-tree
Keep the Cortex-M fault entry and dump-format implementation alongside the ChibiOS crashdump backends.
2026-08-25 10:46:36 +10:00
Andrew Tridgell f7ceff41ed AP_HAL_ChibiOS: add full-memory crash dumps to SD 2026-08-25 10:46:36 +10:00
Andrew Tridgell f10d1c841b AP_HAL_ChibiOS: split crashdump backends 2026-08-25 10:46:36 +10:00
abhijithcv 6fb4ba5185 hwdef: Agam_MegH7: use renamed AP_HW_AGAM_MegH7 board ID 2026-08-22 16:18:06 +10:00
Jacob Dahl 6953718dcc hwdef: ARK_PI6X: fix RC input serial port number in README
SERIAL_ORDER places USART6 at SERIAL5, and DEFAULT_SERIAL5_PROTOCOL is
what selects RCIN, but the README documented it as SERIAL6.
2026-08-20 10:35:36 +10:00
HGLRC 70ecdeb5b3 AP_HAL_ChibiOS: add HGLRC H743 EVO board support 2026-08-19 16:59:40 +01:00
Henry Wurzburg 048246c394 hwdef: set VTX power pin default in the bootloader on 12 boards
The VTX power switch pin is defined with a default OUTPUT level in
hwdef.dat, but was never mirrored into hwdef-bl.dat. Since ChibiOS's own
unconfigured-pin default is INPUT FLOATING, the pin floated for the
entire time each of these boards sat in the bootloader (DFU / SD-card
flashing), even though the main firmware correctly drove it once it
booted. Add the matching line so the VTX power rail has a defined state
throughout.

- AEDROXH7 (PB12 VTX_SW)
- DAKEFPVF405 (PB4 VTX_PWR)
- DAKEFPVH743Pro (PE3 PINIO2)
- FlyFishRCF405 (PC5 PINIO1)
- HWH7 (PE4 VTX_POWER)
- JHEMCUF405WING (PC13 PINIO1)
- LongBowF405WING (PC13 PINIO1)
- OrqaF405Pro (PB9 VTX_SW)
- SIMPLIFLYH7 (PB2 PINIO1)
- SPEDIXH743 (PA2 VTX_SW)
- SpeedyBeeF405WING (PC13 PINIO1)
- speedybeef4v5 (PC13 VTX_PWR)
2026-08-19 17:18:45 +10:00
abhijithcv d265dfeb83 AP_HAL_ChibiOS: add Agam MegH7 board 2026-08-18 10:53:02 +10:00
RomanKalinchuk 5558077728 AP_HAL_ChibiOS: add support for FlyFishRC F405 flight controller
STM32F405 based board with ICM-42688-P IMU, DPS310 barometer,
MAX7456 OSD, onboard dataflash, 8 PWM outputs, hardware SBUS
inverter on USART2, and USB OTG.
2026-08-17 17:39:34 +10:00
serkanMzlm bb1e0ef1bf AP_HAL_ChibiOS: add Lectron-Pi5-H7 board 2026-08-17 11:01:09 +10:00
dakefpv 339d9e339e hwdef: DAKEFPV adds support for LSM6DSV and BMI270 IMUs 2026-08-10 12:51:28 +10:00
Peter BarkerandClaude Opus 5 ba36131aa5 hwdef: remove defines which are already in effect with the same value
Processing these hwdefs printed "<name> already in defines with same
value".  In four of them the board repeats a define it has just taken
from the hwdef it includes:

  DAKEFPVH743            DEFAULT_NTF_LED_TYPES  from DAKEFPVH743Pro
  MatekF765-Wing-bdshot  DEFAULT_NTF_LED_TYPES  from MatekF765-Wing
  SkystarsH7HDv2         AP_MSP_VIDEOTX_ENABLED from SkystarsH7HD-bdshot
  TBS_LUCID_H7_WING      DEFAULT_NTF_LED_TYPES  from TBS_LUCID_H7

and in the other two the same define appears twice in the one file:

  sparknavi-blue         HAL_WITH_RAMTRON
  esp32diy               HAL_LOGGING_BACKENDS_DEFAULT

The generated hwdef.h held each of these twice, as an identical
redefinition, and now holds it once; the value reaching the compiler is
unchanged.  hw.dat loses the line too, so it and the ROMFS which
embeds it are one line shorter.

Parsed state - defines, intdefines, config, pins and the rest - is
unchanged for all 490 boards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 19:24:04 +10:00
Peter BarkerandClaude Opus 5 12cf96348b hwdef: test alternative-function labels with one startswith
Three places looped over af_labels asking whether a label named an
alternative function, and none of them used the entry which matched.
str.startswith() takes a tuple of prefixes and does the whole test at
once, so ask it that way instead; two of the three are in
get_alt_function(), which is called for every pin line.

Processing all 443 ChibiOS hwdefs goes from 0.335s to 0.325s.  The
parse state of all 490 boards is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 19:24:04 +10:00
Peter BarkerandClaude Opus 5 df68c8cf0a hwdef: compile valid_type's peripheral-number regexes
valid_type() still ran nine uncompiled re.match() calls for every pin
line, cross-checking the peripheral number in a pin's type against the
one in its label.  Compile them once as class members.

Processing all 443 ChibiOS hwdefs goes from 0.35s to 0.32s.  The parse
state of all 490 boards is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 19:24:04 +10:00