This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to put TIVA Peripherals and GPIO pins in high impedance state after using it ?

Hi,

To achieve the low energy/power consumption, we want to put some peripherals and pins into high impedance state so that, it doesnot draw and current and shall result in energy saving .

Can you suggest any way to put peripherals in High impedance state after muxing of the pins and using it .

Thanks,

Sanchit Mehra

  • This "high impedance, GPIO" desire arrived this forum very recently.  (week, 2 past)  Have you searched?

    Does not the default behavior, "GPIO into Input Mode" yield a sufficiently high impedance?  (and it boasts, "ease of command" i.e. No action required!)

    To MCU peripherals - suggest that a review of the MCU manual may signal the current draw of most/many.  You may chose to experiment - enable peripherals (one at a time) while monitoring actual current draw.  Each/every peripheral may be, "reset" (by dedicated peripheral reset function) thus easing your measurement & comparison.  Manual does not readily detail the complete methods of such peripheral reset - you may review the actual source code to glean further detail.  (such peripheral reset may not attend to the related GPIO pin handling - per your desire.  Again your review of the peripheral reset function should reveal if the function deals w/actual MCU pins)

    Experimentation opens many doors.  (i.e. 100K R tied to 3V3 (or ground) and briefly introduced to MCU peripheral pin (while under peripheral reset) should quickly/easily reveal...

  • Hello Sanchit,

    The Pins when configured for a peripheral will be driven or tri-stated based on the peripheral function. The only way to do so is to configure it as GPIO Inputs.

    To put a peripheral in low current state, the simplest approach will be to Gate the Clock to the peripheral using RCGCxxx (where xxx is the peripheral) and clearing the corresponding bit.

    Regards

    Amit

  • Amit Ashara said:
    To put a peripheral in low current state, the simplest approach will be to Gate the Clock to the peripheral

    Hi Amit,

    As we note you (some few times) have rescued users from dreaded, "Fault ISR" (as they've "failed to enable" a peripheral) might that "default-reset" Peripheral Disabled behavior suffice to hold peripheral OFF? 

    Critical peripheral bit must only be "cleared" if that peripheral had been earlier - enabled.  Might you confirm?  Thanks.

  • Hello cb1

    So there are three peripheral types

    1. Those that have never been used and have RCGC cleared ==> No Problem

    2. Those that have never been used and have RCGC set ==> Must shut them down using RCGC

    3. Those that have been used and the application wants to save power ==> The Clocks must be enabled/disabled by set/clear the RCGC bit. If these peripheral need to be used in say an ISR, then a condition of SysCtlPeripheralReady must be done before enabling them and after using them shut down the clock again. This is not a true dynamic power saving, but will definitely save power when it comes to sparing use of the peripheral.

    Regards

    Amit

  • Hi Amit,

    Thanks - again you prove a remarkably valuable resource.  Thank you, Amit.

    You may recall that our small firm remains bit fearful of TivaWare - thus we "stick" w/StellarisWare, Ver 10636.  (several of our long-term Gov't contracts also dictate this, "stick w/the long known/good.")

    Your item 2 (above) seems outside our past understanding - gleaned from SW-DRL-UG-10636.  Here the specifics:

    SysCtlPeripheralEnable:
    This function enables peripherals. At power-up, all peripherals are disabled; they must be enabled in order to operate or respond to register reads/writes.

    Now we've used Ver 10636 (StellarisWare) most effectively w/multiple flavors of LX4F.  (more than 5K boards now in the field...)

    As TM4C is claimed to be "identical" to LX4F - and as the data above does not suggest different peripheral reset behavior among peripherals - might you explain.  I checked to insure poster targets TM4C - thus this is not a 129xx issue.

    As always appreciate your time, efforts & unique insider info.

    Cordialement,

  • Hello cb1,

    If the flash is erased and the debugger is connected, the System Control Space RCGC register will show some non 0 RCGC bits as left by the ROM Boot Loaders.

    If the flash is programmed with a while(1) loop and then power cycled, debugger connected the RCGCHIB will show up as 0x1.

    I meant to cater to both the scenario's without adding more if-else conditions.

    Regards

    Amit

  • Hi Amit,

    As some here (may) have said, "devil in the details..."  (never would my feeble mind have made that (bootload) connection.)  Merci beaucoup.

  • Hello cb1,

    That is the reason why sometimes one of the peripherals related to Boot Loader work when Flash is empty, but on the next run "seems" to give a Fault...

    Regards

    Amit

  • Hi Amit,

    Thanks for the reply.

    One more question, To achieve a true power saving , can we also put the TIVA into Sleep Mode.

    ROM_SysCtlSleep(void);

    and the RCGCGPIO register can be set before calling the Sleep API .

    I think, with this , we would be able to save more power .

    Regards,

    Sanchit Mehra

  • Hello Sanchit,

    Yes, that is possible. But a better method is to enable the Auto Clock Gating bit in the RSCLKCFG and program the SCGCGPIO bit as 0. This way when the device enters Sleep mode, the device will auto manage the clock gating. When the device is woken up the RCGCGPIO will restore the clock

    Regards

    Amit

  • Hello Amit,

    It would not be possible for me to put in deep sleep mode, since I require Ethernet to be working all the time.

    one interrupt on ethernet /phy /mac wakes the cpu from Sleep mode.

    So, I would require to bring down the power consumption without entering into the sleep mode via bringing the peripherals or GPIO pins into high impedance state such that they donot draw any current when not in use, thus saving the power.

    What I did to put all GPIO modules into disabled mode.

    HWREGBITW(0x400FE000 + 0x608,0) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,1) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,2) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,3) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,4) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,5) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,6) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,7) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,8) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,9) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,10) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,11) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,12) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,13) = 0 ;
    HWREGBITW(0x400FE000 + 0x608,14) = 0 ;

    where RCGCGPIO is

    Base 0x400F.E000
    Offset 0x608

    0th to 14th bit are RW and represents the GPIO A to GPIOQ .

    Is  there anything required to be done before and after the above settings ?

    As I observe there is not much significant power saving after doing the above procedure .

    Is my above way ;right method to set all RW bits of RCGCGPIO regsiter ?

    Thanks,

    Sanchit Mehra 

  • Hello Sanchit,

    Even I had mentioned Sleep Mode. In Sleep Mode the System Clock Configuration will be held as what was there in Run/Active Mode. By using SCGC registers, you can decide which peripherals will get clock and which will not and thereby reduce power consumption automatically in Sleep Mode. If the SCGC for Ethernet and PHY are set then it will continue to work as is in the Sleep Mode and interrupt will wake up the system.

    GPIO's would not yield much current savings. You need to first list out which peripherals are required and which are not for the System to work in Sleep Mode and then switch off using SCGC and Sleep Mode.

    Please note that the PHY is a big current consumption peripheral in TM4C129 devices. However you can power down flash if required.

    Regards

    Amit