Other Parts Discussed in Thread: EK-TM4C1294XL
I have modified TM4C1294 launchpad as so that I removed R39 so I can measure Vbat current consumption. As in related topic was shown, the datasheet shows that current consumption in idle mode should be around 1.3 uA. How ever I'm measuring 4.41 uA with Fluke 289 when MCU is powered of (JP2 removed).
I can't figure out where over 3 uA is vanishing. I checked the hibernation module register settings and I couldn't found out anything there.
I'm using the hibernation example project as base here. System works and seconds are running when MCU is powered off.
Here is the code (I couldn't insert it via insert tool for some access denied thing):
//*****************************************************************************
//
// This example demonstrates the different hibernate wake sources. The
// microcontroller is put into hibernation by the user and wakes up based on
// timeout or one of the user inputs. This example also demonstrates the RTC
// calendar function that keeps track of date and time.
//
//*****************************************************************************
int
main(void)
{
uint32_t ui32SysClock, ui32Status, ui32HibernateCount, ui32Len;
//
// Run from the PLL at 120 MHz.
// Note: SYSCTL_CFG_VCO_240 is a new setting provided in TivaWare 2.2.x and
// later to better reflect the actual VCO speed due to SYSCTL#22.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_240), 120000000);
//
// Configure the device pins.
//
PinoutSet(false, false);
//
// Enable UART0
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, ui32SysClock);
//
// Enable the hibernate module.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);
//
// Initialize these variables before they are used.
//
ui32Status = 0;
ui32HibernateCount = 0;
//
// Check to see if Hibernation module is already active, which could mean
// that the processor is waking from a hibernation.
//
if(HibernateIsActive())
{
//
// Read the status bits to see what caused the wake. Clear the wake
// source so that the device can be put into hibernation again.
//
ui32Status = HibernateIntStatus(0);
HibernateIntClear(ui32Status);
//
// Store the common part of the wake information message into a buffer.
// The wake source will be appended based on the status bits.
//
ui32Len = usnprintf(g_pcWakeBuf, sizeof(g_pcWakeBuf),
"Wake Due To : ");
//
// Wake was due to RTC match.
//
if(ui32Status & HIBERNATE_INT_RTC_MATCH_0)
{
ui32Len = usnprintf(&g_pcWakeBuf[ui32Len],
sizeof(g_pcWakeBuf) - ui32Len, "%s",
g_ppcWakeSource[0]);
}
//
// Wake was due to Reset button.
//
else if(ui32Status & HIBERNATE_INT_RESET_WAKE)
{
ui32Len = usnprintf(&g_pcWakeBuf[ui32Len],
sizeof(g_pcWakeBuf) - ui32Len, "%s",
g_ppcWakeSource[1]);
}
//
// Wake was due to the External Wake pin.
//
else if(ui32Status & HIBERNATE_INT_PIN_WAKE)
{
ui32Len = usnprintf(&g_pcWakeBuf[ui32Len],
sizeof(g_pcWakeBuf) - ui32Len, "%s",
g_ppcWakeSource[2]);
}
//
// Wake was due to GPIO wake.
//
else if(ui32Status & HIBERNATE_INT_GPIO_WAKE)
{
ui32Len = usnprintf(&g_pcWakeBuf[ui32Len],
sizeof(g_pcWakeBuf) - ui32Len, "%s",
g_ppcWakeSource[3]);
}
//
// If the wake is due to any of the configured wake sources, then read
// the first location from the battery-backed memory, as the
// hibernation count.
//
if(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE))
{
HibernateDataGet(&ui32HibernateCount, 1);
}
}
//
// Configure Hibernate module clock.
//
HibernateEnableExpClk(ui32SysClock);
//
// If the wake was not due to the above sources, then it was a system
// reset.
//
if(!(ui32Status & (HIBERNATE_INT_PIN_WAKE | HIBERNATE_INT_RTC_MATCH_0 |
HIBERNATE_INT_GPIO_WAKE | HIBERNATE_INT_RESET_WAKE)))
{
//
// Configure the module clock source.
//
HibernateClockConfig(HIBERNATE_OSC_LOWDRIVE);
//
// Store that this was a system restart not wake from hibernation.
//
ui32Len = usnprintf(g_pcWakeBuf, sizeof(g_pcWakeBuf), "%s",
g_ppcWakeSource[4]);
//
// Set flag to indicate we need a valid date. Date will then be set
// in the while(1) loop.
//
g_bSetDate = true;
}
UARTprintf("%s\n", g_pcWakeBuf);
UARTprintf("Welcome to the Tiva C Series TM4C1294 LaunchPad!\n");
UARTprintf("Hibernation Example\n");
UARTprintf("Type 'help' for a list of commands\n");
UARTprintf("> ");
UARTFlushTx(false);
//
// Configure the hibernate module counter to 24-hour calendar mode.
//
HibernateCounterMode(HIBERNATE_COUNTER_24HR);
//
// Enable RTC mode.
//
HibernateRTCEnable();
struct tm sTime;
HibernateCalendarGet(&sTime);
if (((sTime.tm_sec < 0) || (sTime.tm_sec > 59)) ||
((sTime.tm_min < 0) || (sTime.tm_min > 59)) ||
((sTime.tm_hour < 0) || (sTime.tm_hour > 23)) ||
((sTime.tm_mday < 1) || (sTime.tm_mday > 31)) ||
((sTime.tm_mon < 0) || (sTime.tm_mon > 11)) ||
((sTime.tm_year < 100) || (sTime.tm_year > 199)))
{
UARTprintf("calendar error:\n");
UARTprintf("sec: %i\n", sTime.tm_sec);
UARTprintf("min: %i\n", sTime.tm_min);
UARTprintf("hour: %i\n", sTime.tm_hour);
UARTprintf("mday: %i\n", sTime.tm_mday);
UARTprintf("mon: %i\n", sTime.tm_mon);
UARTprintf("year: %i\n", sTime.tm_year);
UARTprintf("date set to 1.1.2020 - 00:00:00\n");
sTime.tm_sec = 0;
sTime.tm_min = 0;
sTime.tm_hour = 0;
sTime.tm_mday = 1; // month day 1-31
sTime.tm_min = 0; // months since january
sTime.tm_year = 120; // year since 1900
}
uint32_t prev_clk_seconds = sTime.tm_sec;
while (1)
{
HibernateCalendarGet(&sTime);
if (sTime.tm_sec != prev_clk_seconds)
{
UARTprintf("%02u.%02u.20%02u ", sTime.tm_mday, sTime.tm_mon, sTime.tm_year - 100);
UARTprintf("%02u : %02u : %02u\n\n", sTime.tm_hour, sTime.tm_min, sTime.tm_sec);
prev_clk_seconds = sTime.tm_sec;
}
}
}