Method For Switching to LPRC from FRC with PLL to Conserve Power -PIC32MX Via FreeRTOS

The Idle Task Provides good way to sleep the PIC32MX Controller but I cant see a way to scale the Clock at run time Just Like WIndows 10 Scales down the processor Clock instead of going to Hibernate to conserve Power

Method For Switching to LPRC from FRC with PLL to Conserve Power -PIC32MX Via FreeRTOS

There is no clock scaling built in, but there are hooks and examples that allow you to stop the tick and therefore turn off the CPU core, which will save even more power than just slowing it down. Google for “FreeRTOS Tickless Idle”, although I don’t think there are examples for the PIC32.

Method For Switching to LPRC from FRC with PLL to Conserve Power -PIC32MX Via FreeRTOS

If tickless idle doesn’t do enough for you, (you need ticks but not doing much), this is likely off of some program state machine that can decide that you aren’t going to need to do much for awhile and can drop the clock rate. One big trick, which I don’t know the PIC32MX well enough to know how easy it is, is that many periphearals (UARTS, Timers, etc) don’t like the clock changing on them, but Microchip likely has examples of how to do this. If it doesn’t significantly impact the tick interrupt, then FreeRTOS doesn’t need to know about it.

Method For Switching to LPRC from FRC with PLL to Conserve Power -PIC32MX Via FreeRTOS

stop the tick and therefore turn off the CPU core, which will save even more power than just slowing it down.
  1. USB Catch PIC32MX-Reference Manual:—> 27.7 OPERATION IN DEBUG AND POWER-SAVING MODES 27.7.1 Operation in Sleep Use of Sleep mode is only recommended in two cases: • USB OTG module is disabled • USB OTG module is in a Suspend state. —> USB is also used as Charger for Battery. =>CPU Can’t Run at Full Speed Either.
  2. LEDs Catch LEDs need to Blink with CPU consuming Low Values of Current(1mA@500KHz=FRC/16) contrast to {75mA@100MHz, 80uA@Sleep} How can these both be achieved when PIC32MX Enters Sleep Mode … Also wake up time of PIC32MX470F512H is around SY00– TPU– Power-up Period Internal Voltage Regulator Enabled–600us

Google for “FreeRTOS Tickless Idle”
Below is the code Produced by MPLAB-X v4.20 with Harmony Configurator v2.06 with FreeRTOS v10.0.1 in task.c file(Code Given at End) But: portSUPPRESSTICKSAND_SLEEP( xExpectedIdleTime ); is not implemented for PIC32MX470F512L (in FreeRTOS.h) . Is this Correct? I am Looking for “Official FreeRTOS versions attempt to remove any slippage (as far as is possible) by providing a more intricate implementation. ”
    /* This conditional compilation should use inequality to 0, not equality
    to 1.  This is to ensure portSUPPRESS_TICKS_AND_SLEEP() is called when
    user defined low power mode implementations require
    configUSE_TICKLESS_IDLE to be set to a value other than 1. */
    #if ( configUSE_TICKLESS_IDLE != 0 )
    {
    TickType_t xExpectedIdleTime;

        /* It is not desirable to suspend then resume the scheduler on
        each iteration of the idle task.  Therefore, a preliminary
        test of the expected idle time is performed without the
        scheduler suspended.  The result here is not necessarily
        valid. */
        xExpectedIdleTime = prvGetExpectedIdleTime();

        if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
        {
            vTaskSuspendAll();
            {
                /* Now the scheduler is suspended, the expected idle
                time can be sampled again, and this time its value can
                be used. */
                configASSERT( xNextTaskUnblockTime >= xTickCount );
                xExpectedIdleTime = prvGetExpectedIdleTime();

                /* Define the following macro to set xExpectedIdleTime to 0
                if the application does not want
                portSUPPRESS_TICKS_AND_SLEEP() to be called. */
                configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( xExpectedIdleTime );

                if( xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP )
                {
                    traceLOW_POWER_IDLE_BEGIN();
                    portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
                    traceLOW_POWER_IDLE_END();
                }
                else
                {
                    mtCOVERAGE_TEST_MARKER();
                }
            }
            ( void ) xTaskResumeAll();
        }
        else
        {
            mtCOVERAGE_TEST_MARKER();
        }
    }
    #endif /* configUSE_TICKLESS_IDLE */

Method For Switching to LPRC from FRC with PLL to Conserve Power -PIC32MX Via FreeRTOS

portSUPPRESSTICKSAND_SLEEP( xExpectedIdleTime ); is not implemented for PIC32MX470F512L (in FreeRTOS.h) . Is this Correct?
That is right, the macro is still called though so you can still provide an implementation for the PIC32. The Cortex-M ports have a ‘default’ implementation of the necessary only – to get ultra low power modes operational it is necessary to write a port specific implementation (to use a chip specific low power clock) on those parts too.