cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476G MCU printf doesnt work after wake up from sleep mode.

VÜnal.1
Associate II

Hi all,

i realized that , printf doesnt work after wake up from sleep mode, i am using rtc to wake up mcu from sleep mode every minutes. Here is my structure config.

sAlarm.Alarm = RTC_ALARM_A;
	sAlarm.AlarmDateWeekDay = 0x31; // Nonspecific
	sAlarm.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE;
	sAlarm.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY | RTC_ALARMMASK_HOURS | RTC_ALARMMASK_MINUTES;
	sAlarm.AlarmSubSecondMask = RTC_ALARMSUBSECONDMASK_NONE;
	sAlarm.AlarmTime.Hours = 0x0;
	sAlarm.AlarmTime.Minutes = 0x0;
	sAlarm.AlarmTime.Seconds = 0x0;
	sAlarm.AlarmTime.SubSeconds = 0x0;
	sAlarm.AlarmTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
	sAlarm.AlarmTime.StoreOperation = RTC_STOREOPERATION_RESET;

Every one minute, this code works.

void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *hrtc)
 
{
 
	__HAL_RTC_ALARM_EXTI_CLEAR_FLAG();
 
	gsm_machine_debug("\r\nHAL_RTC_AlarmAEventCallback \r\n");
 
	//send_data_flag = 1;
 
}

But if i put to mcu to sleep mode with debug window. This callback works still but printf is no longer working.

 Does anyone have any advices about why it is not working ?

Best Regards ?

Volkan

1 ACCEPTED SOLUTION

Accepted Solutions

clocks/baud rates are wrong, pins are not initialized?

Make sure the pins, clocks and peripheral are all reenabled, and configured suitably.

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

View solution in original post

2 REPLIES 2

clocks/baud rates are wrong, pins are not initialized?

Make sure the pins, clocks and peripheral are all reenabled, and configured suitably.

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

you are right, i forgot to configure systemclock after woke up from stop mode. i want to ask another question if it is possible.

You have any documentation or links about to do's after wake up ? (it may be sound stupid question )

Best Regards,

Volkan.