cancel
Showing results for 
Search instead for 
Did you mean: 

With a B-L072Z-LRWAN1 discovery board. After a stop mode wake up using the RTC, I go back to the while(1) loop of the main fonction. But I'm blocked at the end of the loop. Do someone knows why ?

YMAIL
Associate II

 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 );

}

8 REPLIES 8

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
YMAIL
Associate II

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.

My approach would be to initialize the clocks, pins and USART using low level coding. Similarly with GPIO at the while(1) loops.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
YMAIL
Associate II

Ok I try right now.

Ok I try right now.

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 ?

Ok ! I get stuck in the Error_Handler.

Is that an IRQ issue ?

YMAIL
Associate II

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.