HAL, STM32F746GDISCOVERY, STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-02 11:33 AM
How to generate a break when the supply voltage drops below a certain value in the HAL?
Andrzej
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-20 8:58 AM
Generally one would pre-erase a sector, and then journal across it.
How long exactly is it taking now?
Is there some RTC, BKP or NVRAM you can use instead? Perhaps save data there, and go into STANDBY, save the FLASH when power restored.
Perhaps you can immediately gear-down to a slower clock to save power?
Have code in the IRQ Handler directly, and disable all other IRQs?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-02 11:41 AM
If the answers to your previous posts on this topic were insufficient, please reply there with further details rather than creating another duplicate post with the same question.
https://community.st.com/s/question/0D53W00000uYj4KSAS/stm32f746gdiscovery-pwrpvd-stm32cubeide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-02 11:52 AM
Hello @Andrzej Dębski​ ,
If by generating a break you mean resetting the microcontroller, please check the Power Supply Supervisor section (2.4) of the Reference manual.
In this case you should use not HAL but LL (stm32h7xx_ll_pwr.c) to access the registers.
Best regards,
@SBEN .2​
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-03 3:02 AM
I will follow the comments.
I am working on writing to a FLASH uint32_t variable, on power off. I am trying to do this using PVD. So far, no luck. I wrote to FLASH and blocked contact with the Discovery disc. Turning off the power and trying to connect to the programmer will not work.
Andrzej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-03 10:25 AM
I was able to program the break when the voltage dropped. I used the wrong instruction.
static void PVD_NVIC_Init(void) {
PWR_PVDTypeDef sConfigPVD;
sConfigPVD.PVDLevel = PWR_PVDLEVEL_6;
sConfigPVD.Mode = PWR_PVD_MODE_IT_FALLING;
HAL_PWR_ConfigPVD(&sConfigPVD);
HAL_PWR_EnablePVD();
}
Without interruption.
Now I will try to write to FLASH. I will inform.
Best regards
Andrzej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-03 11:50 AM
Writing flash into a collapsing supply,​ probably a good way to brick things.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-05 12:42 AM
I don't understand "brick". Please explain.. This is jargon?
regerds
Andrzej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-20 8:45 AM
I did the power-off memorization as shown. HAL_PWR_PVD and HAL_FLASH_Program interrupt.
void HAL_PWR_PVDCallback(void) {
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, ADD_FLASH, total_time)
== HAL_OK)
HAL_FLASH_Lock();
}
Can you even speed up your programming?
Andrzej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-20 8:58 AM
Generally one would pre-erase a sector, and then journal across it.
How long exactly is it taking now?
Is there some RTC, BKP or NVRAM you can use instead? Perhaps save data there, and go into STANDBY, save the FLASH when power restored.
Perhaps you can immediately gear-down to a slower clock to save power?
Have code in the IRQ Handler directly, and disable all other IRQs?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-07-20 9:07 AM
I'll check how long it takes now. As a last resort, I will lower the clock. Obviously it works and I'm happy but I wonder if it wouldn't be enough.
Andrzej
