From 8fbe703d0b09f0f6d9a58c6beed986955ef4fc8c Mon Sep 17 00:00:00 2001 From: kurte Date: Thu, 22 May 2025 11:06:36 -0700 Subject: [PATCH] PortentaH7 - Stop the blue blink... This was caused by the default sketch running on the M4 core when no other sketch was loaded on the M4. This changes the config to not automatically start the M4 at boot and. It appears like that left the Blue LED on, so added an InitVariant implementation for the PortentaH7 that turns it off. --- .../arduino_portenta_h7_stm32h747xx_m7.conf | 1 + .../arduino_portenta_h7_stm32h747xx_m7/variant.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf index b0d99951..d8242394 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf @@ -95,3 +95,4 @@ CONFIG_VIDEO_BUFFER_POOL_ALIGN=32 CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP=y CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE=2 CONFIG_FLASH=y +CONFIG_STM32H7_BOOT_M4_AT_INIT=n diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp b/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp index 786c9712..20bde355 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp @@ -1,4 +1,5 @@ #include +#include void _on_1200_bps() { uint32_t tmp = (uint32_t) & (RTC->BKP0R); @@ -6,3 +7,14 @@ void _on_1200_bps() { *(__IO uint32_t *)tmp = (uint32_t)0xDF59; NVIC_SystemReset(); } + +void initVariant(void) { + // check the BLUE LED + /* Set led1 inactive since the Arduino bootloader leaves it active */ + const struct gpio_dt_spec led2 = GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios); + if (!gpio_is_ready_dt(&led2)) { + return; + } + + gpio_pin_configure_dt(&led2, GPIO_OUTPUT_INACTIVE); +}