Hi I managed to get low power in EM4S (~1uA) on MGM12P but I get very high power in EM3 (~800uA instead of 2-3uA as per data sheet).
All I need in EM3 is to listen for a button interrupt (button release). The rest should all be be switched off and it's crucial that power consumption is reduced to an absolute minimum because the device is battery powered.
How can I do this? I found examples on how to enable modules (e.g. ADC) but not how to disable them
Can anybody pls show me how to turn off everything but the button interrupts? Lines of actual code would help me a lot more than describing what I need to do because overall I'm struggling with the docs, the information seems to be rather scattered on some topics.
Thanks a lot!
For disable ADC, you can use this code.
void ADC_Reset(ADC_TypeDef *adc)
/* Stop conversions, before resetting other registers. */
adc->CMD = ADC_CMD_SINGLESTOP | ADC_CMD_SCANSTOP;
Low power check, can you use this code for check.
Hi Eric, thanks but it didn't help reducing power, see the screenshot.
Something is definitely going on with EM3 but can't understand what. Didn't find any info on shutting down modules in the example you sent, was it just for EM4?
..note that the above is with my device connected to the BRD4001 via the "SLSDA001A DEBUGGING & PROGRAMMING INTERFACE". I see the display on the board remains ON on matter on the sleep mode but I'd imagine the energy profiler is smart enough to measure the consumption of my board independently of the BRD4001. It does work on EM4S anyways.
One thing I'm thinking is I2C. I didn't enable it but maybe it needs to be disabled anyway? I2C is only active in EM3 (not EM4) which would explain this problem
Would you check switch_led_interrupt. Comment out GPIO_PinOutToggle().
Please check attached file, if it works for you?
Can you be more specific on works but only after...consumption?
I tested on WSTK(BRD4304A), it works well.
Do you have a WSTK to check it directly.
To solved the problem, we should first locate the problem.
Are you use a custom board? What is the schematic?
I'm not sure if I2C cause it, can you check this by a HW cut/remove?
yes it's a custom board connected with the external programmer. I'll do some checks later on but in the meantime I just wanted to know if there was anything I could do to shut down modules before it goes to EM3 sleep.
Could you give me a couple of lines to shut down all the clocks etc and only keep one pin interrupt active?
I'm using a single button to wake the board from EM4 but I can't go back to EM4 as long as the button is pressed so I need to go to EM3 and listen for the button release to go back to EM4. So in EM3 all I need is the interrupt on one button.
Any better ideas on how to do this? I have already coded it but it looks a bit untidy this way
Have you checked the BRD4162A_EM3EM4.zip?
The HFXO is disabled automatically when entering EM2, EM3, or EM4.
Which clock are you intend to shutdown?