I am using MCU Tiva TM4C1294NCPDT. I would like to know how to put MCU in sleep mode and set up UART as a wake up source. Thankyou
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.
I am using MCU Tiva TM4C1294NCPDT. I would like to know how to put MCU in sleep mode and set up UART as a wake up source. Thankyou
Hi Amit,
I saw the code in github. It isnt very clear to me. Could you give me an example of getting into sleep mode by giving UART as a wake up source
Hi Amit,
I tried what you said but in vain. Let me paste my code again.
/******************************.FUNCTION_HEADER.******************************
.Purpose : Sets System power mode to battery mode
.Returns : None
.Note : None
******************************************************************************/
uint8_t Set_Battery_Mode(
void)
{
uint8_t wifi_ret;
bool benable;
/*Enable UART7 in sleep mode*/
SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART7);
UARTClockSourceSet(UART7_BASE, UART_CLOCK_PIOSC);
/*Sleep mode clocking for UART is enabled */
/*To set wake up source*/
benable = IntMasterEnable();
/*Enable interrupts to the processor*/
if(0u == benable)
{
System_printf(
"interrupts to the processor not enabled\r\n");
System_flush();
}
IntRegister(INT_UART7, UART7Handler);
/*Registers a function to be called when an interrupt ocurs*/
IntPrioritySet(INT_UART7, 0);
/*Set the UART 7 interrupt priority to the highest priority*/
IntEnable(INT_UART7);
/* Enables UART7 as an interrupt in the interrupt controller*/
UARTIntEnable(UART7_BASE, UART_INT_RX);
/* Rx has been set up as an interrupt source*/
wifi_ret = WiFi_OFF();
if(0 == wifi_ret)
{
System_printf(
"\nWiFi OFF Success...\r\n");
System_flush();
}
else
{
System_printf(
"\nWiFi OFF failed....\r\n");
System_flush();
}
SysCtlSleep();
gu8_current_mode = BATTERY_MODE;
return gu8_current_mode;
}
/******************************.FUNCTION_HEADER.******************************
.Purpose : When an interrupt occurs, the handler runs
.Returns : Returns system status
.Note : None
******************************************************************************/
void
UART7Handler(void)
{
//Set_Normal_Mode();
}
Kindly help.
Hi Amit,
I tried without the debugger connected. I still did not find any reduction in current.
Regards,
Anjana
Hi Amit,
I created a setup comprising of 2 UARTs, 6 and 7. Data is read from UART7 and through UART6, data is written. UART7 is the wakeup source.
After executing the below code, UART7 becomes non - functional, which means UART 7 peripeheral goes into sleep, where as UART 7 should be the wake up source. How do I put the entire system into sleep with only UART7 as the wake up source?
/*Enable UART7 in sleep mode*/
SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_UART7);
/*Sleep mode clocking for UART is enabled */
UARTClockSourceSet(UART7_BASE, UART_CLOCK_PIOSC);
/*To set wake up source*/
benable = IntMasterEnable();
/*Enable interrupts to the processor*/
if(0u == benable)
{
System_printf(
"interrupts to the processor not enabled\r\n");
System_flush();
}
/*Registers a function to be called when an interrupt ocurs*/
IntRegister(INT_UART7, UART7Handler);
/*Set the UART 7 interrupt priority to the highest priority*/
IntPrioritySet(INT_UART7, 0);
/* Enables UART7 as an interrupt in the interrupt controller*/
IntEnable(INT_UART7);
/* Rx has been set up as an interrupt source*/
UARTIntEnable(UART7_BASE, UART_INT_RX);
/*System goes to sleep mode*/
SysCtlSleep();
Regards,
Anjana
Hi Amit,
I havent response from you or anyone yet. It is a bit important as well as urgent.
Thankyou.
Regards,
Anjana
Hi Amit,
CPU transmits only in the normal mode, which is through UART6. In sleep mode, it is supposed to wake up on reception, which is through UART7.
I have sent you a snippet of the code, where I am putting system in sleep mode. Can you guide me with that code?Or give any suggestions on the same.
Thankyou,
Regards,
Anjana
Hello Anjana
Attached is a code for UART7 Sleep Mode entry and exit. I have used a EK-TM4C1294XL and removed the shunt jumper JP5 and JP4 and wired the ICDI TX and RX to UART7 RX and TX.
On every key press the LED will glow and go off alternatively. Between 2 key press the device will remain in Sleep Mode.
Regards
Amit