The 28 per-board copies of the IO firmware had drifted into 7 different
versions, and make px4io_update only covers 15 of the boards. Rebuild both
IO images from the release sources and copy them to every board according
to its CONFIG_BOARD_IO, so all boards ship the current IO firmware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>
PX4-Bootloader/board_types.txt assigns 1013 to Matek H743 and 139 to
Durandal. hw_config.h's BOARD_TYPE was hardcoded to 139 (Durandal's
ID) on both h743 and h743-mini, causing QGroundControl to reject
flashing with a "board ID 1013 != 139" mismatch.
Fixes#27731
Signed-off-by: FARHANG <farhang.nba@gmail.com>
(cherry picked from commit 0b7837cccf)
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
* feat(boards): add LSM6DSV support for Kakute H7 Wing
* fix(boards): lower Kakute H7 Wing OSD work queue priority
Run SPI2 below the SPI3 IMU queue to reduce delays caused by ATXXXX updates.
(cherry picked from commit 5a09e55fbc)
The commit f0a2fa9369 broke the ADIS and iim42652; it mistakenly
changes the spi setup for revision 6, instead of revision 8.
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
Co-authored-by: Jukka Laitinen <jukka.laitinen@tii.ae>
(cherry picked from commit a20be2f551)
The ARKV6X-32X is the ARKV6X with three LSM6DSV32X in place of the
IIM-42653s, on the same pads and at the same orientations. It reports
FMUM ID 2, which matched no sensor set, so no IMU started.
Backport of the board change in #29767.
Assisted-by: Claude:claude-fable-5-2
* fix(boards): drive PWM outputs low at reset instead of input pull-up
board_on_reset() was written in 2017 to put the FMU timer pins into a
driven low state so ESCs see a defined level from reset until the
output driver claims them. The fmu-v5 refactor in 54bd0a9f2a switched
the pin list to GPIO_INPUT|GPIO_PULLUP without comment, and the 2020
timer-config refactor propagated that as PX4_MAKE_GPIO_INPUT() to every
board derived from fmu-v5. The px4/fmu-v2..v4 lineage and later
px4/fmu-v6x (#19535) kept the driven low output.
A weak pull-up on the motor line is the state the AM32 bootloader
treats as "stay in the bootloader": it tests the pin against its own
pull-down and only jumps to the application on a clean low
(am32-firmware/AM32-bootloader#24). On boards where the MCU pin goes
straight to the ESC pad, a battery-only boot therefore leaves the ESCs
uninitialised (#27696, #28731). A weak pull in either direction also
leaves unassigned channels high impedance, so edges on a neighbouring
DShot line couple in and can spin a motor with no output assigned
(#26525). The 2021 attempt at pull-downs (#17686) hit the same problem
from the other side.
Switch the remaining STM32, kinetis and rt106x boards to
io_timer_channel_get_gpio_output(), matching the boards that already
drive low. The rt117x boards are unchanged because their input macro
has no pull.
The ARK boards additionally overrode the reset state with a pull-down
via PX4_GPIO_INIT_LIST; those entries are removed so the driven low
from board_on_reset() stands.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(boards): keep capture channels as inputs and cover the missed boards
Driving every timer pin low at reset also drove the capture channels on
fmu-v5, fmu-v5x, fmu-v6u, durandal-v1, pix32v5 and corvon/v5, where a GPS
PPS or camera output may be wired. Until pps_capture or camera_capture
claims the pin, that output would fight a push-pull low, so those
channels keep their previous input state.
The three fmu-v6xrt boards float their PWM pins through a different
input macro and zenfc/h743 landed after this branch was cut; all four now
drive low as well.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit 633af12ea4)
Dropped the agam and ARK fmu-v6xrt, nwblue pro-h757, tustin mach and zenfc h743 changes, because those boards are not on release/1.18.
Move the MR-VMU-TROPIC bootloader's USB DMA buffers into DTCM (non-cacheable)
to fix a cache-coherency failure that prevented flashing via QGroundControl
Signed-off-by: Tiberiu Gingu <tiberiu.gingu@nxp.com>
* fix(dataman_client): keep request topic advertised on client teardown
* fix(uorb): keep shared topics advertised on publisher teardown
Single-instance publications share one advertised flag, so destroying one
publisher must not hide updates from the others.
Keep automatic unadvertising in PublicationMultiBase and remove the
DatamanClient workaround. Cover surviving publishers and instance reuse,
and reset retained input samples between test cases.
Tested: make tests (215/215), make format.
Signed-off-by: jonas <jonas.perolini@rigi.tech>
Assisted-by: Codex
* docs(uorb): correct unadvertise comments and document teardown
The unadvertise comment claimed it has no effect on single-instance
topics, which is how one publisher's teardown came to hide the others.
State what clearing the shared flag does, and document that only
PublicationMulti releases its instance on destruction.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
* test(uorb): keep test cases independent of retained samples
A destroyed single-instance publication now leaves its last sample
visible, so ManualControlTest, test_prec_takeoff and mixer_module_tests
passed only in declaration order and failed under --gtest_shuffle.
Reset with an inert sample where one exists, otherwise unadvertise the
test's own publications, and drop module outputs left over from a
previous case.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
* fix(boards): drop the PublicationBase destructor from the ITCM lists
The destructor is now trivial and no longer emitted, so itcm_check.py
fails on the missing section.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: jonas <jonas.perolini@rigi.tech>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: jonas <jonas.perolini@rigi.tech>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit e146fe4cc6)
Backport adaptation: release/1.18 has no PublicationMultiBase (main's
4791b70c15 out-lined PublicationMulti), so the destructor that frees the
instance goes into PublicationMulti<T> and Publication.cpp is unchanged.
The ITCM entries for agam/ark fmu-v6xrt and the navigator tests
test_mission_route_cache.cpp / test_prec_takeoff.cpp are dropped: those
files are not on release/1.18. TEST_VTEPosition.cpp uses release/1.18's
_uav_gps_pub (main renamed it _uav_gnss_pub).
Assisted-by: Claude:claude-opus-5-5
Co-authored-by: Jonas Perolini <74473718+JonasPerolini@users.noreply.github.com>
* fix(ark/fmu-v6x): pin the bus-1 IMU as the primary
The three IMUs run at equal voter priority, so the sensor voter selects
the primary by whichever validates first at boot and keeps it — a
non-deterministic race. Seed the intended IMU's calibration slot (per
hwtype: IIM-42652 on ARKV6X000, IIM-42653 on ARKV6X001, both on SPI1,
already the heater's regulated sensor) with a higher priority so
selection is deterministic; the voter still fails over to the other
IMUs if it degrades.
param set-default is shadowed by a stored calibration, so this takes
effect on a fresh flash calibrated afterwards; an already-calibrated
board keeps its stored priority until the params are reset.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(ark/pi6x): pin the SPI1 IMU as the primary
Same equal-priority voter race as fmu-v6x: two ICM-42688-P run at equal
priority, so the primary is decided by a boot race. Seed the SPI1 IMU's
calibration slot (already the heater's regulated sensor) with a higher
priority so selection is deterministic, with fallback to the SPI2 IMU on
degradation. Replaces the placeholder TODO on HEATER1_SENS_ID, whose id
is the running SPI1 device.
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit 3826a2a706)
* feat(drivers/imu/st/lsm6dsv): LSM6DSV 80X and 320X (#27625)
* drivers: LSM6DSV 80X and 320X
* fix(drivers/lsm6dsv): flip y/z axes to match PX4 driver convention
The ST sensor frame is right handed with z up. Flip y and z in the
driver so it publishes x forward, y right, z down like the InvenSense
drivers, and board rotations only describe physical mounting.
Update FMU-v6c accordingly: -R 26 (PITCH_180_YAW_90) becomes -R 6
(YAW_270), now matching the ICM42688P sharing the same footprint.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(drivers/lsm6dsv): don't flush FIFO on high-g full-scale change
Flushing discarded batched gyro and low-g samples on every range step,
causing a data gap at exactly the moments the high-g channel matters.
Only the high-g channel's scale changes, so instead skip publishing and
clip-evaluating high-g samples for one read cycle while the words
captured at the previous full-scale drain naturally.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(drivers/lsm6dsv): publish high-g samples captured before a full-scale change
Instead of skipping the high-g channel for a cycle after a range step,
normalize samples captured at the previous full-scale to the current
one (counts scaled by the exact sensitivity ratio) and publish them.
Samples are classified by reconstructed capture time since the batch
drained after a change mixes old- and new-scale words. This keeps the
high-g data flowing through escalations, which happen mid-impact when
that data matters most.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(drivers/lsm6dsv): retry WHO_AM_I read in probe
The first SPI transaction after power-up can return garbage (reads
0xFF) while the device's shared I2C/I3C/SPI interface latches onto SPI
mode on the first CS falling edge. The single-shot probe read made
startup fail until bus traffic preceded it; retry up to 3 times like
the InvenSense drivers do.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(drivers/lsm6dsv): set full-scale before enabling the ODRs
Both datasheets footnote CTRL6 that FS_G must be set while the gyro is in
power-down, and the reset default FS_G=000 is reserved on the 80X, 320X and
DSK320X. Configure() writes _register_cfg in array order, and that order put
CTRL1/CTRL2 ahead of CTRL6/CTRL8 — so the gyro powered up at full ODR on a
reserved full-scale, and FS_G was then changed while it was running.
Move every full-scale, filter and FIFO register ahead of CTRL1/CTRL2, which
set the ODRs and are what actually power the sensors up.
* fix(drivers/lsm6dsv): drain the FIFO in a single burst read
FIFORead() issued one 8-byte SPI transaction per 7-byte FIFO word. At the
7.68 kHz the high-g variants run, that is ~23k transactions/s, and each one
pays a bus lock, a CS toggle and a full SPI reconfigure — roughly 0.5-1 ms of
bus time per 2.5 ms drain.
AN5763 / AN6119 section 9.8 document reading DIFF_FIFO words as a single
(N * 7)-byte operation: with IF_INC set the address rounds from
FIFO_DATA_OUT_Z_H back to FIFO_DATA_OUT_TAG at every word boundary. Read the
whole drain into one buffer and dispatch by tag out of it, which is also the
shape every InvenSense driver in the tree already uses.
Also correct the FIFO::DEPTH comment: 512 is the ceiling of the DIFF_FIFO
counter, not the buffer size (1.5 KB, ~219 uncompressed words).
* fix(drivers/lsm6dsv): pin the high-g channel at its top full-scale
The high-g full-scale escalated 32 -> 64 -> 80 g on high-g clipping and
de-escalated after 2 s quiet, which in turn needed a rescale path to normalize
samples still batched at the previous sensitivity. None of it earns its keep.
The high-g channel is only ever published while the low-g channel clips, i.e.
above 16 g. All the ladder buys there is resolution — 0.976 vs 3.904 mg/LSB,
0.0096 vs 0.038 m/s² — while the fallback engages with the high-g channel's
±1.5 g typ zero-g offset uncalibrated, a 15 m/s² bias step. And it climbs one
step per FIFO drain (2.5 ms at the default IMU_GYRO_RATEMAX), so it needs
5-7.5 ms to reach ±80 g and lands after an impact's peak has passed — precisely
the sample it exists to capture.
Pin each variant at its top range instead: ±80 g on the 80X, ±320 g on the
320X. The first peak is caught unclipped, and ManageHighGFullScale(),
ApplyHighGFullScale(), RescaleCount(), the stale-sample normalization and the
high-g clip evaluation all go with it.
Two latent bugs go away rather than needing fixes. SampleClips()'s int16
threshold (~23070 counts) could never fire at ±80 g, which saturates around
20492 (3.904 mg/LSB), so sustained >64 g would have oscillated 64<->80 g; it
now only sees the low-g channel, whose ±16 g / 0.488 mg/LSB scaling does reach
the rail. And escalation could drive an 80X started with -T 320 into FS codes
011/100, which are reserved on that part — nothing writes them now.
* fix(drivers/lsm6dsv): drop unused ACCEL_ODR_HIGHG
The high-g variants' accel ODR is never referenced by name — CTRL1, CTRL2 and
the FIFO BDR all take the register code, and the sample timing is derived from
GYRO_ODR_HIGHG.
* fix(drivers/lsm6dsv): publish the high-g channel directly on the 80X / 320X
The accelerometer channel was chosen per FIFO batch: publish low-g normally,
switch to high-g for any batch where a low-g sample passed a clip threshold.
A sensor_accel_fifo message carries a single scale factor, so that meant
restating the scale of samples that had already been taken, and the decision
had no hysteresis: sustained vibration near the threshold flips the scale
batch to batch at the full publish rate, stepping the high-g channel's
uncalibrated +/-1.5 g typ zero-g offset in and out of the estimator each time.
On a part picked for its high-g range the low-g channel's finer resolution is
not worth any of that, so publish the high-g channel and nothing else, with
the scale fixed in Configure() for the lifetime of the driver — the same
fixed-scale approach the ICM45686 moved to.
The low-g channel stays enabled and batched; its FIFO words are simply not
consumed. Dropping BDR_XL would save a third of the FIFO traffic but is only
safe once XL_HG_BATCH_EN is confirmed to batch independently of it.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(drivers/lsm6dsv): drain whole sample periods only
The transfer buffer was sized to hold a partial trailing period on top of
FIFO_MAX_SAMPLES full ones, so a maximal drain yielded 33 gyro and 33 accel
words into 32-slot messages. The per-channel bound checks then dropped the
newest sample of each without a trace, leaving timestamp_sample one dt
optimistic for that batch.
Hand FIFORead whole periods instead and leave any period still being batched
in the FIFO for the next cycle. The message capacity is now a static_assert
rather than a runtime check, and the remaining bound is a real error path: it
can only trip if the tag stream stops matching the configured batching, which
is corruption, not a backlog.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* refactor(drivers/lsm6dsv): drop the periodic register check
Re-reading configuration registers in the run loop and resetting the sensor
when one disagrees is nondeterministic behaviour guarding against something
that does not happen: nothing in the FIFO read path writes to a register
address, so a configured register does not spontaneously change. It only adds
register traffic to the cycle and gives a transient SPI error a path to reset
a healthy sensor.
The 1 Hz temperature update was in the else arm of that check, so it only ran
on cycles the check skipped; it now runs on its own timer. Configure() still
verifies every register once after writing it, which is what makes the
CONFIGURE retry work.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* refactor(drivers/lsm6dsv): hold the FIFO transfer buffer as a member
The transfer buffer was a stack local, zero-initialised on every FIFO read in
wq:SPIx. Nothing reads past transfer_size, so the clear was never protecting
against stale data; only the command byte has to be restored, because
transfer() overwrites it with the byte clocked in alongside.
Also drop the FIFO temperature tag handling. FIFO_CTRL4 leaves ODR_T_BATCH at
0, so no temperature word is ever batched and the branch was unreachable;
UpdateTemperature() is what actually reports temperature.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* perf(drivers/lsm6dsv): batch only the high-g channel on the 80X / 320X
The low-g channel was still batched into the FIFO alongside the high-g
one and its words simply discarded, so every sample period cost three
FIFO words and three words of SPI traffic for two that were used. The
high-g channel batches at its own ODR under XL_HG_BATCH_EN, independent
of BDR_XL, so leave the low-g channel unbatched on those parts. One
third less FIFO fill and SPI3 traffic at the same publish rate.
* docs(drivers/lsm6dsv): correct the high-g clip detection comment
The comment claimed PX4Accelerometer detects this channel's saturation
from range/scale via UpdateClipLimit(). That limit only serves the
non-FIFO update() path; updateFIFO() flags clipping off the int16 rail,
which the ±80 g channel never reaches. State that the saturation goes
unreported rather than the opposite.
* fix(drivers/lsm6dsv): publish the low-g ±16 g channel on the 80X / 320X
The high-g accelerometer is a sports-impact element: ±1.5 g typical zero-g offset, ±2 mg/°C tempco and 1000 µg/√Hz, against ±12 mg, ±0.07 mg/°C and 60 µg/√Hz for the low-g one in the same package. Pinning it at a narrower full-scale does not change the tempco. As the published accel it reads 0.4-0.6 m/s² low uncalibrated and drifts through a calibration with die temperature, which is the wrong property for a backup flight IMU.
Batch the low-g channel at the same 7.68 kHz and leave the high-g accelerometer powered down: XL_HG_BATCH_EN clear, CTRL1_XL_HG at reset, no ACCEL_HG words. Scale is 0.488 mg/LSB for every variant; the gyro stays ±4000 dps.
---------
Signed-off-by: alexklimaj <alex@arkelectron.com>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit 29dea325db)
* feat(boards/ark_fpv): add FMUID 1 LSM6DSV32X (#28512)
* feat(boards/ark_fpv): add FMUID 1 LSM6DSV32X
Rev 1 increments FMUID and replaces the IIM-42653 with an LSM6DSV32X
on the same SPI1 pads. Configure the 32X at ±32 g / ±4000 dps.
Assisted-by: Grok:grok-4.6
Signed-off-by: alexklimaj <alex@arkelectron.com>
* feat(drivers/lsm6dsv): run 32X at 7.68 kHz with PX4-owned filtering
Match IIM-42653-style raw data: HAODR 7680 Hz, disable accel LPF2,
10 MHz SPI (device max), and exact FS/32768 accel plus 140 mdps/LSB
gyro scales. Periodically re-check config registers like the TDK
drivers.
Assisted-by: Grok:grok-4.6
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(drivers/lsm6dsv): keep the accel LPF2 at ODR/10
PX4 has no anti-alias stage of its own: the FIFO is decimated to the
publish rate with a plain mean and the software cutoffs run after that,
so with LPF2 off the accel is flat to ODR/2 (3840 Hz on the 32X) and
that content folds into the published stream. ODR/10 is the nearest
match to the 585 Hz AAF the Invensense drivers use, and to what the
rev 0 ARK FPV IIM-42653 flies with. The gyro is unchanged: its LPF2 is
fixed by ODR at 537 Hz.
* fix(drivers/lsm6dsv): validate complete register fields
Runtime checks must detect changes to zero-valued rate, range, and filter bits. Include register faults in the published IMU error counts so health reporting retains the fault history after recovery.
Assisted-by: Codex:gpt-6
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: alexklimaj <alex@arkelectron.com>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit d05e3a4a26)
* fix(boards/ark_fpv): drive SPIX_SYNC only on the IIM-42653 revision (#28825)
SPIX_SYNC is the 32 kHz CLKIN on IMU pin 9. On FMUM 1 that pin is the
LSM6DSV32X INT2 push-pull output, so the MCU drove against it: the IMU
die ran about 10 degC hotter and accel read about 0.19 g off on one
axis.
Assisted-by: Claude:claude-opus-5-5
(cherry picked from commit bb4e77b00c)
* fix(drivers/imu/st/lsm6dsv): reset before telling the 16X from the 32X (#28823)
CTRL8 bit2 identifies the 32X only at its reset value, and probe() read it before any reset. After a warm restart from firmware that cleared the bit (drivers without 32X support write the 16X CTRL8 encoding), a 32X was detected as a 16X and its accel ran at ±32 g while scaled as ±16 g.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit a7646e2d6d)
* fix(boards/ark/fpv): split FW/VTOL builds to free flash (#27906)
* fix(boards/ark/fpv): split FW/VTOL into separate builds for flash
Default ark_fpv is multicopter-only so listener and sd_bench fit in
flash. Fixed-wing and VTOL stacks move to ark_fpv_fw and ark_fpv_vtol,
which disable those two system commands to stay under the limit.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(boards/ark/fpv): trim optional modules from vtol build
Drop gimbal, gyro_fft, autotune, camera, payload, and debug systemcmds
from ark_fpv_vtol so the full VTOL stack fits with more flash margin.
Signed-off-by: alexklimaj <alex@arkelectron.com>
* fix(boards/ark/fpv): keep more modules on vtol; trim only debug extras
Restore autotune, gimbal, gyro_fft, mag bias, payload, camera, esc
battery, and actuator_test on ark_fpv_vtol. Keep flash margin by
leaving sd_bench, listener, bsondump, i2cdetect, and pca9685 off.
Signed-off-by: alexklimaj <alex@arkelectron.com>
---------
Signed-off-by: alexklimaj <alex@arkelectron.com>
(cherry picked from commit 40a05f0709)
---------
Signed-off-by: alexklimaj <alex@arkelectron.com>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Alex Klimaj <alex@arkelectron.com>
Every Param<> constructor inlines param_set_used(handle()) followed by
param_get(handle(), &_val), materialising the handle constant twice at
each of the ~2000 instantiation sites. Fold both into a single
out-of-line param_get_mark_used() so each constructor emits one call.
The failsafe_web build stubs the param API itself, so it gets a matching
stub. The smaller constructors let the compiler fully inline the
defaulted FlightTaskDescend constructor on the ITCM boards, so its entry
is dropped from their linker scripts.
Saves 7232 B of .text on px4_fmu-v6x_default.
Co-authored-by: Balduin <balduin@auterion.com>
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit d3a2f02758)
Assisted-by: GitHub Copilot:gpt-6-astra
Backport-note: Use the original #28320 PR commit to retain its three ITCM linker cleanups, already supplied by #28321 before the main-branch squash.
`uint8_t buf[128] = {0xff}` only sets byte 0; the rest is 0x00. WEL
also clears after each page program, but BULKERASE issued one WREN
for 256 pages, so only page 0 was written. `mtd erase` then left the
store looking corrupt rather than blank. memset 0xff and WREN per
page.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit f365bf32c0)
Assisted-by: GitHub Copilot:gpt-6-astra
Console, TELEM2 and EXT2 took the NuttX default 256 B while the other
LPUARTs are 600. TELEM2 in particular is TX 10 KiB / RX 256, so the
link drops inbound bytes under load.
(cherry picked from commit 2a4cf610f3)
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Add the temperature compensation module to the VOXL2 SLPI build and start it with the onboard sensor stack.
Track DPS368 detection and disable barometer temperature compensation for that sensor while leaving IMU compensation available.
* fix(cdcacm_autostart): start MAVLink without holding the USB port (#28185)
* fix(cdcacm_autostart): start MAVLink without holding the USB port
SYS_USB_AUTO=2 opened /dev/ttyACM0 O_RDONLY and kept it for the life of
the link, then treated a successful mavlink spawn as permanent success.
If mavlink later failed its UART open retries and exited, the driver
stayed "connected" and never restarted — listen-first hosts (production
USB MAVLink benches) saw no heartbeats until a VBUS cycle.
Start mavlink without a probe open, track its PID and restart if it
dies while VBUS is present, close the autodetect fd before handing the
device to a protocol, and drop the unused legacy cdc_acm_check path.
Assisted-by: Grok:grok-4.5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(cdcacm_autostart): initialise actuator_armed before the armed gate
copy() leaves the destination untouched when a topic has never been advertised,
so with commander not running `report` is whatever was on the stack. When that
garbage has armed set, run_state_machine() takes the "do not reconfigure USB
while flying" branch every cycle and never advances the state machine, so
MAVLink is never started on the USB CDC — on a vehicle that is definitionally
not flying, because commander is not running.
Seen on an ARK FMU v6X production test bench: a `commander stop` early in the
sequence leaves `listener actuator_armed` reporting "never published", and from
then on `mavlink status` shows no ttyACM instance at all while a host that opens
the port waits out its timeout against silence.
Zero-initialising restores the correct default for that case: not armed, so the
state machine runs.
* Update src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
* Update src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
* Update src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
* Update src/drivers/cdcacm_autostart/cdcacm_autostart.cpp
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit f05739035e)
* fix(cdcacm_autostart): remove mavlink autostart magic (#28197)
* fix(cdcacm_autostart): remove mavlink autostart magic
I don't understand why we would have to try to autostart mavlink at 2
Hz. It should be started and stopped exactly once, if "it dies" out of
nowhere then that's a bug to look into and fix, not something to mask.
* fix(cdcacm_autostart): gate mavlink start on port readiness
CDC/ACM registers /dev/ttyACM0 as soon as sercon returns, but the serial
device starts out disconnected and open() returns -ENOTCONN until the host
has enumerated and issued SET_CONFIGURATION. Spawning mavlink before that
leaves its three open retries as the only guard: if the host is slow, or
never enumerates at all (power-only cable, or a carrier that drives VBUS
detect from a GPIO), mavlink exits and the state machine sits in connected
with nothing on the link until VBUS cycles.
Probe the port before spawning mavlink and keep retrying on the normal
500ms tick until it opens, then release the probe so nothing holds a second
open for the life of the link. This makes the assumption that mavlink does
not exit on its own true by construction, so no supervision is needed.
The 1s post-sercon delay is redundant now that the probe gates the start.
Assisted-by: Claude:claude-opus-5[1m]
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
(cherry picked from commit 6c8d548db0)
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Julian Oes <julian@oes.ch>
This board is at 94.7% flash on main and out of heap before MAVLink starts
(#28109), so it needs static RAM back, not only flash.
Measured by building fmu-v4 with and without each:
UAVCAN flash -147276 B static RAM -3520 B
uxrce_dds_client flash -59508 B static RAM -64 B
Effect: 3652 B of static RAM and 207 kB of flash returned.
UAVCAN is the only module here that returns meaningful RAM, and it is paid even
though the driver never starts, since UAVCAN_ENABLE defaults to 0. For contrast,
dropping five other modules including attitude_estimator_q and
local_position_estimator returned 128 B, so module removal is otherwise a flash
lever only. The UAVCAN driver costing 3.5 kB of .bss wherever it is compiled in
and not started is worth fixing properly for every constrained board.
This is a trade and is offered as one. A Pixracer with a DroneCAN GPS or CAN ESCs
loses them and must set CONFIG_DRIVERS_UAVCAN=y in a local build.
mag_bias_estimator is likewise a deliberate feature removal: MBE_ENABLE defaults
to 1 and rcS starts it, so pre-takeoff continuous magnetometer calibration goes
away on this board. SIH never runs on hardware and uxrce_dds_client only starts
when UXRCE_DDS_CFG points at a port, so neither holds heap today.
(cherry picked from commit 6388739efb)
The verbose estimator uORB nodes cost heap this board does not have. Measured
on hardware with EKF2 running and two MAVLink instances up: 7440 B free at 0
against 3696 B at 1.
Effect: 3744 B returned. On this board that is not optional headroom. With the
receive stack fix alone and this parameter at its upstream default, the board
comes up and streams telemetry but answers no request at all, no PARAM_VALUE
and no COMMAND_ACK, and a ground station hangs requesting capabilities.
Cost: the default logging profile picks up estimator* topics by name prefix at
2 Hz via add_optional_topic_multi, which only logs advertised topics, so turning
it off removes innovations, variances, test ratios, states, the aid_src_* set and
the bias topics, and Flight Review's innovation plots go empty on this board.
estimator_status still carries the filtered test ratios, filter fault flags,
reset counters and pre_flt_fail_innov_*, and replay still works because
SDLOG_PROFILE bit 1 logs EKF2's inputs.
Applied with param set-default so an operator can opt back in. rcS sources
rc.board_defaults at line 280 and starts ekf2 at 437, and EKF2 reads the
parameter in its constructor, so the default lands in time. Note a board with
this parameter explicitly saved keeps its saved value.
(cherry picked from commit 001817022a)
CONFIG_FS_PROCFS_MAX_TASKS sizes system_load.tasks[], the per-task reporting
table behind top, /proc and the cpuload accounting. NuttX defaults it to 128
and this board never overrode it, so 128 slots at 24 B each are reserved for
the life of the board. It runs 25 tasks, counted with ls /proc.
Effect: system_load 3096 -> 1560 B, so 1536 B of static RAM returned to the
heap arena.
The second effect matters more on this board. Every NSH builtin needs a 4096 B
task spawn, and before this the largest free block with a ground station
attached was 3760 B, so no console command would run at all: param and top both
failed with "command not found", which is ENOMEM in disguise. With this the
largest block reaches 4416 B and the console works.
64 leaves 2.56x headroom over the live count, enough for the transient tasks a
calibration or parameter save adds. If the limit were ever exceeded, top and
procfs would list fewer tasks and a task's CPU time would go unaccounted;
nothing else is affected.
(cherry picked from commit 097d86e201)
Four of the seven ports carry hand-inflated buffers while every other port on
the board uses 300. They are static allocations, so they come straight off the
heap arena, on a board that runs out of heap before MAVLink can start (#28109).
USART1 TX 2500 -> 600 ESP8266 header, usually unpopulated
USART2 TX 1100 -> 600 TELEM1
USART3 RX 1200 -> 600 TELEM2
USART3 TX 900 -> 600
Effect: 3328 B of static RAM returned, flash unchanged. Measured with the
NuttX submodule cleaned, since it builds in-tree and does not rebuild on a
config change, and verified in the ELF with nm.
No functionality is removed. What is given up is burst headroom: MAVLink defers
when a TX buffer is full, so a stream is throttled rather than lost, and 600 B
is still 83 ms at 57600 baud. Both telemetry ports have hardware flow control
and RX DMA, so a full RX ring asserts RTS instead of dropping bytes.
This cannot affect the failure in #28109, which is on USB, a CDCACM link with
its own separate buffers.
(cherry picked from commit f9e9a8eca3)
Work queue stacks are carved from the same allocator pool as the heap on
NuttX, so an over-reserved queue stack costs the board free memory directly.
This board runs out of heap before MAVLink can start (#28109).
Measured at default sizes with CONFIG_STACK_COLORATION=y, reading StackUsed
from top and /proc/<pid>/stack:
queue default peak set to margin
lp_default 3472 1412 2400 1.70x
hp_default 2776 1104 2300 2.08x
I2C1 2312 840 1900 2.26x
Effect: 2040 B returned to the heap.
Verified after trimming, on the resulting firmware rather than by calculation:
queue trimmed peak margin
lp_default 2376 1388 1.71x
hp_default 2272 1104 2.06x
I2C1 1872 840 2.23x
lp_default's peak appears only after provoking the parameter autosave, which
runs on that queue and writes through to storage. Idle it reads 1100 B, so the
deep path has to be triggered deliberately: change a parameter to a genuinely
different value, since PX4 only saves when the value changed, then re-read
StackUsed. On a board too full to run top this is readable with
cat /proc/<pid>/stack, which reports the same up_check_tcbstack() figure.
The remaining queues are left alone because they have no slack: rate_ctrl
1.28x, SPI1 1.42x, INS0 1.56x, nav_and_controllers 1.69x. SPI2 looks generous
at 3.02x but CONFIG_WQ_SPI_STACKSIZE sizes every SPI queue, so its headroom
cannot be taken without starving SPI1.
INS0 is why these are measured rather than estimated: its peak is 1180 B with
ekf2 stopped and 3828 B once ekf2 runs in that queue.
(cherry picked from commit 35ad0fb424)
V6X-RT executes code in place from external octal flash, making reliable read
timing important for robust operation. The boot ROM does not always place the
DLL delay used to sample the flash DQS strobe near the centre of the valid read
window, which can reduce timing margin and, in rare cases, lead to instruction
fetch errors.
Add a RAM-resident boot hook that sweeps the DLL delay, reads back a known
pattern through a direct command at each setting, and selects the midpoint of
the widest passing range. This recentres the DLL within the valid-read window
and improves read-timing margin. The implementation follows the NXP DLL update
sequence (stop mode, DSB/ISB, ERR011377 post-lock settle) and falls back to the
boot ROM setting if calibration does not complete successfully. The selected
result is stored in g_dll_cal and logged from board_app_initialize() to avoid
interfering with the early console.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
(cherry picked from commit 9f4bc80006)
* fix(boards/px4_fmu-v6xrt): correct FRAM bwrite loop and alignment
imxrt_flexspi_fram_bwrite() advances offset and len for each page but
never advances src, so a write of more than one block programs the data
of the first page into every following page.
imxrt_flexspi_fram_page_program() also casts the caller's buffer to
uint32_t * and imxrt_flexspi_write_blocking() reads it one word at a
time, while the MTD interface makes no alignment guarantee and the block
layer above does pass byte-aligned buffers. Copy the page into a
word-aligned buffer when the source is not aligned.
On the default configuration the alignment issue is latent, because
unaligned loads from normal memory are permitted. With D-cache disabled
the MPU marks RAM as strongly-ordered, where any unaligned access
faults, and every param save hard-faulted the board.
Bench tested on a Pixhawk 6X-RT: 10 consecutive param save with no
reboot, plus a set/save/reboot round-trip confirming persistence.
Before the fix the same test hard-faulted on the first save.
Assisted-by: Claude:claude-opus-5
* fix(boards/px4_fmu-v6xrt): move FRAM bounce buffer off the stack
The alignment bounce buffer was a local, so every caller of write() on
this device paid a page (128 B) of extra stack, taken path or not. Move
it into imxrt_flexspi_fram_dev_s.
The buffer is then shared state, and nothing above serializes it: the two
partitions on this device (/fs/mtd_params, /fs/mtd_caldata) get one BCH
lock each, and mtd_partition does not lock. Guard the page loop with a
mutex, which also keeps two partitions from interleaving transactions on
the FlexSPI controller.
Suggested-by: Peter van der Perk <peter.vanderperk@nxp.com>
Assisted-by: Claude:claude-opus-5
(cherry picked from commit e8a4304e1c)
The per-channel send mutex is genuinely recursive: callers hold lock_send()
while the MAVLink C library re-enters send_start()/send_finish() on the same
mutex via MAVLINK_START_UART_SEND. On NuttX a recursive mutex only works with
CONFIG_PTHREAD_MUTEX_TYPES; without it pthread_mutexattr_settype() is a no-op
and the nested lock deadlocks. Only a handful of boards happened to enable the
option (for Zenoh), so mavlink could deadlock at startup on most boards, e.g.
when bringing up a USB link.
Enable CONFIG_PTHREAD_MUTEX_TYPES on the NuttX boards that build mavlink, add
a compile-time guard so a board missing the option fails the build loudly
instead of deadlocking silently, and check the settype() return. Enabling the
option is free in flash and RAM on these boards since they already enable
CONFIG_PRIORITY_INHERITANCE / CONFIG_PTHREAD_MUTEX_ROBUST.
Signed-off-by: Julian Oes <julian@oes.ch>
The AirBrainH743 breaks out a single I2C bus (I2C1) that also carries the
onboard DPS310 baro and IIS2MDC mag. Because the bus was marked internal,
the external-compass autostart (which scans external buses with -X) never
probed it, so an external GPS/compass on that bus was never bound.
Mark I2C1 external so the external-mag autostart scans it, and add a
px4_i2c_device_external() override (guarded by BOARD_OVERRIDE_I2C_DEVICE_EXTERNAL)
that keeps the onboard baro and mag classified as internal. This mirrors the
approach used on fmu-v6c. The onboard baro/mag are now started explicitly by
bus and address (-X -b 1) since -I no longer matches the external bus.
Also enable the i2cdetect command, which is handy for probing the shared
external bus on this board.
Signed-off-by: Julian Oes <julian@oes.ch>
_interval_us and _last_update are read in SubscriptionCallbackWorkItem::call()
(and SubscriptionBlocking::call()) on the publishing thread, while the subscriber
sets them - e.g. from mixer_module's setMaxTopicUpdateRate() on a reconfigure.
That is a genuine cross-thread access that ThreadSanitizer flags.
Instead of making these fields atomic in the base SubscriptionInterval - which is
used single-threaded by 100+ subscriptions - parameterize the class on whether the
interval / last-update storage is atomic and expose two aliases:
SubscriptionInterval plain, single-threaded (the common case)
SubscriptionIntervalAtomic atomic, for callback subscriptions
SubscriptionCallback - and hence all callback subscriptions
(SubscriptionCallbackWorkItem, SubscriptionBlocking, CallbackHandler) - uses the
atomic variant; every other subscription stays plain with no synchronization
overhead.
The updated()/update()/copy() bodies stay out-of-line with explicit instantiation
of both variants, so they are not inlined at every call site (flash size).
* add files
* add corvon_V5 docs
docs: fix connectors image path
* docs: address Copilot formatting suggestions
* Subedit
* docs: add radio control wiring details for corvon_V5
* Update docs/en/flight_controller/corvon_V5.md
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* boards/corvon: rename V5 subdirectory to v5
This renames the corvon_V5 board to corvon_v5 to conform to PX4 lowercase naming conventions as requested by @mrpollo. Renames target files, docs, and assets accordingly.
* Apply suggestion from @hamishwillee
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* docs: add DSU7 debug port pinout and warnings for corvon_v5
This addresses reviewer feedback to include debug port information, placed immediately after the Radio Control section as requested.
* Apply suggestion from @hamishwillee
* fix(boards/corvon_v5): remove unused heater and temperature_compensation
- heater: board has no IMU heater; fixes build after #26325 (requires HEATER_NUM)
- temperature_compensation: modern IMU doesn't need it, follow #27015
Signed-off-by: holydust <holydust@live.ca>
* docs(update): Subedit. Add pwm outputs and gps
* Update docs/en/flight_controller/corvon_v5.md
* Update docs/en/flight_controller/corvon_v5.md
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* docs(corvon_v5): add UART flow control, power details, fix broken links
* docs(corvon_v5): fix UART table typo
* fix(boards/corvon_v5): remove unused PX4IO macros. Board has no PX4IO co-processor
Signed-off-by: holydust <holydust@live.ca>
* Apply suggestions from code review
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* docs(corvon_v5): update board images
Signed-off-by: holydust <holydust@live.ca>
* fix(corvon_v5): drop unused dshot, fix can3 and adc comments
- Remove CONFIG_DRIVERS_DSHOT=y from default.px4board: DShot is not
supported on this board (no IO timer is DShot-configured) and the
docs already state it as unsupported.
- Fix ADC1_IN8 GPIO list comment from PB8 to PB0 (PB0 is the correct
pin on STM32F765; matches GPIO_RSSI_IN definition below).
- Clarify CAN3 comment in nuttx-config board.h: the pins are unused
on CORVON_V5 (no transceiver populated). manifest.c already marks
CAN3 as not present.
- Update corvon_v5_pinout.xlsx 'All Pinouts' sheet so PA7 (HEATER)
and PA8/PA15/PH4 (CAN3 RX/TX/SILENT) read 'Unused', matching the
actual hardware.
Signed-off-by: holydust <holydust@live.ca>
* fix(corvon_v5): use MCS Electronics USB VID/PID
Set VID/PID to 0x16D0/0x152A (MCS Electronics) in the app defconfig
and regenerate the bootloader binary, replacing the 3DR FMUv5 IDs
inherited from the reference config.
Signed-off-by: holydust <holydust@live.ca>
---------
Signed-off-by: holydust <holydust@live.ca>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* Add Sony AS-DT1 Distance Sensor and Documentation
* Ensuring Rotation Parameter works
* Sony ASDT1 Sensor and Documentaiton
* Fixed formatting and added additional comments
* Forgot to stage 1 formatting issue
* fix(drivers): use AS-DT1 parameters consistently
remove the Sony-ASDT1 -R command line rotation, as well as some other small fixes. Updated the docs to reflect this as well.
* refactor(drivers): clarify Sony AS-DT1 variable names
---------
Co-authored-by: Sean Hickey <sean@ascendengineer.com>
Co-authored-by: Andrew Brahim <35986980+dirksavage88@users.noreply.github.com>
PB2 has no timer alternate function on the F412, so declare
PPS_CAPTURE_GPIO for the EXTI path, enable CONFIG_DRIVERS_PPS_CAPTURE, and
start pps_capture from rc.board_sensors.
Add a focused airship build target (make px4_fmu-v6x_airship) on the
reference flagship, mirroring the existing spacecraft and uuv
experimental-vehicle variants on the same board. It enables
control_allocator and airship_att_control and keeps land_detector
(the airship startup runs `land_detector start airship`), and disables
the fixed-wing, multicopter and VTOL controllers an airship does not use.
Builds at 86.76% flash with the Cloudship airframe included.
Signed-off-by: Hyunduk Shin <hyunduk@icarus-airship.com>
Disabled if ICE_IDLE_RPM is 0.
The idle state is entered when the commanded throttle is close to zero
or the measured RPM drops below the idle threshold.
The idle state is exited if the commanded thrust is increased to above
the last needed throttle to keep idle.
Signed-off-by: Silvan <silvan@auterion.com>
Co-authored-by: Silvan <silvan@auterion.com>
* fix(boards): update STM32H7 bootloaders with ECC scrub and enable bl_update
The committed extras/*_bootloader.bin for every STM32H7 flash-parameter
target predate #27642, so none carry the uncorrectable-flash-ECC scrub
that keeps a torn parameter-flash write from bricking the board on every
boot. Rebuild each bootloader from current main with the release
toolchain (GCC 13.2.1) and enable CONFIG_SYSTEMCMDS_BL_UPDATE so the fix
can be applied in the field via SYS_BL_UPDATE without a debugger; the
~40-45 KB image is embedded in ROMFS only when the option is on.
ark/fpv drops LANDING_TARGET_ESTIMATOR to fit the embedded image,
x-mav/ap-h743v2 gets its first committed bin, and a stray duplicate
bootloader bin is removed from kakuteh7dualimu/extras.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(boards): remove SCH16T from ARK FPV mavlink-dev.px4board
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>