diff --git a/.gitignore b/.gitignore index a220ddd..bdc3590 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,20 @@ *.o *.ko *.obj -*.elf - +*.e1f +*.axf +*.de +*.cyclo +*.list +*.mk +*.settings.xml +*.mk # Linker output *.ilk *.map *.exp +*.list +*.su # Precompiled Headers *.gch @@ -29,25 +37,51 @@ *.so.* *.dylib + # Executables *.exe *.out *.app *.i*86 *.x86_64 +*.dep +*.d +*.o +*.dp +*.lst +*.elf +*.build_log +*.build_log.htm + # Debug files *.dSYM/ *.su *.idb *.pdb +*.dbgconf +*.uvguix.lenovo +*.uvoptx +*.uvprojx +*.build_log.htm +*.htm +*.map +*.lnp +*.sct +*.crf +*.lst + # Kernel Module Compile Results *.mod* *.cmd +*.htm +*.html .tmp_versions/ modules.order Module.symvers Mkfile.old dkms.conf +*.cyclo +*.settings.* diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 062e463..e6bc8fd 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -60,9 +60,10 @@ void MX_GPIO_Init(void) /*Configure GPIO pin Output Level */ +#if 0 HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin |LED3_Pin, GPIO_PIN_RESET); -#if 0 + /*Configure GPIO pins : PBPin PBPin PBPin */ GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; @@ -90,15 +91,15 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(BUT3_GPIO_Port, &GPIO_InitStruct); #endif __HAL_RCC_GPIOB_CLK_ENABLE(); - GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_2; + GPIO_InitStruct.Pin = GPIO_PIN_4; //|GPIO_PIN_2; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - //__HAL_RCC_GPIOB_CLK_DISABLE(); + __HAL_RCC_GPIOB_CLK_DISABLE(); /* EXTI interrupt init*/ - +#if 0 HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI0_IRQn); @@ -107,7 +108,7 @@ void MX_GPIO_Init(void) HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); - +#endif } /* USER CODE BEGIN 2 */ diff --git a/Core/Src/main.c b/Core/Src/main.c index 98c70ec..958bdbc 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -94,7 +94,7 @@ int main(void) /* USER CODE BEGIN 2 */ /* USER CODE END 2 */ -#if 1 +#if 0 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET); /* PME OFF */ #endif /* Infinite loop */ diff --git a/Core/Src/stm32_lpm_if.c b/Core/Src/stm32_lpm_if.c index 348bec2..01913bb 100644 --- a/Core/Src/stm32_lpm_if.c +++ b/Core/Src/stm32_lpm_if.c @@ -78,9 +78,14 @@ const struct UTIL_LPM_Driver_s UTIL_PowerDriver = void PWR_EnterOffMode(void) { /* USER CODE BEGIN EnterOffMode_1 */ -#if 1 +#if 0 //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET); /* LED OFF */ + HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All); + HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All); + HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All); + vcom_DeInit(); HAL_SuspendTick(); + LL_PWR_ClearFlag_C1STOP_C1STB(); LL_PWR_ClearFlag_WU(); HAL_PWR_EnterSTANDBYMode(); #endif @@ -90,7 +95,7 @@ void PWR_EnterOffMode(void) void PWR_ExitOffMode(void) { /* USER CODE BEGIN ExitOffMode_1 */ -#if 1 +#if 0 HAL_ResumeTick(); //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET); /* LED ON */ return; @@ -103,9 +108,12 @@ void PWR_EnterStopMode(void) /* USER CODE BEGIN EnterStopMode_1 */ HAL_UART_DeInit(&huart2); vcom_DeInit(); - HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All); - HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All); - HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All); + //HAL_GPIO_DeInit(GPIOA,GPIO_PIN_All); + //HAL_GPIO_DeInit(GPIOB,GPIO_PIN_All); + //HAL_GPIO_DeInit(GPIOC,GPIO_PIN_All); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET); /* USER CODE END EnterStopMode_1 */ HAL_SuspendTick(); /* Clear Status Flag before entering STOP/STANDBY Mode */ diff --git a/Core/Src/stm32wlxx_it.c b/Core/Src/stm32wlxx_it.c index 66231ac..61954c5 100644 --- a/Core/Src/stm32wlxx_it.c +++ b/Core/Src/stm32wlxx_it.c @@ -213,7 +213,7 @@ void TAMP_STAMP_LSECSS_SSRU_IRQHandler(void) /* USER CODE END TAMP_STAMP_LSECSS_SSRU_IRQn 1 */ } - +#if 0 /** * @brief This function handles EXTI Line 0 Interrupt. */ @@ -283,7 +283,7 @@ void USART2_IRQHandler(void) /* USER CODE END USART2_IRQn 1 */ } - +#endif /** * @brief This function handles RTC Alarms (A and B) Interrupt. */ diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index b24c035..5d5daa0 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -290,7 +290,7 @@ static LmHandlerParams_t LmHandlerParams = /** * @brief Type of Event to generate application Tx */ -static TxEventType_t EventType = TX_ON_TIMER; +static TxEventType_t EventType = TX_ON_TIMER; //TX_ON_EVENT; /** * @brief Timer to handle the application Tx @@ -557,8 +557,8 @@ static void SendTxData(void) sensor_t sensor_data; UTIL_TIMER_Time_t nextTxIn = 0; //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET); /* PME OFF */ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET); /* PME ON */ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET); /* LED ON */ + //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_SET); /* PME ON */ + //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET); /* LED ON */ if (LmHandlerIsBusy() == false) { #ifdef CAYENNE_LPP @@ -664,8 +664,8 @@ static void SendTxData(void) UTIL_TIMER_SetPeriod(&TxTimer, MAX(nextTxIn, TxPeriodicity)); UTIL_TIMER_Start(&TxTimer); } - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET); /* LED OFF */ - HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET); /* PME OFF */ + //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET); /* LED OFF */ + //HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET); /* PME OFF */ /* USER CODE END SendTxData_1 */ } @@ -674,8 +674,11 @@ static void OnTxTimerEvent(void *context) /* USER CODE BEGIN OnTxTimerEvent_1 */ /* USER CODE END OnTxTimerEvent_1 */ + __HAL_RCC_GPIOB_CLK_ENABLE(); + HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_SET); UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0); - + HAL_Delay(3000); + HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_RESET); /*Wait for next tx slot*/ UTIL_TIMER_Start(&TxTimer); /* USER CODE BEGIN OnTxTimerEvent_2 */ diff --git a/LoRaWAN/App/lora_app.h b/LoRaWAN/App/lora_app.h index d3c7175..b6741f3 100644 --- a/LoRaWAN/App/lora_app.h +++ b/LoRaWAN/App/lora_app.h @@ -51,7 +51,7 @@ extern "C" { /*! * Defines the application data transmission duty cycle. 10s, value in [ms]. */ -#define APP_TX_DUTYCYCLE 30000 +#define APP_TX_DUTYCYCLE 120000 /*! * LoRaWAN User application port diff --git a/README.md b/README.md index 69fde76..8acb46f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # STS_E5CC -E5CC port from STM32WL55JCIX \ No newline at end of file +E5CC port from STM32WL55JCIX + +2024-07-02 start of low power on CR2450 + + +end diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index c779788..de781fb 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -23,7 +23,7 @@