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>
This commit is contained in:
Pedro Roque
2025-07-23 08:23:13 -07:00
committed by GitHub
co-authored by Daniel Agar Peter van der Perk
parent 8b2c0b4250
commit 6474e5d7c1
13 changed files with 102 additions and 9 deletions
@@ -71,6 +71,10 @@ static int io_timer_handler5(int irq, void *context, void *arg);
static int io_timer_handler6(int irq, void *context, void *arg);
static int io_timer_handler7(int irq, void *context, void *arg);
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 1000000
#endif
@@ -79,6 +79,10 @@ static int io_timer_handler7(int irq, void *context, void *arg);
* FTM0 will drive FMU_CH1-4, FTM3 will drive FMU_CH5,6, and
* U_TRI. FTM2 will be used as input capture on U_ECH
*/
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 1000000
#endif
@@ -77,6 +77,10 @@ static int io_timer_handler7(int irq, void *context, void *arg);
* All FTM blocks have their clock sources set to the system oscillator
* which should generate an 8 MHz clock.
*/
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 1000000
#endif
@@ -79,6 +79,10 @@ static int io_timer_handler7(int irq, void *context, void *arg);
#define BOARD_PWM_PRESCALER 20
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 160000000 / BOARD_PWM_PRESCALER
#endif
@@ -65,6 +65,10 @@
// Each timer also has double buffered wrap (rTOP) and level (rCC) registers so the value can
// change while PWM is running.
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 1000000
#endif
@@ -91,6 +91,10 @@ static int io_timer_handler7(int irq, void *context, void *arg);
* We also allow for overrides here but all timer register usage need to be
* taken into account
*/
#ifdef CONFIG_BOARD_PWM_FREQ
#define BOARD_PWM_FREQ CONFIG_BOARD_PWM_FREQ
#endif
#if !defined(BOARD_PWM_FREQ)
#define BOARD_PWM_FREQ 1000000
#endif