void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
str = "WakeUP from SLEEP by EXTI\r\n";
HAL_UART_Transmit(&huart2, (uint8_t *)str, strlen (str), HAL_MAX_DELAY);
HAL_PWR_DisableSleepOnExit ();
}
int main ()
{
......
......
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
int x = 5;
int y = 10;
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 1);
HAL_Delay(5000);
HAL_SuspendTick();
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 0); // Just to indicate that the sleep mode is activated
HAL_PWR_EnableSleepOnExit ();
// Enter Sleep Mode , wake up is done once User push-button is pressed
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
// What happens here, after we wake up SLEEP ? X and Y are cleared. And the context ?
int s = x + y;
HAL_ResumeTick();
for (int i=0; i<20; i++)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
HAL_Delay(100);
}
}
}
My recommendation:There is an STM32 that
According to which documentation? The assumption sounds just unsubstantiated. I'm not aware of other low power modes than STANDBY disabling RAM. If you think that any STM32 device behave differently, please tell device type and refer to respective doc.Here after we Enter SLEEP Mode with RAM disabled
My recommendation:
When asking about a specific device or it´s features: always post a link to the datasheet.
Also we need to know the EXACT devicce type.
You need to read it in first place, but we need to read it, too.
What I found is, is that the DRIVERS to access the SRAM and the CLOCK to the SRAM is powered down to reduce current consumption.
And since the SRAM is not powered OFF, it´s contents are preserved. AGAIN: this might be true or not for your EXACT microcontroller type.
Hi,
in other words: STOP mode is not the same as a SLEEP mode.
* In post#1 you talked about SLEEP mode ... with a SLEEP command ... and the microcontroller RESUMES operation after SLEEP.
* In post#4 you talk about STOP mode... not meant to resume operation ... but it needs a RESTART.
Klaus
For sure this is a lot of documentation reading ... I don´t have the time for..
Problem is that you don't believe clear and simple datasheet facts and ask about unsubstantiated guesses instead.- If SLEEP mode or STOP mode did indeed cleared that RAM what would happen if they were woken up ? MCU still can read instructions what to do next in the code but the variables etc are cleared from RAM so ERROR ?
Problem is that you don't believe clear and simple datasheet facts and ask about unsubstantiated guesses instead.
For sure you are free to see it this way. I see it a bit differently.Sounds like "google it" and not as a really help
To ease the process for all of us trying to help you ... I wrote this sentence above.So before you reply, please be sure to have all documents by hand, and having read the related sections.
For detailed discussions always refer to the document (by clear name) and the according section/page.
I noticed you posted a link ... and you posted the section "6.3.9 Stop Mode".
But the link is not to a datasheet, but a link to an internet site. Ok .. so I downloaded the datasheet by using the link on that site. ... and guess what
--> it shows section "6.3.9 Memory characteristics".
See: datasheet
In the RM - Reference Manual
* do you have the ALL documentation by hand (including HAL)
So luckily there are different people here to assist you. So you don´t have to rely on me .. you don´t have to spend time and effort on me.
There are others to help you.
So neither me nor you have to be angry ... when I now quit this thread.
Yes, sure. Both questions have been essentially answered in post #5. Standby mode is the only way to turn off RAM. There's no problem of resuming code execution because standby is exited through reset only
PC (program counter) holds address of next instruction. Power control logic will first restart clock and then resume program execution.- IF STOP mode could turn off Flash. Then how does the MCU know how to wake up and what to turn on like flash ? Why it does not require to reset the whole MCU like in standby mode ? Or where to start in that restarted ROM ?
PC (program counter) holds address of next instruction. Power control logic will first restart clock and then resume program execution.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?