主题中讨论的其他器件:TM4C123
您好!
我们有一个项目、其中具有 TM4C123的电路板一直处于通电状态。 为了避免耗尽电池电量、策略是将其降至深度睡眠模式(它不会真正执行任何操作、只需在特定 GPIO 中通过脉冲唤醒它)。 它不是休眠、因为唤醒脉冲未路由到方便的休眠 GPIO、因此深度睡眠是我们可以达到的最佳状态。 当系统从休眠状态中唤醒时、它只是复位、以便我们拥有完全新鲜的状态。
它运行得很好、几乎总是... 然而、即使脉冲信号在那里是确认的、电路板偶尔也不会被唤醒。
我们确实查看了一些有关勘误表 HIB#01的帖子、并尝试从这些帖子中添加一些代码、但老实说、我并不完全理解建议的解决方案、足够的代码、我甚至不确定原因是所述的勘误问题。
/* * Puts the system in DeepSleep mode * This function will only exit when an interrupt caused by EXP_GPIO_PIN is triggered */ void TaskSystemDeepSleep(void) { /* Now enable the interrupt for the wake up pin */ GPIOIntRegister(EXP_GPIO_BASE, TaskDeepSleepISR); GPIOIntTypeSet(EXP_GPIO_BASE, EXP_GPIO_PIN, GPIO_RISING_EDGE); IntEnable(EXP_GPIO_INT); GPIOIntClear(EXP_GPIO_BASE, 0xFF); GPIOIntEnable(EXP_GPIO_BASE, EXP_GPIO_PIN); /* Disabled Peripherals */ SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_ADC0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_ADC1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_CAN0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_CAN1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_COMP0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_EMAC0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_EPHY0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_EPI0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOB); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOC); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOD); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOG); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOH); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOJ); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_HIBERNATE); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_CCM0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_EEPROM0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_FAN0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_FAN1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOK); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOL); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOM); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPION); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOP); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOQ); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOR); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOS); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_GPIOT); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C2); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C3); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C4); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C5); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C6); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C7); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C8); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_I2C9); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_LCD0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_ONEWIRE0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_PWM0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_PWM1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_QEI0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_QEI1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_SSI0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_SSI1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_SSI2); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_SSI3); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER2); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER3); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER4); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER5); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER6); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_TIMER7); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART2); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART3); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART4); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART5); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART6); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UART7); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_UDMA); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_USB0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WDOG0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WDOG1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER0); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER1); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER2); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER3); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER4); SysCtlPeripheralDeepSleepDisable(SYSCTL_PERIPH_WTIMER5); /* Enabled Peripherals */ SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOA); // Should not be needed but just in case... SysCtlPeripheralDeepSleepEnable(SYSCTL_PERIPH_GPIOA); /* * There is a HW bug regarding deep sleep. See these posts: * e2e.ti.com/.../tm4c123ge6pm-tm4c123gxl-deep-sleep-mode-issue * e2e.ti.com/.../964156 */ /* DeepSleep configurations */ SysCtlPeripheralClockGating(true); /* Function below is for TM4C123 devices */ SysCtlDeepSleepClockSet(SYSCTL_DSLP_DIV_1 | SYSCTL_DSLP_OSC_INT30 | SYSCTL_DSLP_PIOSC_PD); /* Function below is for TM4C129 devices */ // SysCtlDeepSleepClockConfigSet(1, (SYSCTL_LDO_SLEEP|SYSCTL_TEMP_LOW_POWER|SYSCTL_FLASH_LOW_POWER|SYSCTL_SRAM_LOW_POWER)); SysCtlDeepSleepPowerSet(SYSCTL_LDO_SLEEP|SYSCTL_TEMP_LOW_POWER|SYSCTL_FLASH_LOW_POWER|SYSCTL_SRAM_LOW_POWER); SysCtlLDODeepSleepSet(SYSCTL_LDO_0_90V); // Select LDO to Scale to 0.9V in Deep Sleep while (!canWakeUp) { HWREG(HIB_CTL) |= HIB_CTL_CLK32EN | HIB_CTL_OSCDRV; SysCtlDelay(SYSTEM_CLOCK_HZ/2); // Wait for 1500 ms HibernateRTCSet (0); HibernateRTCTrimSet (0x7FFF); SysCtlDeepSleep(); } /* Code will never come here unless the interrupt was caused by EXP_GPIO_PIN */ HWREG(NVIC_APINT) = (NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ); }
以上 是配置和启动深度睡眠的函数。
/* * Specific ISR for deep sleep mode, makes sure that only the EXP_GPIO pin wakes the board up */ void TaskDeepSleepISR(void) { uint32_t intFlags; intFlags = GPIOIntStatus(EXP_GPIO_BASE, false); // false means we are concerned about unmasked interrupts GPIOIntClear(EXP_GPIO_BASE, intFlags); if (intFlags & EXP_GPIO_PIN) { canWakeUp = true; } }
然后、我们有相关的 ISR。 想法是让 GPIO 触发中断、将系统唤醒到 ISR 中、检查原因是否为预期引脚、并设置 canWakeUp、这将重置主控代码。
有什么关于如何调试和解决此问题的想法吗?
谢谢
布鲁诺