cancel
Showing results for 
Search instead for 
Did you mean: 

Is it necessary to call fx_media_close() before entering low power (STOP 1 mode ) on STM32L4R9

MD'Si.1
Associate III

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,

5 REPLIES 5
MFARH.1
ST Employee

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.

MFARH.1
ST Employee

0693W00000SvuQpQAJ.png

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)

  1. Power Up (Clocks configured for PLL, MSI)
  2. Open media (fx_media_open)
  3. Read sensors
  4. Write files
  5. Flush media
  6. Configure clocks (low power oscillator, RTC wakeup timer, etc) for low power (before entering low power mode)
  7. Enter Low power mode (Stop 1)
  8. Wakeup event
  9. Configure clocks for PLL, msi
  10. 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

MFARH.1
ST Employee

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

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:

  1. Flash size of chip (number of sectors)
  2. SPI bus speed

Are there any other factors?

Thanks