targets: correct pin mapping for Arduino UNO Q STM32 MCU

Signed-off-by: deadprogram <ron@hybridgroup.com>

machine/stm32u585: fix PWR peripheral clock was never enabled

On STM32U5, PWR is on AHB3 and requires RCC.AHB3ENR.PWREN -
unlike some other STM32 families where PWR is always clocked.
Without this, all writes to PWR registers (including IO2SV for
VDDIO2) were silently dropped, so GPIOG pins could never drive.

Signed-off-by: deadprogram <ron@hybridgroup.com>

target: correct I2C pin mapping for Arduino UNO Q

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2026-03-17 20:16:03 +01:00
parent 323b62b405
commit 60fb4b95fa
4 changed files with 96 additions and 47 deletions
+4 -1
View File
@@ -236,13 +236,16 @@ func (p Pin) enableClock() {
default:
panic("machine: unknown port")
}
// Dummy read-back to ensure the clock enable takes effect before
// accessing GPIO registers (2 AHB cycle delay per STM32 reference manual).
_ = stm32.RCC.AHB2ENR1.Get()
}
// Enable peripheral clock
func enableAltFuncClock(bus unsafe.Pointer) {
switch bus {
case unsafe.Pointer(stm32.PWR): // Power interface clock enable
// PWR clock is always enabled on U5 (no dedicated enable bit needed)
stm32.RCC.AHB3ENR.SetBits(stm32.RCC_AHB3ENR_PWREN)
case unsafe.Pointer(stm32.I2C1): // I2C1 clock enable
stm32.RCC.APB1ENR1.SetBits(stm32.RCC_APB1ENR1_I2C1EN)
case unsafe.Pointer(stm32.I2C2): // I2C2 clock enable