# HG changeset patch # User Ideenmodellierer # Date 1733860855 -3600 # Node ID df87dbfc9c210b385da12b75557ea8d45552fa8a # Parent d461d9e89e3cfc864a752e6c21c96a0786d45401 Update GPIO: Splitted the init function and moved GPS deactivation into the sleep loop (deep sleep) diff -r d461d9e89e3c -r df87dbfc9c21 Small_CPU/Inc/gpio.h --- a/Small_CPU/Inc/gpio.h Tue Dec 10 20:59:37 2024 +0100 +++ b/Small_CPU/Inc/gpio.h Tue Dec 10 21:00:55 2024 +0100 @@ -33,6 +33,7 @@ #define GPS_BCKP_CONTROL_PIN GPIO_PIN_14 /* PortB */ void GPIO_LEDs_VIBRATION_Init(void); +void GPIO_GNSS_Init(); void GPIO_Power_MainCPU_Init(void); void GPIO_Power_MainCPU_ON(void); void GPIO_Power_MainCPU_OFF(void); diff -r d461d9e89e3c -r df87dbfc9c21 Small_CPU/Src/baseCPU2.c --- a/Small_CPU/Src/baseCPU2.c Tue Dec 10 20:59:37 2024 +0100 +++ b/Small_CPU/Src/baseCPU2.c Tue Dec 10 21:00:55 2024 +0100 @@ -147,6 +147,7 @@ #include "uart_Internal.h" #include "uartProtocol_GNSS.h" #include "GNSS.h" +#include "configuration.h" // From Common/Inc: @@ -287,6 +288,7 @@ MX_RTC_init(); GPIO_LEDs_VIBRATION_Init(); + GPIO_GNSS_Init(); GPIO_new_DEBUG_Init(); // added 170322 hw initGlobals(); @@ -506,6 +508,7 @@ if((uartGnss_GetState() == UART_GNSS_INACTIVE) || (time_elapsed_ms(shutdownTick,HAL_GetTick()) > 5000)) { global.mode = MODE_SLEEP; + uartGnss_ReqPowerDown(0); /* release power down request */ } #else global.mode = MODE_SLEEP; @@ -894,7 +897,7 @@ GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pin = GPIO_PIN_All; HAL_GPIO_Init( GPIOH, &GPIO_InitStruct); -#ifdef DEBUGMODE +#ifdef ENABLE_SLEEP_DEBUG GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_3 | GPIO_PIN_8 | GPIO_PIN_9); /* debug */ #endif @@ -907,7 +910,7 @@ HAL_GPIO_Init( GPIOC, &GPIO_InitStruct); GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0 | VIBRATION_CONTROL_PIN | LED_CONTROL_PIN_RED | LED_CONTROL_PIN_GREEN); -#ifdef DEBUGMODE +#ifdef ENABLE_SLEEP_DEBUG GPIO_InitStruct.Pin = GPIO_PIN_All ^ ( GPIO_PIN_0 | GPIO_PIN_13 | GPIO_PIN_14); /* wake up button & debug */ #endif HAL_GPIO_Init( GPIOA, &GPIO_InitStruct); @@ -921,12 +924,14 @@ GPIO_LED_RED_OFF(); GPIO_VIBRATION_OFF(); GPIO_GPS_BCKP_ON(); // mH : costs 100µA in sleep - beware -/* GPIO_GPS_OFF(); will be done in transition slleep => deep sleep */ +/* GPIO_GPS_OFF(); will be done in transition sleep => deep sleep */ MX_USART6_UART_DeInit(); #endif -#ifndef DEBUGMODE +#ifndef ENABLE_SLEEP_DEBUG +/* __HAL_RCC_GPIOB_CLK_DISABLE(); +*/ #endif __HAL_RCC_GPIOH_CLK_DISABLE(); diff -r d461d9e89e3c -r df87dbfc9c21 Small_CPU/Src/gpio.c --- a/Small_CPU/Src/gpio.c Tue Dec 10 20:59:37 2024 +0100 +++ b/Small_CPU/Src/gpio.c Tue Dec 10 21:00:55 2024 +0100 @@ -56,6 +56,11 @@ GPIO_InitStructure.Speed = GPIO_SPEED_LOW; HAL_GPIO_Init( GPIOA, &GPIO_InitStructure); HAL_GPIO_WritePin( GPIOA, VIBRATION_CONTROL_PIN, GPIO_PIN_RESET); +} + +void GPIO_GNSS_Init() +{ + GPIO_InitTypeDef GPIO_InitStructure; __GPIOB_CLK_ENABLE(); GPIO_InitStructure.Pin = GPS_POWER_CONTROL_PIN;