Skip to content

arch/arm/stm32f4: add STM32F412VG and STM32F412CG chip selections - #20006

Open
dakejahl wants to merge 2 commits into
apache:masterfrom
dakejahl:dakejahl/stm32f412vg
Open

arch/arm/stm32f4: add STM32F412VG and STM32F412CG chip selections#20006
dakejahl wants to merge 2 commits into
apache:masterfrom
dakejahl:dakejahl/stm32f412vg

Conversation

@dakejahl

@dakejahl dakejahl commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds ARCH_CHIP_STM32F412VG (LQFP100/UFBGA100, 1 MB) and ARCH_CHIP_STM32F412CG (UFQFPN48, 1 MB) to the STM32 chip choice, and corrects the adjacent F412 CE and ZG entries in chip.h found while adding them.

The choice previously listed only F412CE (UFQFPN48, 512 KB) and F412ZG (LQFP144, 1 MB), so parts such as STM32F412VGH6 and STM32F412CGU6 had to select CE. CE also advertised an FSMC the 48-pin package does not bond, omitted TIM6/7 and TIM9-14 that the die has, and used STM32_NGPIO 34, which left GPIOH — the PH0/PH1 oscillator pins, usable as GPIO — outside STM32_NGPIO_PORTS. ZG claimed six USARTs while listing four. Per DS11139 Rev 9 Table 2 every F412 package has 2 advanced, 10 general-purpose and 2 basic timers, 5 SPI/I2S and 4 USARTs; the FSMC is bonded only on the 100- and 144-pin packages.

VG takes STM32_NGPIO 113 rather than its real 81 I/Os because STM32_NGPIO_PORTS is (N + 15) >> 4, and 81 yields six ports, A-F, dropping GPIOH. ZG already does this. CG shares the CE block, which is identical apart from flash size. The family HAVE_* list gains SPI4/5 and TIM6/7/10/11, and HAVE_FSMC moves onto the VG and ZG entries.

Impact

  • New feature: YES, two new chip selections.
  • Impact on user: YES, for F412CE boards only. g_gpiobase[] is now sized for eight ports and GPIOD-H are clocked. That is the point of the change: configuring a PH pin on CE previously indexed a three-entry array out of bounds. PX4's ARK CANnode has that pin disabled in board code with the reason written out ("Port H = 7 which is greater than STM32_NPORTS").
  • Impact on build: NO.
  • Impact on hardware: NO.
  • Impact on documentation: NO.
  • Impact on security: NO.
  • Impact on compatibility: NO.

Testing

Built out of tree in PX4, which carries this change as PX4/NuttX#399, with arm-none-eabi-gcc 13.2.1 on Linux:

ark_mag_default      (STM32F412VGH6)  image 312868 B
ark_cannode_default  (STM32F412CGU6)  image 584388 B

No on-hardware run yet.

@dakejahl
dakejahl requested a review from raiden00pl as a code owner August 29, 2026 20:04
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small labels Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

dakejahl added a commit to PX4/PX4-Autopilot that referenced this pull request Aug 29, 2026
PX4/NuttX#399 now matches apache/nuttx#20006 on FSMC, timers,
USART, I2S, and CE GPIOH.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
dakejahl added a commit to PX4/NuttX that referenced this pull request Aug 29, 2026
SPI4/5 and TIM6/7/10/11 are on the F412 die in every package (DS11139).
FSMC is only bonded on 100/144-pin, so HAVE_FSMC is selected on VG/ZG
and not on CE.

Backport of apache/nuttx#20006.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
@dakejahl dakejahl changed the title arch/arm/stm32f4: add STM32F412VG chip selection arch/arm/stm32f4: add STM32F412VG and STM32F412CG chip selections Aug 29, 2026
Comment thread arch/arm/include/stm32f4/chip.h
@dakejahl
dakejahl force-pushed the dakejahl/stm32f412vg branch 2 times, most recently from 19dce65 to 79eb859 Compare August 30, 2026 21:01
100-pin 1MB F412 (LQFP/UFBGA). Without this, boards using
STM32F412VGH6 have to select the 48-pin 512KB CE.

STM32_NGPIO is 113 rather than the real 81 I/Os because
STM32_NGPIO_PORTS is (N+15)>>4 and 81 yields six ports A-F, so
PH0/PH1 could not be configured. 113 matches ZG and gives A-H.

CE/ZG chip.h counts and the family HAVE_* list are corrected in
the same change: CE has no FSMC, the die has TIM6/7/9-14 and
SPI4/5, ZG USART is 4, I2S is 5. FSMC is only bonded on 100/144-pin,
so HAVE_FSMC is selected on VG/ZG and not on CE.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
48-pin 1MB F412. CE was the only 48-pin part listed, so boards using
STM32F412CGU6 had to select a 512KB chip. Feature counts are identical
to CE, so it shares the block.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
@dakejahl
dakejahl force-pushed the dakejahl/stm32f412vg branch from 79eb859 to 0359873 Compare August 31, 2026 00:53
dakejahl added a commit to PX4/NuttX that referenced this pull request Aug 31, 2026
100-pin 1MB F412 (LQFP/UFBGA). Without this, boards using
STM32F412VGH6 have to select the 48-pin 512KB CE.

STM32_NGPIO is 113 rather than the real 81 I/Os because
STM32_NGPIO_PORTS is (N+15)>>4 and 81 yields six ports A-F, so
PH0/PH1 could not be configured. 113 matches ZG and gives A-H.

CE/ZG chip.h counts and the family HAVE_* list are corrected in
the same change: CE has no FSMC, the die has TIM6/7/9-14 and
SPI4/5, ZG USART is 4, I2S is 5. FSMC is only bonded on 100/144-pin,
so HAVE_FSMC is selected on VG/ZG and not on CE.

Backport of apache/nuttx#20006.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
dakejahl added a commit to PX4/NuttX that referenced this pull request Aug 31, 2026
48-pin 1MB F412. CE was the only 48-pin part listed, so boards using
STM32F412CGU6 had to select a 512KB chip. Feature counts are identical
to CE, so it shares the block.

Backport of apache/nuttx#20006.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants