• AVR Freaks

Helpful ReplyHot!Harmony 3, PIC32MZ power-saving?

Author
Jon_S
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2019/12/03 04:51:40
  • Location: 0
  • Status: offline
2020/05/27 03:00:31 (permalink)
0

Harmony 3, PIC32MZ power-saving?

I've found the documentation for low power apps on the SAMC2x cores, but I can't seem to find anything for the PIC32MZ.
 
The power-management component in Harmony doesn't seem to be present for the PIC32MZ. Is there any guidance how to do low-power, it looks like there were some helper functions (PLIB_POWER_PeripheralModuleDisable etc...) in earlier versions of Harmony.  
#1
arpananand
Super Member
  • Total Posts : 498
  • Reward points : 0
  • Joined: 2009/11/18 04:35:42
  • Location: 0
  • Status: offline
Re: Harmony 3, PIC32MZ power-saving? 2020/05/27 03:13:34 (permalink) ☄ Helpfulby Jon_S 2020/05/27 03:16:31
0
there is less scope to minimize the power consumption in PIC32MZ devices as compare to some of the SAM devices.
 
Harmony 3 doesn't provide PLIB_POWER_PeripheralModuleDisable kind of functions, however it disables all the unused peripheral clocks in the beginning by default (check Clock_Initialize function implementation) anyway to reduce the power consumption, so there is no need to call any dedicated function to do the same. 
 
apart from that some of the peripheral bus clocks can be disabled manually in Clock manager if corresponding peripherals are not used. 
 
#2
Jon_S
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2019/12/03 04:51:40
  • Location: 0
  • Status: offline
Re: Harmony 3, PIC32MZ power-saving? 2020/05/27 04:32:32 (permalink)
0
Thank you, I understand that the PIC32MZ is not designed for low power. But I have a need to minimise power consumption in certain circumstances. My sleep needs are fairly simple, it will be very long periods (hours) where I need to minimise consumption and then wake on some interrupt.
 
It seems like the following sequence would be the best course when I need to sleep?
  1. Disable modules that require it
  2. Disable interrupts except for my intended wake source
  3. Disable all the peripheral clocks
  4. Drop the main osc to the LPINTOSC
  5. Execute asm("WAIT");
  6. Change back to the High-speed osc on wake.
  7. Re-enable the perip clocks.
  8. Re-enable modules that required closing and call necessary Harmony Initialise() functions
I'm thinking that I can possibly get away with just cutting the perip clocks to things like UARTs and SPI, but that I will have to do a full shutdown for CAN and USB. There doesn't seem to be a DeInitialize() function for SYS_FS or CAN, is that on purpose because it's unnecessary on shutdown (do nothing to SYS_FS, C1CONbits.ON = 0 for CAN) and I can just call Initialize() on these to get things back in working order?
#3
Paul PortSol
Super Member
  • Total Posts : 632
  • Reward points : 0
  • Joined: 2015/07/03 11:52:03
  • Location: Newfoundland, Canada
  • Status: offline
Re: Harmony 3, PIC32MZ power-saving? 2020/05/27 08:21:36 (permalink)
0
Unofficial but maybe worth a try:
a) Measure power in simple project that doesn't enable anything that won't be used in powerdown, this is your 'target sleep' power consumption. 
b) Measure power in full operation, this is target 'run power'
c) Compare to power in real app when you enter powerdown, did you reach 'target sleep'?
d) when you power back up check if power returns to 'target run', if not maybe something not completely functional.
e) (Careful to appropriately set pullups/pulldowns for items that aren't in use such that those don't draw unnecessary current, won't provide paths that may partially power unused circuits, but will provide appropriate signals where needed though those maybe can be overridden in code for less power).
Paul
 
#4
Jump to:
© 2020 APG vNext Commercial Version 4.5