主题中讨论的其他器件: UNIFLASH、 TM4C1292NCPDT
您好!
我们拥有带 TM4C129XNCZAD 微控制器的定制电路板、支持超级电容器。
软件:TI-RTOS、TI-ARM 编译器5.2.5
每当断电时、我们都会将电路板的上下文保存到内部 EEPROM 中。 之后、我们 打算将微控制器置于深度睡眠模式、以便减少超级电容器放电。 我们将 PK6用作唤醒信号的 GPIO 引脚。 我们有5个任务正在运行
深度睡眠初始化代码如下所示
//
//启用自动时钟门控控制。
//
SysCtlPeripheralClockGating (真);
SysCtlPeripheralDeepSlepEnable (SYSCTL_Periph_GPIOK);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_ADC0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_ADC1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_CAN0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_CAN1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_COMP0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_EMAC0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_EPHY0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_EPI0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOA);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOB);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOC);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOD);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOE);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOF);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOG);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOH);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOJ);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_HIBERNATE);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_CCM0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_EEPROM0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_FAN0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_FAN1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOL);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOM);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPION);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOP);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOQ);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOR);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIO);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_GPIOT);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C2);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C3);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C4);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C5);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C6);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C7);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C8);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_I2C9);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_LCD0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_ONEWIRE0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_PWM0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_PWM1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_QEI0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_QEI1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_SSI0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_SSI1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_SSI2);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_SSI3);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_Timer1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER2);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER3);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER4);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER5);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER6);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_TIMER7);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART1);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART2);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART3);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART4);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART5);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART6);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UART7);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_UDMA);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_USB0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_WDOG0);
SysCtlPeripheralDeepSlepDisable (SYSCTL_Periph_WDOG1);
//
//设置深度睡眠的时钟。
//关闭 PIOSC 和 MOSC 以节省功耗并从运行
//内部30kHz 振荡器
//
SysCtlDeepSlepClockConfigSet (63、(SYSCTL_DSLP_OSC_INT30 |
SYSCTL_DSLP_PIOSC_PD | SYSCTL_DSLP_MOSC_PD);
//
//在睡眠模式中将 SRAM 设置为低功耗。
//
//
SysCtlDeepSleep PowerSet (SYSCTL_LDO_SLEEP|SYSCTL_TEMP_LOW_POWER|SYSCTL_FLASH_LOW_POWER|SYSCTL_SRAM_LOW_POWER);
//
//在睡眠模式下将 LDO 设置为0.90V。
//
//
SysCtlLDODeepSlepSet (SYSCTL_LDO_0_90V);
我们在发生电源故障时获得中断。 ISR 发布事件。 在保存上下文数据之后。
以下代码称为微控制器休眠
//
//进入睡眠模式。
//
//SysCtlDeepSleep ();
在微控制器上测量的电流消耗从120mA 降低到大约55mA。 数据表显示它应该远低于20mA。 我的所有初始化是否都正确? 我是否必须采取任何措施来降低电流消耗。 我还看到 微控制器被锁定。 两次我都必须使用 Uniflash 来解锁微控制器。
TIA
Narendra