Make a test with stop mode: STOP2

This commit is contained in:
Thomas Kuschel 2022-06-03 18:28:54 +02:00
parent efdf1e0764
commit 86ef8e7049
2 changed files with 242 additions and 34 deletions

View File

@ -178,6 +178,36 @@ int main(void)
HAL_Delay(10000); HAL_Delay(10000);
#endif #endif
HAL_Delay(10000);
while (1) {
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET);
HAL_Delay(100);
HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
#if 0
{
/* for STANDBY MODE only:
*
*/
/* clear the WU flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
/* clear the RTC Wake Up (WU) flag */
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
}
#endif
HAL_SuspendTick();
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x5000, RTC_WAKEUPCLOCK_RTCCLK_DIV16);
// /* Enter STOP 2 mode */
HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
//HAL_PWR_EnterSTANDBYMode();
HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
SystemClock_Config();
HAL_ResumeTick();
}
/* World Youth ARDF Championship Romania 2022 */ /* World Youth ARDF Championship Romania 2022 */
/* 80 m . RF power 3 W, QRG MOE-MO5: 3550 MHz, MO: 3600 MHz, Antenna 8m /* 80 m . RF power 3 W, QRG MOE-MO5: 3550 MHz, MO: 3600 MHz, Antenna 8m
@ -200,11 +230,8 @@ int main(void)
si5351_enable_output(NULL,2); si5351_enable_output(NULL,2);
#endif #endif
/*
for (int i=2; i>=0; i--) {
si5351_deinit(instance_si5351[i]);
}
*/
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Init scheduler */ /* Init scheduler */
@ -257,6 +284,9 @@ int main(void)
/* We should never get here as control is now taken by the scheduler */ /* We should never get here as control is now taken by the scheduler */
/* Infinite loop */ /* Infinite loop */
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) while (1)
{ {
@ -790,19 +820,26 @@ void StartDefaultTask(void *argument)
(void) argument; //unused argument (void) argument; //unused argument
int sw, sw_last = GPIO_PIN_RESET; int sw, sw_last = GPIO_PIN_RESET;
int counter = 10;
/* Infinite loop */ /* Infinite loop */
for(;;) { for(;;) {
// HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin); // HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_SET);
osDelay(5); osDelay(100);
HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET); HAL_GPIO_WritePin(LD1_GPIO_Port, LD1_Pin, GPIO_PIN_RESET);
sw = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin); sw = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin);
if (sw_last == GPIO_PIN_RESET && sw == GPIO_PIN_SET) { if (sw_last == GPIO_PIN_RESET && sw == GPIO_PIN_SET) {
leds_on = !leds_on; leds_on = !leds_on;
counter--;
} }
sw_last = sw; sw_last = sw;
osDelay(2000); osDelay(2000);
if (!counter)
break;
} }
/* USER CODE END 5 */ /* USER CODE END 5 */
} }

View File

@ -40,33 +40,119 @@ Mcu.IP6=SYS
Mcu.IPNb=7 Mcu.IPNb=7
Mcu.Name=STM32L4A6ZGTx Mcu.Name=STM32L4A6ZGTx
Mcu.Package=LQFP144 Mcu.Package=LQFP144
Mcu.Pin0=PC13 Mcu.Pin0=PE2
Mcu.Pin1=PC14-OSC32_IN (PC14) Mcu.Pin1=PE3
Mcu.Pin10=PC7 Mcu.Pin10=PF2
Mcu.Pin11=PA8 Mcu.Pin100=PB3 (JTDO/TRACESWO)
Mcu.Pin12=PA9 Mcu.Pin101=PB4 (NJTRST)
Mcu.Pin13=PA10 Mcu.Pin102=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b=112
Mcu.ThirdPartyNb=0 Mcu.ThirdPartyNb=0
Mcu.UserConstants= Mcu.UserConstants=
Mcu.UserName=STM32L4A6ZGTx Mcu.UserName=STM32L4A6ZGTx
@ -89,6 +175,8 @@ NVIC.TIM6_DAC_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
NVIC.TimeBase=TIM6_DAC_IRQn NVIC.TimeBase=TIM6_DAC_IRQn
NVIC.TimeBaseIP=TIM6 NVIC.TimeBaseIP=TIM6
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:false\:true NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:false\:true
PA0.Signal=GPIO_Analog
PA1.Signal=GPIO_Analog
PA10.GPIOParameters=GPIO_Label PA10.GPIOParameters=GPIO_Label
PA10.GPIO_Label=USB_ID PA10.GPIO_Label=USB_ID
PA10.Locked=true PA10.Locked=true
@ -113,6 +201,11 @@ PA14\ (JTCK/SWCLK).Mode=Trace_Asynchronous_SW
PA14\ (JTCK/SWCLK).Signal=SYS_JTCK-SWCLK PA14\ (JTCK/SWCLK).Signal=SYS_JTCK-SWCLK
PA2.Mode=Clock-out-LSCO PA2.Mode=Clock-out-LSCO
PA2.Signal=RCC_LSCO PA2.Signal=RCC_LSCO
PA3.Signal=GPIO_Analog
PA4.Signal=GPIO_Analog
PA5.Signal=GPIO_Analog
PA6.Signal=GPIO_Analog
PA7.Signal=GPIO_Analog
PA8.GPIOParameters=GPIO_Label PA8.GPIOParameters=GPIO_Label
PA8.GPIO_Label=USB_SOF [TP1] PA8.GPIO_Label=USB_SOF [TP1]
PA8.Locked=true PA8.Locked=true
@ -121,15 +214,26 @@ PA9.GPIOParameters=GPIO_Label
PA9.GPIO_Label=USB_VBUS PA9.GPIO_Label=USB_VBUS
PA9.Locked=true PA9.Locked=true
PA9.Signal=USB_OTG_FS_VBUS PA9.Signal=USB_OTG_FS_VBUS
PB0.Signal=GPIO_Analog
PB1.Signal=GPIO_Analog
PB10.Signal=GPIO_Analog
PB11.Signal=GPIO_Analog
PB12.Signal=GPIO_Analog
PB13.Signal=GPIO_Analog
PB14.GPIOParameters=GPIO_Label PB14.GPIOParameters=GPIO_Label
PB14.GPIO_Label=LD3 [Red] PB14.GPIO_Label=LD3 [Red]
PB14.Locked=true PB14.Locked=true
PB14.Signal=GPIO_Output PB14.Signal=GPIO_Output
PB15.Signal=GPIO_Analog
PB2.Signal=GPIO_Analog
PB3\ (JTDO/TRACESWO).GPIOParameters=GPIO_Label PB3\ (JTDO/TRACESWO).GPIOParameters=GPIO_Label
PB3\ (JTDO/TRACESWO).GPIO_Label=SWO PB3\ (JTDO/TRACESWO).GPIO_Label=SWO
PB3\ (JTDO/TRACESWO).Locked=true PB3\ (JTDO/TRACESWO).Locked=true
PB3\ (JTDO/TRACESWO).Mode=Trace_Asynchronous_SW PB3\ (JTDO/TRACESWO).Mode=Trace_Asynchronous_SW
PB3\ (JTDO/TRACESWO).Signal=SYS_JTDO-SWO PB3\ (JTDO/TRACESWO).Signal=SYS_JTDO-SWO
PB4\ (NJTRST).Signal=GPIO_Analog
PB5.Signal=GPIO_Analog
PB6.Signal=GPIO_Analog
PB7.GPIOParameters=GPIO_Label PB7.GPIOParameters=GPIO_Label
PB7.GPIO_Label=LD2 [Blue] PB7.GPIO_Label=LD2 [Blue]
PB7.Locked=true PB7.Locked=true
@ -144,6 +248,8 @@ PB9.GPIO_Pu=GPIO_PULLUP
PB9.Locked=true PB9.Locked=true
PB9.Mode=I2C PB9.Mode=I2C
PB9.Signal=I2C1_SDA PB9.Signal=I2C1_SDA
PC0.Signal=GPIO_Analog
PC1.Signal=GPIO_Analog
PC13.GPIOParameters=GPIO_PuPd,GPIO_Label PC13.GPIOParameters=GPIO_PuPd,GPIO_Label
PC13.GPIO_Label=B1 PC13.GPIO_Label=B1
PC13.GPIO_PuPd=GPIO_PULLDOWN PC13.GPIO_PuPd=GPIO_PULLDOWN
@ -155,10 +261,17 @@ PC14-OSC32_IN\ (PC14).Signal=RCC_OSC32_IN
PC15-OSC32_OUT\ (PC15).Locked=true PC15-OSC32_OUT\ (PC15).Locked=true
PC15-OSC32_OUT\ (PC15).Mode=LSE-External-Oscillator PC15-OSC32_OUT\ (PC15).Mode=LSE-External-Oscillator
PC15-OSC32_OUT\ (PC15).Signal=RCC_OSC32_OUT PC15-OSC32_OUT\ (PC15).Signal=RCC_OSC32_OUT
PC2.Signal=GPIO_Analog
PC3.Signal=GPIO_Analog
PC4.Signal=GPIO_Analog
PC5.Signal=GPIO_Analog
PC6.Signal=GPIO_Analog
PC7.GPIOParameters=GPIO_Label PC7.GPIOParameters=GPIO_Label
PC7.GPIO_Label=LD1 [Green] PC7.GPIO_Label=LD1 [Green]
PC7.Locked=true PC7.Locked=true
PC7.Signal=GPIO_Output PC7.Signal=GPIO_Output
PC8.Signal=GPIO_Analog
PC9.Signal=GPIO_Analog
PCC.Checker=true PCC.Checker=true
PCC.Line=STM32L4x6 PCC.Line=STM32L4x6
PCC.MCU=STM32L4A6ZGTx PCC.MCU=STM32L4A6ZGTx
@ -197,6 +310,62 @@ PCC.Seq0.Step1.Voltage_Source=Battery
PCC.Series=STM32L4 PCC.Series=STM32L4
PCC.Temperature=25 PCC.Temperature=25
PCC.Vdd=3.0 PCC.Vdd=3.0
PD0.Signal=GPIO_Analog
PD1.Signal=GPIO_Analog
PD10.Signal=GPIO_Analog
PD11.Signal=GPIO_Analog
PD12.Signal=GPIO_Analog
PD13.Signal=GPIO_Analog
PD14.Signal=GPIO_Analog
PD15.Signal=GPIO_Analog
PD3.Signal=GPIO_Analog
PD4.Signal=GPIO_Analog
PD5.Signal=GPIO_Analog
PD6.Signal=GPIO_Analog
PD7.Signal=GPIO_Analog
PD8.Signal=GPIO_Analog
PD9.Signal=GPIO_Analog
PE10.Signal=GPIO_Analog
PE11.Signal=GPIO_Analog
PE12.Signal=GPIO_Analog
PE13.Signal=GPIO_Analog
PE14.Signal=GPIO_Analog
PE15.Signal=GPIO_Analog
PE2.Signal=GPIO_Analog
PE3.Signal=GPIO_Analog
PE4.Signal=GPIO_Analog
PE5.Signal=GPIO_Analog
PE6.Signal=GPIO_Analog
PE7.Signal=GPIO_Analog
PE8.Signal=GPIO_Analog
PE9.Signal=GPIO_Analog
PF0.Signal=GPIO_Analog
PF1.Signal=GPIO_Analog
PF10.Signal=GPIO_Analog
PF11.Signal=GPIO_Analog
PF12.Signal=GPIO_Analog
PF13.Signal=GPIO_Analog
PF14.Signal=GPIO_Analog
PF15.Signal=GPIO_Analog
PF2.Signal=GPIO_Analog
PF3.Signal=GPIO_Analog
PF4.Signal=GPIO_Analog
PF5.Signal=GPIO_Analog
PF6.Signal=GPIO_Analog
PF7.Signal=GPIO_Analog
PF8.Signal=GPIO_Analog
PF9.Signal=GPIO_Analog
PG0.Signal=GPIO_Analog
PG1.Signal=GPIO_Analog
PG10.Signal=GPIO_Analog
PG11.Signal=GPIO_Analog
PG12.Signal=GPIO_Analog
PG13.Signal=GPIO_Analog
PG14.Signal=GPIO_Analog
PG15.Signal=GPIO_Analog
PG2.Signal=GPIO_Analog
PG3.Signal=GPIO_Analog
PG4.Signal=GPIO_Analog
PG5.GPIOParameters=GPIO_Label PG5.GPIOParameters=GPIO_Label
PG5.GPIO_Label=USB_OverCurrent [STMPS2151STR_FAULT] PG5.GPIO_Label=USB_OverCurrent [STMPS2151STR_FAULT]
PG5.Locked=true PG5.Locked=true
@ -217,8 +386,11 @@ PG8.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
PG8.Locked=true PG8.Locked=true
PG8.Mode=Asynchronous PG8.Mode=Asynchronous
PG8.Signal=LPUART1_RX PG8.Signal=LPUART1_RX
PG9.Signal=GPIO_Analog
PH0-OSC_IN\ (PH0).Signal=GPIO_Analog
PH1-OSC_OUT\ (PH1).Locked=true PH1-OSC_OUT\ (PH1).Locked=true
PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT PH1-OSC_OUT\ (PH1).Signal=RCC_OSC_OUT
PH3-BOOT0.Signal=GPIO_Analog
PinOutPanel.RotationAngle=0 PinOutPanel.RotationAngle=0
ProjectManager.AskForMigrate=true ProjectManager.AskForMigrate=true
ProjectManager.BackupPrevious=false ProjectManager.BackupPrevious=false
@ -326,4 +498,3 @@ VP_SYS_VS_tim6.Mode=TIM6
VP_SYS_VS_tim6.Signal=SYS_VS_tim6 VP_SYS_VS_tim6.Signal=SYS_VS_tim6
board=NUCLEO-L4A6ZG board=NUCLEO-L4A6ZG
boardIOC=true boardIOC=true
isbadioc=true