Is it necessary to call fx_media_close() before entering low power (STOP 1 mode ) on STM32L4R9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-06 12:57 PM
My chipset is a STM32L4R9 and I have Nor Flash SPI chip used for file storage (FileX, LevelX, QuadSPI capable). My application is battery powered device. It wakes up reads some IO, logs to flash file system, sets RTC Wakeup timer and goes to sleep.
Before I enter low power mode (Stop 1 or Stop 2) should I call fx_media_close()?
In Stop 1 and Stop 2 the SRAM is preserved however OCTOSPI peripheral is not available.
Fx_media_open() takes about 1 minute to complete and I would like to avoid this if possible.
Thanks,
- Labels:
-
AzureRTOS
-
Power
-
STM32L4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-21 2:19 AM
hi,
Yes is necessary to call fx_media_close() before entering in low-power mode.
So, to avoid opening the media fx_media_open() in 1 minute it is necessary to restore (enable) the clock (PLL, msi) after low power.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-21 6:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-21 8:26 AM
Hi @MFARH.1​
THank you for your help. Let me restate what I understood from your comment.
I think you are saying that if I restore the clocks (PLL, MSI) after exiting low power mode I can avoid having to call fx_media_open after waking from sleep. Is that correct?
Here is how I understand the sequence of events for the processor (and the flash media)
- Power Up (Clocks configured for PLL, MSI)
- Open media (fx_media_open)
- Read sensors
- Write files
- Flush media
- Configure clocks (low power oscillator, RTC wakeup timer, etc) for low power (before entering low power mode)
- Enter Low power mode (Stop 1)
- Wakeup event
- Configure clocks for PLL, msi
- Return to step 3 in the list
There is no need to keep calling the fx_media_open() in my list if I understood you correctly
Thanks,
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-21 8:43 AM
hi @MD'Si.1​
Here is the scenario:
1 Open Nor Flash media. “nor_disk�?
2 Open a file and write data.
3 Flush media
4 Close Nor Flash media. “nor_disk�?
5 Enter STOP mode.
6 Wakup from STOP mode.
7 Configure clocks for PLL, msi
8 Open Nor Flash media. “nor_disk�?
9 Open a file and read data.
10 Close Nor Flash media. “nor_disk�?
Thanks,
Maher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-09-21 9:17 AM
hi @MFARH.1​,
So it seems I have to perform fx_media_open on every wakeup. Do you know if there are ways (Compiler defines) to reduce the time it takes to perform the fx_media_open?
I have not looked through all the code for fx_media_open but I assume the time to open media is dependent on at least:
- Flash size of chip (number of sectors)
- SPI bus speed
Are there any other factors?
Thanks
