You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2024/01/04 08:43:53 UTC

(mynewt-core) 01/04: bsp/nucleo-h723zg: Implement hal_bsp_deinit

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

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

commit 6035f8e99a2c386406890d24245d8dd59fafcbaa
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Mon Nov 6 14:42:07 2023 +0100

    bsp/nucleo-h723zg: Implement hal_bsp_deinit
    
    Peripherals enabled in bootloader could cause failure
    during startup of application.
    Now all peripherals are left as they are after reset
    preventing interrupts for timers/uart/spi to fire
    before application enables them again.
    
    Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
 hw/bsp/nucleo-h723zg/src/hal_bsp.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/hw/bsp/nucleo-h723zg/src/hal_bsp.c b/hw/bsp/nucleo-h723zg/src/hal_bsp.c
index 130d3293b..d846fd6f0 100644
--- a/hw/bsp/nucleo-h723zg/src/hal_bsp.c
+++ b/hw/bsp/nucleo-h723zg/src/hal_bsp.c
@@ -253,6 +253,38 @@ hal_bsp_init(void)
 void
 hal_bsp_deinit(void)
 {
+    RCC->AHB1ENR = 0;
+    RCC->AHB2ENR = 0;
+    RCC->AHB3ENR = 0;
+    RCC->AHB4ENR = 0;
+
+    RCC->APB1LENR = 0;
+    RCC->APB1HENR = 0;
+    RCC->APB2ENR = 0;
+    RCC->APB3ENR = 0;
+    RCC->APB4ENR = 0x0001000;
+
+    RCC->AHB1RSTR = 0x06038203;
+    RCC->AHB2RSTR = 0x60030271;
+    RCC->AHB3RSTR = 0x00E95011;
+    RCC->AHB4RSTR = 0x132806FF;
+
+    RCC->APB1LRSTR = 0xEAFFC3FF;
+    RCC->APB1LRSTR = 0x03000136;
+    RCC->APB2RSTR = 0x40A730F3;
+    RCC->APB3RSTR = 0x00000008;
+    RCC->APB4RSTR = 0x0420DEAA;
+
+    RCC->AHB1RSTR = 0;
+    RCC->AHB2RSTR = 0;
+    RCC->AHB3RSTR = 0;
+    RCC->AHB4RSTR = 0;
+
+    RCC->APB1LRSTR = 0;
+    RCC->APB1LRSTR = 0;
+    RCC->APB2RSTR = 0;
+    RCC->APB3RSTR = 0;
+    RCC->APB4RSTR = 0;
 }
 
 /**