Skip to main content
YMAIL
Associate III
August 6, 2019
Question

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 ?

  • August 6, 2019
  • 4 replies
  • 2098 views

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

}

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
August 6, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
YMAIL
YMAILAuthor
Associate III
August 7, 2019

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.

Tesla DeLorean
Guru
August 7, 2019

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 VenmoUp vote any posts that you find helpful, it shows what's working..
YMAIL
YMAILAuthor
Associate III
August 7, 2019

Ok I try right now.

YMAIL
YMAILAuthor
Associate III
August 7, 2019

Ok I try right now.

YMAIL
YMAILAuthor
Associate III
August 8, 2019

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.