2013-02-08 09:41 AM
I am using STM32F205RGT6 Cortex-M3 microcontroller and coding with IAR Embedded Workbench.
I plan to keep the microcontroller in a power saving mode most of the time except when an external component tries to either communicate via SPI (the STM32 microcontroller is meant to be a SP slave) or via USB.
One external compinent is connected via SPI (PB12-15) and PC is connected via USB (PA11-12).
The communication works fine - I have tested both the SPI as well as USB.
I figured that once I am done setting up SPI and USB I will call a power saving function and add the same function call at the end of interrupt service routines. I have found PWR_EnterSTANDBYMode and PWR_EnterSTOPMode (in stm32f2xx_pwr.h) both of which I tried using.
However with such arrangement I cannot establish any communication (SPI or USB) with the microcontroller.
Is there something extra that needs to be configured (for example which pins should wake the microcontroller up)?
Am I using wrong function? Or wrong header file?
Can you point me to an example resembling such case (I could not find anything similar on ST's website)?
Any constructive feedback would be welcome.
2013-02-08 10:38 AM
PA0-WKUP?
I'm pretty sure the reference manual enumerates the exit modes of STOP and STANDBY. The latter resets the processor. Your external peripheral/device is going to have to wake up the STM32 if you've turned the clocks and regulators off. I don't suppose it's going to respond quickly enough to an SPI -SS going low event from the lowest power states. If you are waiting for an interrupt you'll need to set up an internal or external source, and dwell in a WFI loop.2013-02-12 06:36 AM
Thank you very much for your response!
In the mean time I found the application note AN3430 (http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/APPLICATION_NOTE/DM00033348.pdf) which is somehow more digestible (only 38 pages) than reference manual - it gives an excellent overview on power saving in the microcontroller and specific pointers to datasheet chapters.Since I don't have access to PA0-WKUP (the wake-up pin) I had to discard using stand-by mode. Seems that just a simple sleep mode triggered from main loop - by calling __WMI(); - should lower current consumption enough in my case. I might consider stop mode (with voltage regulator in run mode for fast wake-up time) if sleep mode isn't enough but I will have to read the fragments of datasheet on configuration of EXTI registers that the application note points to.There are also some useful hints there on using ART accelerator and other items which might give me some minor power savings.