Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PX4 H7 ADC - stm32h7_adc: Dynamically set clock prescaler and BOOST settings #22503

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/ark/fmu-v6x/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/cuav/nora/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/cuav/x7pro/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/cubepilot/cubeorange/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */

/* FLASH wait states */
#define BOARD_FLASH_WAITSTATES 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */

/* FLASH wait states */
#define BOARD_FLASH_WAITSTATES 2
Expand Down
2 changes: 1 addition & 1 deletion boards/holybro/durandal-v1/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/holybro/kakuteh7/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/holybro/kakuteh7mini/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/holybro/kakuteh7v2/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/matek/h743-mini/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/matek/h743-slim/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/matek/h743/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/modalai/fc-v2/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/mro/ctrl-zero-classic/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/mro/ctrl-zero-h7-oem/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/mro/ctrl-zero-h7/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/mro/pixracerpro/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
#define STM32_RCC_D2CCIP1R_SPI45SRC RCC_D2CCIP1R_SPI45SEL_PLL2 /* SPI45 clock source */
#define STM32_RCC_D3CCIPR_SPI6SRC RCC_D3CCIPR_SPI6SEL_PLL2 /* SPI6 clock source */
#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */
#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/px4/fmu-v6c/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/px4/fmu-v6u/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* CAN FD clock source */
#define STM32_FDCANCLK STM32_HSE_FREQUENCY
Expand Down
2 changes: 1 addition & 1 deletion boards/px4/fmu-v6x/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/siyi/n7/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@

#define STM32_RCC_D2CCIP2R_USBSRC RCC_D2CCIP2R_USBSEL_PLL3 /* USB 1 and 2 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2 /* ADC 1 2 3 clock source */

#define STM32_RCC_D2CCIP1R_FDCANSEL RCC_D2CCIP1R_FDCANSEL_HSE /* FDCAN 1 2 clock source */

Expand Down
2 changes: 1 addition & 1 deletion boards/spracing/h7extreme/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@

/* ADC 1 2 3 clock source */

#define STM32_RCC_D3CCIPR_ADCSEL RCC_D3CCIPR_ADCSEL_PLL2
#define STM32_RCC_D3CCIPR_ADCSRC RCC_D3CCIPR_ADCSEL_PLL2

/* QSPI clock source */
#define STM32_RCC_D1CCIPR_QSPISEL RCC_D1CCIPR_QSPISEL_PLL2
Expand Down
4 changes: 2 additions & 2 deletions boards/spracing/h7extreme/src/rcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ __ramfunc__ void stm32_board_clockconfig(void)

/* Configure ADC source clock */

#if defined(STM32_RCC_D3CCIPR_ADCSEL)
#if defined(STM32_RCC_D3CCIPR_ADCSRC)
regval = getreg32(STM32_RCC_D3CCIPR);
regval &= ~RCC_D3CCIPR_ADCSEL_MASK;
regval |= STM32_RCC_D3CCIPR_ADCSEL;
regval |= STM32_RCC_D3CCIPR_ADCSRC;
putreg32(regval, STM32_RCC_D3CCIPR);
#endif

Expand Down
Loading
Loading