832 Commits

Author SHA1 Message Date
Julian Oes
833e4536b7 nuttx: add support for NAND flash
This cherry-picks upstream commits adding NAND flash support for the
Winbond W25N specifically W25N01GV chip.

NAND flash is used together with littlefs, hence I updated that to 2.5.1
to match upstream NuttX.
2026-02-10 15:23:51 +13:00
Julian Oes
9460625c99
Tools: rewrite uploader script (#26310)
* Tools: rewrite uploader script

This adds a script called px4_uploader.py which is a complete rewrite
using Claude Code of px_uploader.py.

The main improvements over the previous px_uploader.py script are:
- Separate smaller classes instead of one big uploader class.
- Easier debugging with --verbose or --debug flags.
- Nicer progress animation.
- No more hard to debug Exception swallowing over multiple levels.
- Auto-detection and looping of devices, removing the functionality from
  cmake.
- Auto-detection of PX4 devices by USB VID/PID.
- Add noninteractive mode
- Add JSON output mode
2026-01-24 11:09:17 +13:00
Phil-Engljaehringer
3438d593a1
drivers: MCP23009 & MCP23017 shared code base (#25924)
* Implemented driver for MCP23017

* fixed compatability with mcp23009. (naming of instantiated GPIO-Devices)

* removed some comments

* removed even more comments

* commented out instatntiation of driver since it will not be used with v6x

* removed last useless comments

* re-activated gpio_mcp23009 driver, removed useless comments and empty lines

* removed empty lines at the end of mcp23017.cpp

* removed empty line

* Implemented driver for MCP23017

* fixed compatability with mcp23009. (naming of instantiated GPIO-Devices)

* removed some comments

* removed even more comments

* commented out instatntiation of driver since it will not be used with v6x

* removed last useless comments

* re-activated gpio_mcp23009 driver, removed useless comments and empty lines

* removed empty lines at the end of mcp23017.cpp

* removed empty line

* basic working implementation

* first improved driver version with shared code base for MCP23009 & MCP23017 (built as state machine with sanity checks)

* removed unused imports

* changed module name from MCP to MCP230XX

* removed debug print statements

* adjusted auto start command of driver

* removed comments

* -added seperate main functions for both derivative modules (mcp23009 and mcp23017)

* compile common functions as shared library in src/lib/drivers

* fixed cleanup of modules

* ->unclean working version with shared common library

* used make format

* working & cleaned version

* -> Added CallbackHandler to be able to use multiple reading GPIO-expanders simultaneously
-> Removed old mcap23009 calls and pin registrations
-> Adjusted GpioIn.msg to contain MAX_INSTANCES

* ->removed unused imports
->used make format

* Fix: Re-enabled platform_mcp_gpio for accton-godwit, cuav, fmu-v5x

* Fix: enabled platform_mcp_gpio in px4/fmu-v5x

* added depency to fmu-v5x

* Fix: removed new lines

* Fix: fixed linker errors

* removed unused linkage against mcp-library

* Made mcp start calls consistent for fmu-v5x and fmu-v6x

* moved logging of comm errors to read/write function directly

* added perf_count for sanity_check

* removed error message

* ensured member variables follow naming convention

* added retries to probe function

* simplyfied state-logic

* add break to terminate loop early

* ensured clean state when register_gpios() fails

* add registered-flag to pins

* used path from top dir instead of relative path in CMakeLists

* used constexpr to set parameters instead of calculating them at runtime

* style: used make format

* fix: corrected i2c_bus assignment

* style: init input of callbackhandler to 0

* fix: mark pin as registered if successful

* style: made arguments const type

---------

Co-authored-by: Alexander Lerach <alexander@auterion.com>
2025-12-17 17:48:30 +01:00
Alexander Lerach
e822da74b2 io timer: fix input capture on various boards 2025-12-17 17:02:13 +01:00
Jacob Dahl
b92d21bd31
serial: add txSpaceAvailable function (#26069)
* serial: add txSpaceAvailable function

* serial: txSpaceAvailable and bytesAvailable fixups
2025-12-12 09:31:33 -09:00
Tarmo Tänav
f29aa182a8 Add support for NXP i.MX RT1170B 2025-11-26 09:59:51 -09:00
Alexis Guijarro
5f7e395609 NuttX: Add support for FM25V02A-DGQ 2025-11-24 10:37:45 -09:00
Peter van der Perk
921e91863a dshot: IMXRT BDSHOT baud training
AM32 bdshot doesn't do clock compensation like BLHeli32 did.
Instead we traing BDSHOT timing on known zero value to lock on
best bdshot baudrate to receive.

Reduces CRC and frame errors on AM32 a lot
2025-11-24 09:24:49 -09:00
Niklas Hauser
17f3db9231 [serial] Fix byte size, flow control, parity, stop bits configuration 2025-11-20 10:29:57 -09:00
Peter van der Perk
aaf6632a22 imxrt: move teensy bootloader to normal bootloader
Best for teensy is to use the teeny as normal bl
2025-11-10 00:52:58 -05:00
Jacob Dahl
38847b1cf3
stm32: io_timer: pullup gpio during dma capture (#25850) 2025-11-06 12:33:35 -07:00
Peter van der Perk
1250563ed1
Add support for NXP MR-VMU-Tropic board (#25845)
* rt106x: Use platform SPI hal layer

* rt106x: Add romapi support and reboot to isp/bootloader

* bootloader: imxrt_common: Add rt106x support

* NXP MR-Tropic initial commit

* Add missing file for mr-tropic bootloader

* nxp-mr-tropic:Bootloader Alow Assertion debugging & Keep Ram Vectors

* nxp-mr-tropic: Firmware Boot from bootloader

* nxp-mr-tropic:Add Bootloader bin file

* mr-tropic: Update config and linker

Fixes enet issues with write-back and some code cleanup.
Furthermore increase NOR LittleFS to 256kB to reflect on linker

* Update NuttX

* mr-tropic: fix itcm apping and add mr-tropic to itcm check

---------

Co-authored-by: David Sidrane <David.Sidrane@NscDg.com>
2025-11-05 11:48:26 -05:00
Thijs Hof
c44e0be18a fix bidir dshot for nxp xrt boards 2025-11-03 08:14:27 -09:00
Alexander Lerach
2e586c47b0 update nuttx (to include TX DMA fix) 2025-10-22 15:22:15 +02:00
Peter van der Perk
2f48cb4ef2
MR-CANHUBK344 NXP B3RB Rover support (#23897)
* s32k3xx: EMIOS allow independent frequencies for each channel

* mr-canhubk3: update config

* mr-canhubk344: Fix adap board detect

* mr-canhubk344: Use LPSPI1 (Port P1A) for SD card

* airframes: Add B3RB Ackermann rover config

See https://nxp.gitbook.io/mr-b3rb for more information about the NXP
B3RB platform. PX4 Support basic control for now
2025-10-09 23:28:43 -08:00
Henry Kotzé
dbd13070e5
esp32: pwm register updates correctly on change (#25653)
- removed the bug where some overflow would occur on the PWM signal when
  changing the duty cycle of the signal after power up. (PWM_MAIN_DIS,
PWM_MAIN_MIN or PWM_MAIN_MAX)

removed commented code

cleanup of previous cherry-pick

Co-authored-by: henrykotze <henry@autonosky.com>
2025-09-30 11:15:06 -08:00
Alexander Lerach
03e6f40995
nuttx submodule update (dcache fix)
* nuttx submodule update (dcache fix)
2025-09-29 18:04:26 +02:00
Alexander Lerach
0a8a5472ec nuttx submodule update (fix sem holder list) 2025-09-23 10:02:49 +02:00
Daniel Agar
d3f912ad25
platforms: Serial new dedicated writeBlocking method (#25537)
* platforms: Serial new dedicated writeBlocking method

* finish writeBlocking()

* add back fsync

* updated posix, added string constant for port not open error

* format

* fix build

* remove fsync

* actually remove fsync

* remove fsync from write

* review feedback

---------

Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2025-09-15 15:22:49 -08:00
Jacob Dahl
1aad8b6ec9
serial: nuttx: revert tcdrain back to fsync (#25538)
* serial: nuttx: revert tcdrain back to fsync

* serial: do not print error on EAGAIN

---------

Co-authored-by: Alexander Lerach <alexander@auterion.com>
2025-09-11 12:32:34 -08:00
Alex Klimaj
af6bf931c1
uavcan bootloader watchdog_pet during long flashes (#25523) 2025-09-04 12:20:03 -08:00
henrykotze
8b58c01cd7 ESP32 Support Sponsored by AutonoSky
nsh console running on USB
param module running
working with i2c and common drivers
provided implementation for drv_pwm_output.h
i2cdetect working as expected with no device
mavlink started succesfully
mounts sd card and logger runs
logger to file succesfully
pwm_servo implemented without using Nuttx lib
pwm_out outputs expected waveforms
- however currently if the frequency is higher than what the pwm_out
driver runs, there will be aliasing, based on how the registers gets
resets
wifi softap working
- Seeing wifi hotspot
- cant connect due to wrong password
- problems with adjusting ssid and password
wifi ssid and password being set accordinglu
connected to wifi hotspot with dhpcd
- made some changes to nuttx to only build for SoftAP mode, however this
was effectivelyy removing the ifdef for STATION mode. Should investigate
the coexist option again
added ifdef to not use timer 0 when wifi enabled
- reverted esp32 rt_timer to make use of timer 0 by default

fix setting incorrect bit in hrt timer register

- hrt running as expected, but on startup the pwm_out driver starts up
at about 200Hz and then rises over a minute or so 250Hz. Not sure if
this was present previously, and could be due to Wifi running at time
priority on timer 0

pull xtensa compilers in setup.ubuntu.sh
revert logger stacksize and cmake argument
esp32 chip revision and PX4 UUID implemented

spi board reset implemented, formatting checked

devkit acts on startup as a wifi bridge for comms

- the most usefull setting for the general developer when buying a esp32 devkit
- testing Mavlink shell using ./Tools/mavlink_shell.py
- todo: Test mavlink messages being forward

improve wifi telemetry by increasing prio

- Remove power save mode on wifi
- increased daemon thread schedule priority to 50

compiles without Nuttx changes

- updated compiler settings to match those of nuttx on px4 side

add espressif_esp32 to excluded boards

ci: allow docker to find xtensa compilers
2025-08-19 11:09:56 -07:00
alexklimaj
bc60307163 boards: ARK DIST 2025-08-07 21:26:13 -04:00
Jacob Dahl
b5bf28c204 platform: serial: add bytesAvailable() function 2025-07-29 09:07:03 -08:00
Sindre Meyer Hegre
3be0cb077c
Neural Control Mode (#24366)
* Add tflm to px4 with module

 - Add TensorFlow Lite Micro(TFLM) as a library in px4
 - Make a module that uses neural network inference for control, which uses TFLM for inference
 - Make board config files for PX4 with neural module

* Added neural flight mode

* Add posibility to read of inference times

* Fix comments from review:

- Switch ssh link to https link in submodule
- Remove mc_nn_control from startup

* Add tflm to px4 with module

 - Add TensorFlow Lite Micro(TFLM) as a library in px4
 - Make a module that uses neural network inference for control, which uses TFLM for inference
 - Make board config files for PX4 with neural module

* Added neural flight mode

* Add posibility to read of inference times

* Remove auto start

* Add logging from neural control module

* Fix automatic startup to only be when module is included

* Switch to flight mode registration

* Add docs

* Change min/max/coeff to actual parameters

* add figures to neural network docs

* Switch to e2e network

* Remove toolchain changes and replace with instructions in docs

* Get ready for merge after toolchain upgrade

* switch back to submodule

* Try to figure out cmake

* Get CI working with new toolchain

* Remove fork dependency

* Finalize PR

* fix toolchain inclusion

* Fix ctype_base.h include

* Cleanup includes for TFLM

* Remove redundant std

* Update FW module names in board files

* Fix docs

* Remove cstdlib copy

* Copy header from nuttx

* Prettier, markup, layout

* NeuralControl.msg - update uorb comments to current standard

* Add description to neural topic

* Fix typo

* Typo

* TFLM and Module utitlities

* Neural networks top level

* Update docs

* Add manual control

* Update docs

* Revert the manual control attempt

* Update docs/en/advanced/nn_module_utilities.md

* Add posibility to set trajectory setpoint with manual control

---------

Co-authored-by: Pedro Roque <padr@kth.se>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
2025-07-25 09:42:12 -08:00
Pedro Roque
6474e5d7c1
feat: configurable board pwm freq from Kconfig (#24787)
* feat: configurable board pwm freq from Kconfig

* feat: add board_pwm_config to submenu

* fix: define sequence correction

* fix: revert Tools/simulation/gz

* fix: track upstream gz

* fix: track upstream mavlink

* feat: adjustable pwm for multiple board types

* feat: add conditional check for CONFIG_ for correct fallback

* add: spacecraft board with correct BOARD_PWM_FREQ supporting 10Hz actuation rate

* fix: set dependencies for submenu arch chips

* fix: keep only upper arch level

* fix: proper checking - still not showing up for board config

* feat: add hidden kconfig for platforms

* Merge Nuttx config into px4board

Allows to expose nuttx into PX4 if needed

* Kconfig: Include nuttx symbols in updateconfig

Only if applicable i.e. defined in the kconfig

* fix: merged config with previously generated boardconfig

* doc: updated code comment

---------

Co-authored-by: Daniel Agar <daniel@agar.ca>
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-07-23 08:23:13 -07:00
dusan19
8dd14d9aaa
platforms/stm32_common: hrt.c: define timer 1 IRQ properly for H7 platform (#25260) 2025-07-21 09:53:38 -08:00
Jacob Dahl
09ebd21e55 mixer: remove used flag stop_outputs
dshot: fix motor test on CANnode

Also includes fixes for the DShot driver since stop_outputs is removed. The esc info command has been removed because it doesn't work with AM32, can only be used via command line, and complicates the driver
2025-07-11 08:53:52 -06:00
Jacob Dahl
bb423bc007
dshot: fix bidirectional dshot stream sharing (#24996)
Freeing the DMA stream in the hrt callback causes other peripherals on that DMA controller to lock up (namely GPS). Moving the free back into thread context, right before allocation, solves the problem
2025-06-10 00:36:45 -08:00
Jacob Dahl
6e7638c14b
dshot: fix scaling (#25001) 2025-06-10 00:26:17 -08:00
Jacob Dahl
64989c3b8d
dshot: add perf counter for hrt callback (15us avg) (#24976) 2025-06-05 14:45:28 -08:00
Peter van der Perk
b8fa208bb5 Update NuttX
Fixes RT117X OCRAM M7 memory freeze
2025-06-05 06:03:59 -07:00
Peter van der Perk
1656278b5e Update NuttX 2025-05-29 05:15:18 -04:00
Julian Oes
3c39095271
[Sponsored by Holybro] Support for Kakute H743-Wing (#24669)
* hrt: Fix PPM input on channel 2

The CCMR1_PPM define for PPM input on channel 2 was incorrectly set to 2,
which was setting bits for channel 1 instead of channel 2. This prevented
PPM input from functioning properly on channel 2.

Changed CCMR1_PPM for channel 2 from 2 to (1 << 8), which correctly
configures the CC2S bits for input capture mode on TI2.

This fixes an issue noted in the existing code comment:
"FIXME! There is an interaction in the CCMR registers that prevents
using Chan 1 as the timer and chan 2 as the PPM"

Tested on STM32H743 with PPM input on PC7 (TIM8_CH2).

* rc_input: enable sharing serial and PPM pin

By setting RC_SERIAL_PORT_SHARED_PPM_PIN_GPIO_RX it is now possible to
use the same pin on the STM32 for PPM input as well as serial input.

* boards: Add support for Holybro KakuteH7-Wing
2025-05-04 14:44:11 -08:00
Alexander Lerach
905b6ac0ba Use ITCM on v5x 2025-04-17 04:48:37 -04:00
Julian Oes
43f5a713db
stm32_common: add timer 12 (#24680) 2025-04-15 16:10:11 +12:00
Beat Küng
2d899c624e platforms: update nuttx submodule 2025-04-10 04:30:41 -04:00
Jacob Dahl
7cb7977263
dshot: only use 1 DMA, round robin the channels. Fix esc telemetry. (#24610) 2025-03-27 11:41:38 -06:00
Jacob Dahl
543851db50
[Sponsored by ARK] Bidirectional DShot (#23863)
* Bidirectional DShot

Co-authored-by: Julian Oes <julian@oes.ch>

* f4/f1 support, not supported

* fix f1 build target

* sanity check timer_channel value, fix CCxNP ifdef, debug stuff

* removed debug code, added define for H7 HAVE_GTIM_CCXNP

* round robin sampling for less than 4 DMA

* unlimited esc_status logging

* dshot: fix formatting

* dshot: add define for number of DMA channels to use

This allows individual boards to override the number of DShot channels
and hence avoid round robin capture of the RPM feedback.

* ARK: enable 4 DMA channels for DShot on 6X

* dshot: publish when all channels are updated

This slows down the ESC_STATUS publication in the case of round robin
capture. E.g. for 800 Hz output with one DMA channel, the ESC_STATUS is
now published at 200 Hz.

* dshot: avoid duplicate publications for bidir and telem

Instead of publishing both bidirectional dshot updates as well as
telemetry updates, we now combine the data from both streams, and
publish whenever we get RPM updates, as the latter arrives with higher
rate, e.g. 200 Hz with round robin, or faster otherwise.

When combining the data, we take RPM from bidirectional dshot, and the
rest from telemetry.

When we have only one of the two, either telemetry or bidirectional
dshot, we just publish that one.

* boards: add ark fpv and pi6x BOARD_DMA_NUM_DSHOT_CHANNELS

* dshot: turn off debug build

---------

Co-authored-by: Julian Oes <julian@oes.ch>
Co-authored-by: alexklimaj <alex@arkelectron.com>
2025-03-12 12:55:15 -06:00
Jacob Dahl
73b51242c8 nuttx: h7: eth: add checks for PHYID in stm32_phyinit
arch: stm32h7: Add support for dual bank flash memory
2025-02-22 08:46:12 -05:00
Peter van der Perk
64d8f9a3c6 cmake: for vscode launch fallback to gdb-multiarch
Newer toolchains don't ship with arm-none-eabi-gdb hence we should use gdb-multiarch instead
2025-02-03 23:12:30 -05:00
Matthias Grob
50092a7f67 NuttX: update submodule to branch px4_firmware_nuttx-10.3.0+ with "FlexSPI allow RWW" merged 2025-01-14 10:32:00 +01:00
Peter van der Perk
e9536cb30b
Tropic-community use flash as storage using LittleFS (#24158)
* Update NuttX
2025-01-08 21:35:08 -05:00
Matthias Grob
077ade4f8f Add IO timer channel mode for RPM and also sync up rpi configuration to work with all these drivers 2024-12-19 07:30:25 +01:00
Jacob Dahl
b891961a0c make upload: fix usb path wildcard 2024-11-19 23:02:12 -05:00
Peter van der Perk
5d29c7811b imxrt: tone_alarm: Add FlexPWM based Tone alarm driver 2024-11-06 17:28:35 -05:00
Peter van der Perk
a7e4000861 rgbled_pwm: Change linker so we can make board specific override for led functionality 2024-11-06 17:28:35 -05:00
Peter van der Perk
c6e86fdea0 Add Tropic teensy loader upload support 2024-11-06 17:28:35 -05:00
Jacob Dahl
87b52ae6ee Update platforms/nuttx/src/bootloader/stm/stm32_common/main.c 2024-11-05 06:59:47 -05:00
alexklimaj
7768dfda35 stm32 bootloader: use STM32_CPUCLK_FREQUENCY for systick_mhz 2024-11-05 06:59:47 -05:00