This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 21cc24fedc16455798e8e8892653bb9e4d0950a6
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Wed May 6 08:28:10 2026 +0200

    stm32h5: Add program delay configuration
    
    Flash programming may require delay depending on
    system clock frequency and VDD value
    
    This adds syscfg value that can be configured.
    It is set to maximum value by defaulut
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/mcu/stm/stm32h5xx/src/clock_stm32h5xx.c | 1 +
 hw/mcu/stm/stm32h5xx/syscfg.yml            | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/hw/mcu/stm/stm32h5xx/src/clock_stm32h5xx.c 
b/hw/mcu/stm/stm32h5xx/src/clock_stm32h5xx.c
index 7951e625f..cf1cb52aa 100644
--- a/hw/mcu/stm/stm32h5xx/src/clock_stm32h5xx.c
+++ b/hw/mcu/stm/stm32h5xx/src/clock_stm32h5xx.c
@@ -89,6 +89,7 @@ SystemClock_Config(void)
     BUSY_LOOP(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY));
 
     __HAL_FLASH_SET_LATENCY(MYNEWT_VAL_STM32_FLASH_LATENCY);
+    __HAL_FLASH_SET_PROGRAM_DELAY(MYNEWT_VAL_STM32_FLASH_PROGRAM_DELAY);
 
     if (MYNEWT_VAL_STM32_CLOCK_LSI) {
         LL_RCC_LSI_Enable();
diff --git a/hw/mcu/stm/stm32h5xx/syscfg.yml b/hw/mcu/stm/stm32h5xx/syscfg.yml
index c5293973e..2a647af1b 100644
--- a/hw/mcu/stm/stm32h5xx/syscfg.yml
+++ b/hw/mcu/stm/stm32h5xx/syscfg.yml
@@ -241,6 +241,12 @@ syscfg.defs:
     STM32_FLASH_LATENCY:
         description: Number of wait-states
         value: 0
+    STM32_FLASH_PROGRAM_DELAY:
+        description: >
+            Programmin delay:
+            FLASH_PROGRAMMING_DELAY_0 for system runnig <= 84 MHz
+            FLASH_PROGRAMMING_DELAY_1 for system runnig <= 168 MHz
+        value: FLASH_PROGRAMMING_DELAY_2
 
     STM32_ENABLE_ICACHE:
         description: Enable instruction caching

Reply via email to