code for wakup and stuff, without ll_RTC

This commit is contained in:
Cameron Bray 2020-11-18 10:15:15 +01:00
parent 5e223eb8f3
commit 4dbed67e74
21 changed files with 1807 additions and 1311 deletions

View file

@ -938,3 +938,11 @@
2020-11-17 08:14:50,700 [INFO] Activator:179 - !SESSION log4j initialized
2020-11-17 22:25:06,507 [INFO] Activator:178 -
2020-11-17 22:25:06,510 [INFO] Activator:179 - !SESSION log4j initialized
2020-11-18 09:40:28,010 [INFO] Activator:178 -
2020-11-18 09:40:28,013 [INFO] Activator:179 - !SESSION log4j initialized

View file

@ -613,3 +613,33 @@ Reason: (4) No device found on target.
!SUBENTRY 2 com.st.stm32cube.ide.mcu.debug.stlink 4 0 2020-11-17 10:28:24.145
!MESSAGE Error in initializing ST-LINK device.
Reason: (4) No device found on target.
!SESSION 2020-11-17 22:24:56.029 -----------------------------------------------
eclipse.buildId=Version 1.4.0
java.version=1.8.0_252
java.vendor=AdoptOpenJDK
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Command-line arguments: -os win32 -ws win32 -arch x86_64
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 1 1 2020-11-17 22:25:06.499
!MESSAGE Log4j initialized with config file C:\Users\camer\Desktop\LoPoSo\PlaygroundYoupi\.metadata\.log4j.xml
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2020-11-17 22:25:13.904
!MESSAGE Started RMI Server, listening on port 41337
!ENTRY com.st.stm32cube.ide.mcu.ide 4 4 2020-11-17 22:25:14.505
!MESSAGE com.st.stm32cube.ide.mcu.ide/META-INF/version/build_ref file not found, build reference will not be reported into properties
!SESSION 2020-11-18 09:40:17.619 -----------------------------------------------
eclipse.buildId=Version 1.4.0
java.version=1.8.0_252
java.vendor=AdoptOpenJDK
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB
Command-line arguments: -os win32 -ws win32 -arch x86_64
!ENTRY com.st.stm32cube.ide.mcu.informationcenter 1 1 2020-11-18 09:40:28.003
!MESSAGE Log4j initialized with config file C:\Users\camer\Desktop\LoPoSo\PlaygroundYoupi\.metadata\.log4j.xml
!ENTRY com.st.stm32cube.ide.mcu.ide 1 1 2020-11-18 09:40:34.497
!MESSAGE Started RMI Server, listening on port 41337
!ENTRY com.st.stm32cube.ide.mcu.ide 4 4 2020-11-18 09:40:35.090
!MESSAGE com.st.stm32cube.ide.mcu.ide/META-INF/version/build_ref file not found, build reference will not be reported into properties

View file

@ -1,3 +1,4 @@
*** SESSION Nov 05, 2020 10:46:36.34 -------------------------------------------
*** SESSION Nov 16, 2020 08:11:47.28 -------------------------------------------
*** SESSION Nov 17, 2020 08:14:51.13 -------------------------------------------
*** SESSION Nov 17, 2020 22:25:06.93 -------------------------------------------

View file

@ -1,10 +1,78 @@
10:38:01 **** Incremental Build of configuration Debug for project RealOne ****
10:00:06 **** Build of configuration Debug for project RealOne ****
make -j8 all
arm-none-eabi-size RealOne.elf
text data bss dec hex filename
3988 20 1572 5580 15cc RealOne.elf
Finished building: default.size.stdout
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 '-DHSE_VALUE=8000000' '-DMSI_VALUE=4000000' '-DLSI_VALUE=32000' '-DHSE_STARTUP_TIMEOUT=100' '-DHSI_VALUE=16000000' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DDATA_CACHE_ENABLE=1' -DUSE_HAL_DRIVER '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNALSAI2_CLOCK_VALUE=2097000' -DSTM32L476xx -DUSE_FULL_LL_DRIVER '-DEXTERNALSAI1_CLOCK_VALUE=2097000' '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:183:0: warning: "VDD_VALUE" redefined
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:186:0: warning: "PREFETCH_ENABLE" redefined
#define PREFETCH_ENABLE 0U
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:187:0: warning: "INSTRUCTION_CACHE_ENABLE" redefined
#define INSTRUCTION_CACHE_ENABLE 1U
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:188:0: warning: "DATA_CACHE_ENABLE" redefined
#define DATA_CACHE_ENABLE 1U
<command-line>:0:0: note: this is the location of the previous definition
../Core/Src/main.c: In function 'RTC_wakeup_init':
../Core/Src/main.c:297:1: warning: implicit declaration of function 'LL_RTC_DisableWriteProtection'; did you mean 'LL_PWR_DisableSRAM2Retention'? [-Wimplicit-function-declaration]
LL_RTC_DisableWriteProtection( RTC );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_DisableSRAM2Retention
../Core/Src/main.c:298:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_Disable'; did you mean 'LL_RCC_LSE_Disable'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_Disable( RTC );
^~~~~~~~~~~~~~~~~~~~~
LL_RCC_LSE_Disable
../Core/Src/main.c:299:10: warning: implicit declaration of function 'LL_RTC_IsActiveFlag_WUTW'; did you mean 'LL_PWR_IsActiveFlag_WU1'? [-Wimplicit-function-declaration]
while ( !LL_RTC_IsActiveFlag_WUTW( RTC ) )
^~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_IsActiveFlag_WU1
../Core/Src/main.c:302:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_SetClock'; did you mean 'IS_RTC_WAKEUP_CLOCK'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_SetClock( RTC, LL_RTC_WAKEUPCLOCK_CKSPRE );
^~~~~~~~~~~~~~~~~~~~~~
IS_RTC_WAKEUP_CLOCK
../Core/Src/main.c:302:30: error: 'LL_RTC_WAKEUPCLOCK_CKSPRE' undeclared (first use in this function); did you mean 'IS_RTC_WAKEUP_CLOCK'?
LL_RTC_WAKEUP_SetClock( RTC, LL_RTC_WAKEUPCLOCK_CKSPRE );
^~~~~~~~~~~~~~~~~~~~~~~~~
IS_RTC_WAKEUP_CLOCK
../Core/Src/main.c:302:30: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/main.c:304:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_SetAutoReload'; did you mean '__HAL_TIM_SetAutoreload'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_SetAutoReload( RTC, delay ); // 16 bits
^~~~~~~~~~~~~~~~~~~~~~~~~~~
__HAL_TIM_SetAutoreload
../Core/Src/main.c:305:1: warning: implicit declaration of function 'LL_RTC_ClearFlag_WUT'; did you mean 'LL_PWR_ClearFlag_WU1'? [-Wimplicit-function-declaration]
LL_RTC_ClearFlag_WUT(RTC);
^~~~~~~~~~~~~~~~~~~~
LL_PWR_ClearFlag_WU1
../Core/Src/main.c:306:1: warning: implicit declaration of function 'LL_RTC_EnableIT_WUT'; did you mean 'LL_DMA_EnableIT_HT'? [-Wimplicit-function-declaration]
LL_RTC_EnableIT_WUT(RTC);
^~~~~~~~~~~~~~~~~~~
LL_DMA_EnableIT_HT
../Core/Src/main.c:307:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_Enable'; did you mean 'LL_RCC_LSE_Enable'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_Enable(RTC);
^~~~~~~~~~~~~~~~~~~~
LL_RCC_LSE_Enable
../Core/Src/main.c:308:1: warning: implicit declaration of function 'LL_RTC_EnableWriteProtection'; did you mean 'LL_PWR_EnableSRAM2Retention'? [-Wimplicit-function-declaration]
LL_RTC_EnableWriteProtection(RTC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_EnableSRAM2Retention
make: *** [Core/Src/subdir.mk:38: Core/Src/main.o] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
10:38:01 Build Finished. 0 errors, 0 warnings. (took 315ms)
10:00:08 Build Failed. 2 errors, 13 warnings. (took 2s.138ms)

View file

@ -765,3 +765,78 @@ arm-none-eabi-size RealOne.elf
3988 20 1572 5580 15cc RealOne.elf
Finished building: default.size.stdout
10:00:06 **** Build of configuration Debug for project RealOne ****
make -j8 all
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 '-DHSE_VALUE=8000000' '-DMSI_VALUE=4000000' '-DLSI_VALUE=32000' '-DHSE_STARTUP_TIMEOUT=100' '-DHSI_VALUE=16000000' -DDEBUG '-DLSE_STARTUP_TIMEOUT=5000' '-DLSE_VALUE=32768' '-DDATA_CACHE_ENABLE=1' -DUSE_HAL_DRIVER '-DVDD_VALUE=3300' '-DINSTRUCTION_CACHE_ENABLE=1' '-DEXTERNALSAI2_CLOCK_VALUE=2097000' -DSTM32L476xx -DUSE_FULL_LL_DRIVER '-DEXTERNALSAI1_CLOCK_VALUE=2097000' '-DPREFETCH_ENABLE=0' -c -I../Core/Inc -I../Drivers/STM32L4xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32L4xx/Include -I../Drivers/CMSIS/Include -I../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:183:0: warning: "VDD_VALUE" redefined
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:186:0: warning: "PREFETCH_ENABLE" redefined
#define PREFETCH_ENABLE 0U
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:187:0: warning: "INSTRUCTION_CACHE_ENABLE" redefined
#define INSTRUCTION_CACHE_ENABLE 1U
<command-line>:0:0: note: this is the location of the previous definition
In file included from ../Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h:30:0,
from ../Core/Inc/main.h:31,
from ../Core/Src/main.c:8:
../Core/Inc/stm32l4xx_hal_conf.h:188:0: warning: "DATA_CACHE_ENABLE" redefined
#define DATA_CACHE_ENABLE 1U
<command-line>:0:0: note: this is the location of the previous definition
../Core/Src/main.c: In function 'RTC_wakeup_init':
../Core/Src/main.c:297:1: warning: implicit declaration of function 'LL_RTC_DisableWriteProtection'; did you mean 'LL_PWR_DisableSRAM2Retention'? [-Wimplicit-function-declaration]
LL_RTC_DisableWriteProtection( RTC );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_DisableSRAM2Retention
../Core/Src/main.c:298:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_Disable'; did you mean 'LL_RCC_LSE_Disable'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_Disable( RTC );
^~~~~~~~~~~~~~~~~~~~~
LL_RCC_LSE_Disable
../Core/Src/main.c:299:10: warning: implicit declaration of function 'LL_RTC_IsActiveFlag_WUTW'; did you mean 'LL_PWR_IsActiveFlag_WU1'? [-Wimplicit-function-declaration]
while ( !LL_RTC_IsActiveFlag_WUTW( RTC ) )
^~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_IsActiveFlag_WU1
../Core/Src/main.c:302:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_SetClock'; did you mean 'IS_RTC_WAKEUP_CLOCK'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_SetClock( RTC, LL_RTC_WAKEUPCLOCK_CKSPRE );
^~~~~~~~~~~~~~~~~~~~~~
IS_RTC_WAKEUP_CLOCK
../Core/Src/main.c:302:30: error: 'LL_RTC_WAKEUPCLOCK_CKSPRE' undeclared (first use in this function); did you mean 'IS_RTC_WAKEUP_CLOCK'?
LL_RTC_WAKEUP_SetClock( RTC, LL_RTC_WAKEUPCLOCK_CKSPRE );
^~~~~~~~~~~~~~~~~~~~~~~~~
IS_RTC_WAKEUP_CLOCK
../Core/Src/main.c:302:30: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/main.c:304:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_SetAutoReload'; did you mean '__HAL_TIM_SetAutoreload'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_SetAutoReload( RTC, delay ); // 16 bits
^~~~~~~~~~~~~~~~~~~~~~~~~~~
__HAL_TIM_SetAutoreload
../Core/Src/main.c:305:1: warning: implicit declaration of function 'LL_RTC_ClearFlag_WUT'; did you mean 'LL_PWR_ClearFlag_WU1'? [-Wimplicit-function-declaration]
LL_RTC_ClearFlag_WUT(RTC);
^~~~~~~~~~~~~~~~~~~~
LL_PWR_ClearFlag_WU1
../Core/Src/main.c:306:1: warning: implicit declaration of function 'LL_RTC_EnableIT_WUT'; did you mean 'LL_DMA_EnableIT_HT'? [-Wimplicit-function-declaration]
LL_RTC_EnableIT_WUT(RTC);
^~~~~~~~~~~~~~~~~~~
LL_DMA_EnableIT_HT
../Core/Src/main.c:307:1: warning: implicit declaration of function 'LL_RTC_WAKEUP_Enable'; did you mean 'LL_RCC_LSE_Enable'? [-Wimplicit-function-declaration]
LL_RTC_WAKEUP_Enable(RTC);
^~~~~~~~~~~~~~~~~~~~
LL_RCC_LSE_Enable
../Core/Src/main.c:308:1: warning: implicit declaration of function 'LL_RTC_EnableWriteProtection'; did you mean 'LL_PWR_EnableSRAM2Retention'? [-Wimplicit-function-declaration]
LL_RTC_EnableWriteProtection(RTC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
LL_PWR_EnableSRAM2Retention
make: *** [Core/Src/subdir.mk:38: Core/Src/main.o] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.

View file

@ -0,0 +1,292 @@
/* Project L476_ats_blink for STM32L476 mounted on Nucleo board:
* the user LED (mounted on pin PA-5) is flashed every second for 50 ms.
* The time base is provided by Systick (1000 ticks per second).
* The clock configuration is the default one (Sysclk = 80 MHz, derived from MSI and PLL).
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
// #if defined(USE_FULL_ASSERT)
// #include "stm32_assert.h"
// #endif /* USE_FULL_ASSERT */
#include "gpio.h"
// systick interrupt handler
volatile uint32_t msTicks = 0;
volatile uint8_t expe = 0;
volatile uint8_t blue_mode = 0;
void SysTick_Handler()
{
if ( BLUE_BUTTON() ){
blue_mode = 1 ;
}
msTicks++; /* See startup file startup_LPC17xx.s for SysTick vector */
if (msTicks == 5 * expe){
LED_GREEN(0);
}else if(msTicks >= 200){
msTicks = 0;
LED_GREEN(1);
}
if(expe == 2 || expe == 4){
CLK_TOGGLE();
}
}
int main(void)
{
// config GPIO
GPIO_init();
// if (RCC->BDCR & RCC_BDCR_LSEON) {
LL_APB1_GRP1_EnableClock( LL_APB1_GRP1_PERIPH_PWR );
LL_PWR_EnableBkUpAccess();
//expe = register RTC
expe = RTC->BKP0R;
if (expe == 0) {
SystemClock_Config_24M_LSE();
expe = 1;
LL_APB1_GRP1_EnableClock( LL_APB1_GRP1_PERIPH_PWR );
LL_PWR_EnableBkUpAccess();
RTC->BKP0R = expe;
}
if (BLUE_BUTTON()){
expe ++;
if (expe > 4) expe = 1;
RTC->BKP0R = expe;
}
// }else{
// }
LL_PWR_DisableBkUpAccess();
switch(expe){
case 1:
/* Configure the system clock */
SystemClock_Config_80M();
break;
case 2:
/* Configure the system clock */
SystemClock_Config_24M_LSE();
break;
default: //case 3 to 8
SystemClock_Config_24M_LSE_FL3_VS2();
break;
}
// init systick timer (tick period at 1 ms)
LL_Init1msTick( SystemCoreClock );
LL_SYSTICK_EnableIT();
//Setup Sleep mode
LL_LPM_EnableSleep();
//LL_LPM_EnableSleepOnExit();
while (1) {
if (blue_mode){
switch(expe){
case 1:
case 3:
__WFI();
break;
case 2:
case 4:
LL_RCC_MSI_EnablePLLMode();
break;
}
}
}
}
void SystemClock_Config_24M_LSE_FL3_VS2(void){
LL_APB1_GRP1_EnableClock( LL_APB1_GRP1_PERIPH_PWR );
LL_FLASH_SetLatency(LL_FLASH_LATENCY_3);
while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_3)
{
}
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE2);
LL_RCC_MSI_Enable();
/* Wait till MSI is ready */
while(LL_RCC_MSI_IsReady() != 1)
{
}
LL_PWR_EnableBkUpAccess();
// LL_RCC_ForceBackupDomainReset();
LL_RCC_ReleaseBackupDomainReset();
LL_RCC_LSE_SetDriveCapability(LL_RCC_LSEDRIVE_LOW);
LL_RCC_MSI_EnableRangeSelection();
LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_6);
LL_RCC_MSI_SetCalibTrimming(0);
// LL_RCC_MSI_EnablePLLMode();
LL_RCC_LSE_Enable();
/* Wait till LSE is ready */
while(LL_RCC_LSE_IsReady() != 1)
{
}
LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE);
LL_RCC_EnableRTC();
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 24, LL_RCC_PLLR_DIV_4);
LL_RCC_PLL_EnableDomain_SYS();
LL_RCC_PLL_Enable();
/* Wait till PLL is ready */
while(LL_RCC_PLL_IsReady() != 1)
{
}
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
/* Wait till System clock is ready */
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
{
}
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
LL_SetSystemCoreClock(24000000);
/* Update the time base */
if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK)
{
// Error_Handler();
}
}
/**
* @brief System Clock Configuration
* @retval None
* 24Mhz + RTC + LSE
*/
void SystemClock_Config_24M_LSE(void)
{
LL_APB1_GRP1_EnableClock( LL_APB1_GRP1_PERIPH_PWR );
LL_FLASH_SetLatency(LL_FLASH_LATENCY_1);
while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_1)
{
}
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
LL_RCC_MSI_Enable();
/* Wait till MSI is ready */
while(LL_RCC_MSI_IsReady() != 1)
{
}
LL_PWR_EnableBkUpAccess();
// LL_RCC_ForceBackupDomainReset();
LL_RCC_ReleaseBackupDomainReset();
LL_RCC_LSE_SetDriveCapability(LL_RCC_LSEDRIVE_LOW);
LL_RCC_MSI_EnableRangeSelection();
LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_6);
LL_RCC_MSI_SetCalibTrimming(0);
// LL_RCC_MSI_EnablePLLMode();
LL_RCC_LSE_Enable();
/* Wait till LSE is ready */
while(LL_RCC_LSE_IsReady() != 1)
{
}
LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE);
LL_RCC_EnableRTC();
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 24, LL_RCC_PLLR_DIV_4);
LL_RCC_PLL_EnableDomain_SYS();
LL_RCC_PLL_Enable();
/* Wait till PLL is ready */
while(LL_RCC_PLL_IsReady() != 1)
{
}
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
/* Wait till System clock is ready */
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
{
}
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
LL_SetSystemCoreClock(24000000);
/* Update the time base */
if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK)
{
// Error_Handler();
}
}
void SystemClock_Config_80M(void)
{
LL_FLASH_SetLatency(LL_FLASH_LATENCY_4);
while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_4)
{
}
LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
LL_RCC_MSI_Enable();
/* Wait till MSI is ready */
while(LL_RCC_MSI_IsReady() != 1)
{
}
LL_RCC_MSI_EnableRangeSelection();
LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_6);
LL_RCC_MSI_SetCalibTrimming(0);
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_MSI, LL_RCC_PLLM_DIV_1, 40, LL_RCC_PLLR_DIV_2);
LL_RCC_PLL_EnableDomain_SYS();
LL_RCC_PLL_Enable();
/* Wait till PLL is ready */
while(LL_RCC_PLL_IsReady() != 1)
{
}
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
/* Wait till System clock is ready */
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
{
}
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
LL_SetSystemCoreClock(80000000);
/* Update the time base */
if (HAL_InitTick (TICK_INT_PRIORITY) != HAL_OK)
{
// Error_Handler();
}
}

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,3 @@
#Tue Nov 17 08:14:44 CET 2020
#Wed Nov 18 09:40:21 CET 2020
org.eclipse.core.runtime=2
org.eclipse.platform=4.13.0.v20190916-1045

View file

@ -290,3 +290,50 @@ void SystemClock_Config_80M(void)
// Error_Handler();
}
}
// partie commune a toutes les utilisations du wakeup timer
static void RTC_wakeup_init( int delay )
{
LL_RTC_DisableWriteProtection( RTC );
LL_RTC_WAKEUP_Disable( RTC );
while ( !LL_RTC_IsActiveFlag_WUTW( RTC ) )
{ }
// connecter le timer a l'horloge 1Hz de la RTC
LL_RTC_WAKEUP_SetClock( RTC, LL_RTC_WAKEUPCLOCK_CKSPRE );
// fixer la duree de temporisation
LL_RTC_WAKEUP_SetAutoReload( RTC, delay ); // 16 bits
LL_RTC_ClearFlag_WUT(RTC);
LL_RTC_EnableIT_WUT(RTC);
LL_RTC_WAKEUP_Enable(RTC);
LL_RTC_EnableWriteProtection(RTC);
}
// Dans le cas des modes STANDBY et SHUTDOWN, le MPU sera reveille par reset
// causé par 1 wakeup line (interne ou externe) (le NVIC n'est plus alimenté)
void RTC_wakeup_init_from_standby_or_shutdown( int delay )
{
RTC_wakeup_init( delay );
// enable the Internal Wake-up line
LL_PWR_EnableInternWU(); // ceci ne concerne que Standby et Shutdown, pas STOPx
}
// Dans le cas des modes STOPx, le MPU sera reveille par interruption
// le module EXTI et une partie du NVIC sont encore alimentes
// le contenu de la RAM et des registres étant préservé, le MPU
// reprend l'execution après l'instruction WFI
void RTC_wakeup_init_from_stop( int delay )
{
RTC_wakeup_init( delay );
// valider l'interrupt par la ligne 20 du module EXTI, qui est réservée au wakeup timer
LL_EXTI_EnableIT_0_31( LL_EXTI_LINE_20 );
LL_EXTI_EnableRisingTrig_0_31( LL_EXTI_LINE_20 );
// valider l'interrupt chez NVIC
NVIC_SetPriority( RTC_WKUP_IRQn, 1 );
NVIC_EnableIRQ( RTC_WKUP_IRQn );
}
// wakeup timer interrupt Handler (inutile mais doit etre defini)
void RTC_WKUP_IRQHandler()
{
LL_EXTI_ClearFlag_0_31( LL_EXTI_LINE_20 );
}

View file

@ -1,34 +0,0 @@
stm32l4xx_ll_rcc.h:2270:22:LL_RCC_LSE_Enable 4 static
stm32l4xx_ll_rcc.h:2316:22:LL_RCC_LSE_SetDriveCapability 16 static
stm32l4xx_ll_rcc.h:2362:26:LL_RCC_LSE_IsReady 4 static
stm32l4xx_ll_rcc.h:2489:22:LL_RCC_MSI_Enable 4 static
stm32l4xx_ll_rcc.h:2509:26:LL_RCC_MSI_IsReady 4 static
stm32l4xx_ll_rcc.h:2523:22:LL_RCC_MSI_EnablePLLMode 4 static
stm32l4xx_ll_rcc.h:2548:22:LL_RCC_MSI_EnableRangeSelection 4 static
stm32l4xx_ll_rcc.h:2581:22:LL_RCC_MSI_SetRange 16 static
stm32l4xx_ll_rcc.h:2656:22:LL_RCC_MSI_SetCalibTrimming 16 static
stm32l4xx_ll_rcc.h:2742:22:LL_RCC_SetSysClkSource 16 static
stm32l4xx_ll_rcc.h:2756:26:LL_RCC_GetSysClkSource 4 static
stm32l4xx_ll_rcc.h:2776:22:LL_RCC_SetAHBPrescaler 16 static
stm32l4xx_ll_rcc.h:2792:22:LL_RCC_SetAPB1Prescaler 16 static
stm32l4xx_ll_rcc.h:2808:22:LL_RCC_SetAPB2Prescaler 16 static
stm32l4xx_ll_rcc.h:3650:22:LL_RCC_SetRTCClockSource 16 static
stm32l4xx_ll_rcc.h:3674:22:LL_RCC_EnableRTC 4 static
stm32l4xx_ll_rcc.h:3714:22:LL_RCC_ReleaseBackupDomainReset 4 static
stm32l4xx_ll_rcc.h:3733:22:LL_RCC_PLL_Enable 4 static
stm32l4xx_ll_rcc.h:3754:26:LL_RCC_PLL_IsReady 4 static
stm32l4xx_ll_rcc.h:3800:22:LL_RCC_PLL_ConfigDomain_SYS 24 static
stm32l4xx_ll_rcc.h:4178:22:LL_RCC_PLL_EnableDomain_SYS 4 static
stm32l4xx_ll_bus.h:1089:22:LL_APB1_GRP1_EnableClock 24 static
stm32l4xx_ll_system.h:1400:22:LL_FLASH_SetLatency 16 static
stm32l4xx_ll_system.h:1428:26:LL_FLASH_GetLatency 4 static
stm32l4xx_ll_cortex.h:272:22:LL_SYSTICK_EnableIT 4 static
stm32l4xx_ll_cortex.h:310:22:LL_LPM_EnableSleep 4 static
stm32l4xx_ll_pwr.h:344:22:LL_PWR_SetRegulVoltageScaling 16 static
stm32l4xx_ll_pwr.h:398:22:LL_PWR_EnableBkUpAccess 4 static
stm32l4xx_ll_pwr.h:408:22:LL_PWR_DisableBkUpAccess 4 static
main.c:20:6:SysTick_Handler 8 static
main.c:41:5:main 8 static,ignoring_inline_asm
main.c:116:6:SystemClock_Config_24M_LSE_FL3_VS2 8 static
main.c:184:6:SystemClock_Config_24M_LSE 8 static
main.c:249:6:SystemClock_Config_80M 8 static