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.
工具/软件:Code Composer Studio
你(们)好
我正在尝试检查我的板是否进入休眠模块。 我使用 的是 TM4C123G LaunchPad、通过使用 sw1、我设法将其配置为进入休眠模式、这是我所做的软启动。
void ConfigureUART (void) { // //启用 UART 使用的 GPIO 外设。 // ROM_SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA); // //启用 UART0 // ROM_SysCtlPeripheralEnable (SYSCTL_Periph_UART0); // //为 UART 模式配置 GPIO 引脚。 // ROM_GPIOPinConfigure (GPIO_PA0_U0RX); ROM_GPIOPinConfigure (GPIO_PA1_U0TX); ROM_GPIOPinTypeUART (GPIO_Porta_base、GPIO_PIN_0 | GPIO_PIN_1); // //使用内部16MHz 振荡器作为 UART 时钟源。 // UARTClockSourceSet (UART0_BASE、UART_CLOCK_PIOSC); // //初始化控制台 I/O 的 UART // UARTStdioConfig (0、115200、16000000); } //********* // //按钮的中断处理程序。 //// ***************** void BottonHandler (void){ if ((GPIOIntStatus (GPIO_PORTF_BASE、TRUE)& Buttoninit1)) { GPIOIntClear (GPIO_PORTF_BASE、Buttoninit1);//清除中断标志 TimerEnable (TIMER0_BASE、TIMER_A);//启用计时器 } 否则 if (((GPIOIntStatus (GPIO_PORTF_BASE、TRUE)& Buttoninit0)) { GPIOIntClear (GPIO_PORTF_BASE、Buttoninit0);//清除中断标志 TimerDisable (TIMER0_BASE、TIMER_A);//禁用计时器 SysCtlPeripheralDisable (SYSCTL_Periph_HIBERNATE);//禁用休眠模块 HibernateGPIORetentionDisable ();//禁用 GPIO 保持 HibernateDisable();//disable the Hibernation module for operation. } } void configureButtons(void){ //configureButton0 GPIOPinTypeGPIOInput (ButtonBase、Button0); GPIOPadConfigSet (ButtonBase、Button0、GPIO_Strength _2mA、GPIO_PIN_TYPE_STD_WPU);//注册端口 F 的处理程序函数 GPIOIntTypeSet (GPIO_PORTF_BASE、GPIO_PIN_0、GPIO_FALLING_EDGE);//为下降沿触发配置 PF4 GPIOIntRegister (GPIO_PORTF_BASE、BottonHandler);//为端口 F 注册处理程序函数 GPIOIntEnable (GPIO_PORTF_BASE、GPIO_INT_PIN_0);//为 PF0启用中断 // configureButton1 GPIOPinTypeGPIOInput (ButtonBase、Button1); GPIOPadConfigSet (ButtonBase、Button1、GPIO_Strength _2mA、GPIO_PIN_TYPE_STD_WPU);//注册端口 F 的处理程序函数 GPIOIntTypeSet (GPIO_PORTF_BASE、GPIO_PIN_4、GPIO_FALLING_EDGE);//为下降沿触发配置 PF4 GPIOIntRegister (GPIO_PORTF_BASE、BottonHandler);//为端口 F 注册处理程序函数 GPIOIntEnable (GPIO_PORTF_BASE、GPIO_INT_PIN_4);//为 PF4启用中断 } void Timer0IntHandler (void) { // 清除计时器中断。 // TimerIntClear (TIMER0_BASE、TIMER_TINA_TIMEOUT); UARTprintf ("休眠模式开启!\n"); SysCtlPeripheralEnable (SYSCTL_PERIPH_HIBER休眠);//启用休眠模块 HibernateEnnatExpClk (SysCtlClockGet ();// 启用休眠模块的休眠状态;//启用休眠模块。 SysCtlDelay (SysCtlClockGet ()/10); HibernateWakeSet (HIBERNATE_WAKE_PIN);//将唤醒条件设置为唤醒引脚 SysCtlDelay (SysCtlClockGet ()/10); //GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_3、0);//在器件进入绿色睡眠模式之前关闭 LED。 /*function requests the Hibernation module to disable the external regulator,removal power from the processor and all peripheral.*/ HibernateRequest(); }//********* // //打印"Hello World!" 连接到评估板上的 UART。 //// ***************** int main (void) { //volatile uint32_t ui32Loop; // //为中断处理程序启用怠惰堆栈。 这允许使用浮点 //在中断处理程序中使用的指令,但代价是 //额外的堆栈用法。 // //rom_FULazyStackingEnable(); // //将时钟设置为直接从晶体运行。 // ROM_SysCtlClockSet (SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHz | SYSCTL_OSC_MAIN); // //启用用于板载 LED 的 GPIO 端口。 // ROM_SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF); // //为 LED 启用 GPIO 引脚(PF2 & PF3)。 // ROM_GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE、GPIO_PIN_1_GPIO_PIN_2|GPIO_PIN_3); // //启用此示例使用的外设。 // ROM_SysCtlPeripheralEnable (SYSCTL_Periph_TIMER0); // //为计时器中断注册中断处理程序。 // TimerIntRegister (TIMER0_BASE、TIMER_A、Timer0IntHandler); // //启用处理器中断。 // ROM_IntMasterEnable(); // //配置两个32位周期定时器。 // ROM_TimerConfigure (TIMER0_BASE、TIMER_CFG_PERIODICASE); ROM_TimerLoadSet (TIMER0_BASE、TIMER_A、ROM_SysCtlClockGet ()); // //设置计时器超时的中断。 // ROM_IntEnable (INT_TIMER0A); ROM_TimerIntEnable (TIMER0_BASE、TIMER_TINA_TIMEOUT); // //初始化 UART。 // ConfigureUART(); // //初始化按钮。 // configureButtons(); // //您好! // UARTprintf ("Hello、world!\n"); SysCtlDelay (SysCtlClockGet ()); while (1) { UARTprintf ("运行模式已打开!\n"); SysCtlDelay (SysCtlClockGet ()); GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_3、GPIO_PIN_3); SysCtlDelay (SysCtlClockGet ()/10); GPIOPinWrite (GPIO_PORTF_BASE、GPIO_PIN_3、0); SysCtlDelay (SysCtlClockGet ()/10); } }
我所做的是、我从午餐板上移除跳线、并尝试在不同模式下测量电流、但 DMM 在不同模式下不显示任何差异。
因此、如果您知道如何使用某些命令和终端检查电路板是否进入休眠状态、我将表示感谢。
谢谢你。
此致
艾米。
您是否注意到-并采取适当措施确保:
您的仪表读数为0.02表示-我相信-要么是"设置为"太高"的刻度"、要么是(非常)基本仪表
休眠软件函数应该(非常)包含在、"外设驱动程序库用户指南"中、并且可能包含在多个 API 示例 中(找到示例\外设\休眠 (也许) 我不确定休眠是否"包含示例"。