From 82593bd404066c4cd1366ed03209d1845a91315f Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 23 Oct 2023 18:12:31 +0200 Subject: [PATCH] stm32/gpio: make port G work on U5. --- ci.sh | 4 ++-- embassy-stm32/src/gpio.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ci.sh b/ci.sh index ffd36a455..eac4d3711 100755 --- a/ci.sh +++ b/ci.sh @@ -221,8 +221,8 @@ rm out/tests/stm32wb55rg/wpan_ble # unstable, I think it's running out of RAM? rm out/tests/stm32f207zg/eth -# doesn't work. Wire in D0-D1 might be bad, or the special IOVDD2 PGx pins. -rm out/tests/stm32u5a5zj/{gpio,usart*} +# doesn't work, gives "noise error", no idea why. usart_dma does pass. +rm out/tests/stm32u5a5zj/usart if [[ -z "${TELEPROBE_TOKEN-}" ]]; then echo No teleprobe token found, skipping running HIL tests diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index e1702b008..011f4c07a 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs @@ -763,6 +763,13 @@ pub(crate) unsafe fn init(_cs: CriticalSection) { ::enable_and_reset_with_cs(_cs); crate::_generated::init_gpio(); + + // Setting this bit is mandatory to use PG[15:2]. + #[cfg(stm32u5)] + crate::pac::PWR.svmcr().modify(|w| { + w.set_io2sv(true); + w.set_io2vmen(true); + }); } mod eh02 {