2019-08-06 09:34 AM
I'm sure that I don't go out of the loop cause I ask a led to blink if I exit the loop.
Here are my fonctions to enter and exit the stop mode.
void stm32l_lowPowerSetup(void)
{
HW_RTC_SetAlarm( 5000 );//5sec
__HAL_RCC_PWR_CLK_ENABLE(); // Enable Power Control clock
HAL_PWREx_EnableUltraLowPower(); // Ultra low power mode
HAL_PWREx_EnableFastWakeUp(); // Fast wake-up for ultra low power mode
// Disable Unused Gpios
_stm32l_disableGpios();
// Switch to STOPMode
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
}
void stm32l_lowPowerResume(void)
{
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
DBG_Init( );
HW_Init( );
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_RTC_Init();
MX_SPI1_Init();
MX_USART2_UART_Init();
MX_I2C1_Init();
MX_ADC_Init();
HAL_I2C_MspInit(&hi2c1);
EXTI->PR |= ( EXTI_PR_PR0 |EXTI_PR_PR1 |EXTI_PR_PR2 |EXTI_PR_PR3 |EXTI_PR_PR4 |EXTI_PR_PR5 |
EXTI_PR_PR6 |EXTI_PR_PR7 |EXTI_PR_PR8 |EXTI_PR_PR9 |EXTI_PR_PR10 |EXTI_PR_PR11 |
EXTI_PR_PR12 |EXTI_PR_PR13 |EXTI_PR_PR14 |EXTI_PR_PR15 |EXTI_PR_PR16 |EXTI_PR_PR17 |
EXTI_PR_PR19 |EXTI_PR_PR20 |EXTI_PR_PR21 |EXTI_PR_PR22 );
}
2019-08-06 01:00 PM
Try at least to get a USART working so you can report your situation from inside the box.
Not clear what clocking is in effect? Output a stream of 'U' (0x55) characters, and scope the bit rate. Output internal state and peripheral settings from there.
Instrument HardFault_Handler and Error_Handler to see if device has died in those while(1) loops.
2019-08-07 01:46 AM
Hi !
Thanks for your answer. In fact I tried to print something after wakeup and the uart is not working.
I tried to put HAL_***_MspInit() but it didn't help.
2019-08-07 04:49 AM
My approach would be to initialize the clocks, pins and USART using low level coding. Similarly with GPIO at the while(1) loops.
2019-08-07 04:53 AM
Ok I try right now.
2019-08-07 04:53 AM
Ok I try right now.
2019-08-07 05:36 AM
I succeded to send the "UU" frame through the uart. So I think it work. I'll now try to implement the Error_Handler. Do I need to put it to the end of the while(1) loop ?
2019-08-07 07:12 AM
Ok ! I get stuck in the Error_Handler.
Is that an IRQ issue ?
2019-08-08 02:03 AM
I found the solution. In my board the integrated sx1276 wasn't hardwarely init. Now it works.
Thanks for your help. I got new tips now for debbug thanks to you.