查看: 3460|回复: 6

[求助] 请教下前辈们SDK的Power Library怎么使用?

[复制链接]
  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
    发表于 2020-9-23 11:33:48 | 显示全部楼层 |阅读模式
    10NXP金币
    RT,直接使用SDK中给的 POWER_EnterDeepPowerDown函数 电流在20多ma跳动,使用RTC闹钟定时到了以后也能复位启动,就是这个电流对不上。看了下demo进入低功耗也就直接调用这个函数,所以想请教下前辈们是还需要进行其他什么的操作吗

    哎...今天够累的,签到来了~
    回复

    使用道具 举报

  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
     楼主| 发表于 2020-9-23 11:34:29 | 显示全部楼层
    1. /*
    2. * The Clear BSD License
    3. * Copyright (c) 2016, Freescale Semiconductor, Inc.
    4. * Copyright (c) 2016, NXP
    5. * All rights reserved.
    6. *
    7. *
    8. * Redistribution and use in source and binary forms, with or without modification,
    9. * are permitted (subject to the limitations in the disclaimer below) provided
    10. * that the following conditions are met:
    11. *
    12. * o Redistributions of source code must retain the above copyright notice, this list
    13. *   of conditions and the following disclaimer.
    14. *
    15. * o Redistributions in binary form must reproduce the above copyright notice, this
    16. *   list of conditions and the following disclaimer in the documentation and/or
    17. *   other materials provided with the distribution.
    18. *
    19. * o Neither the name of copyright holder nor the names of its
    20. *   contributors may be used to endorse or promote products derived from this
    21. *   software without specific prior written permission.
    22. *
    23. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
    24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    25. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    26. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
    28. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    29. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    30. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    31. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    32. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    33. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    34. */
    35. #ifndef _FSL_POWER_H_
    36. #define _FSL_POWER_H_

    37. #include "fsl_common.h"

    38. /*******************************************************************************
    39. * Definitions
    40. ******************************************************************************/

    41. /*! @name Driver version */
    42. /*@{*/
    43. /*! @brief power driver version 2.0.0. */
    44. #define FSL_POWER_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
    45. /*@}*/

    46. #define MAKE_PD_BITS(reg, slot) (((reg) << 8) | (slot))
    47. #define PDRCFG0 0x0U
    48. #define PDRCFG1 0x1U

    49. typedef enum pd_bits
    50. {
    51.     kPDRUNCFG_LP_REG = MAKE_PD_BITS(PDRCFG0, 2U),
    52.     kPDRUNCFG_PD_FRO_EN = MAKE_PD_BITS(PDRCFG0, 4U),
    53.     kPDRUNCFG_PD_TS = MAKE_PD_BITS(PDRCFG0, 6U),
    54.     kPDRUNCFG_PD_BOD_RESET = MAKE_PD_BITS(PDRCFG0, 7U),
    55.     kPDRUNCFG_PD_BOD_INTR = MAKE_PD_BITS(PDRCFG0, 8U),
    56.     kPDRUNCFG_PD_VD2_ANA = MAKE_PD_BITS(PDRCFG0, 9U),
    57.     kPDRUNCFG_PD_ADC0 = MAKE_PD_BITS(PDRCFG0, 10U),
    58.     kPDRUNCFG_PD_RAM0 = MAKE_PD_BITS(PDRCFG0, 13U),
    59.     kPDRUNCFG_PD_RAM1 = MAKE_PD_BITS(PDRCFG0, 14U),
    60.     kPDRUNCFG_PD_RAM2 = MAKE_PD_BITS(PDRCFG0, 15U),
    61.     kPDRUNCFG_PD_RAM3 = MAKE_PD_BITS(PDRCFG0, 16U),
    62.     kPDRUNCFG_PD_ROM = MAKE_PD_BITS(PDRCFG0, 17U),
    63.     kPDRUNCFG_PD_VDDA = MAKE_PD_BITS(PDRCFG0, 19U),
    64.     kPDRUNCFG_PD_WDT_OSC = MAKE_PD_BITS(PDRCFG0, 20U),
    65.     kPDRUNCFG_PD_USB0_PHY = MAKE_PD_BITS(PDRCFG0, 21U),
    66.     kPDRUNCFG_PD_SYS_PLL0 = MAKE_PD_BITS(PDRCFG0, 22U),
    67.     kPDRUNCFG_PD_VREFP = MAKE_PD_BITS(PDRCFG0, 23U),
    68.     kPDRUNCFG_PD_FLASH_BG = MAKE_PD_BITS(PDRCFG0, 25U),
    69.     kPDRUNCFG_PD_VD3 = MAKE_PD_BITS(PDRCFG0, 26U),
    70.     kPDRUNCFG_PD_VD4 = MAKE_PD_BITS(PDRCFG0, 27U),
    71.     kPDRUNCFG_PD_VD5 = MAKE_PD_BITS(PDRCFG0, 28U),
    72.     kPDRUNCFG_PD_VD6 = MAKE_PD_BITS(PDRCFG0, 29U),
    73.     kPDRUNCFG_REQ_DELAY = MAKE_PD_BITS(PDRCFG0, 30U),
    74.     kPDRUNCFG_FORCE_RBB = MAKE_PD_BITS(PDRCFG0, 31U),

    75.     kPDRUNCFG_PD_USB1_PHY = MAKE_PD_BITS(PDRCFG1, 0U),
    76.     kPDRUNCFG_PD_USB_PLL = MAKE_PD_BITS(PDRCFG1, 1U),
    77.     kPDRUNCFG_PD_AUDIO_PLL = MAKE_PD_BITS(PDRCFG1, 2U),
    78.     kPDRUNCFG_PD_SYS_OSC = MAKE_PD_BITS(PDRCFG1, 3U),
    79.     kPDRUNCFG_PD_EEPROM = MAKE_PD_BITS(PDRCFG1, 5U),
    80.     kPDRUNCFG_PD_rng = MAKE_PD_BITS(PDRCFG1, 6U),

    81.     /*
    82.     This enum member has no practical meaning,it is used to avoid MISRA issue,
    83.     user should not trying to use it.
    84.     */
    85.     kPDRUNCFG_ForceUnsigned = 0x80000000U,
    86. } pd_bit_t;

    87. /* Power mode configuration API parameter */
    88. typedef enum _power_mode_config
    89. {
    90.     kPmu_Sleep = 0U,
    91.     kPmu_Deep_Sleep = 1U,
    92.     kPmu_Deep_PowerDown = 2U,
    93. } power_mode_cfg_t;

    94. /*******************************************************************************
    95. * API
    96. ******************************************************************************/

    97. #ifdef __cplusplus
    98. extern "C" {
    99. #endif

    100. /*!
    101. * @name Power Configuration
    102. * @{
    103. */

    104. /*!
    105. * @brief API to enable PDRUNCFG bit in the Syscon. Note that enabling the bit powers down the peripheral
    106. *
    107. * @param en    peripheral for which to enable the PDRUNCFG bit
    108. * @return none
    109. */
    110. static inline void POWER_EnablePD(pd_bit_t en)
    111. {
    112.     /* PDRUNCFGSET */
    113.     SYSCON->PDRUNCFGSET[(en >> 8UL)] = (1UL << (en & 0xffU));
    114. }

    115. /*!
    116. * @brief API to disable PDRUNCFG bit in the Syscon. Note that disabling the bit powers up the peripheral
    117. *
    118. * @param en    peripheral for which to disable the PDRUNCFG bit
    119. * @return none
    120. */
    121. static inline void POWER_DisablePD(pd_bit_t en)
    122. {
    123.     /* PDRUNCFGCLR */
    124.     SYSCON->PDRUNCFGCLR[(en >> 8UL)] = (1UL << (en & 0xffU));
    125. }

    126. /*!
    127. * @brief API to enable deep sleep bit in the ARM Core.
    128. *
    129. * @param none
    130. * @return none
    131. */
    132. static inline void POWER_EnableDeepSleep(void)
    133. {
    134.     SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
    135. }

    136. /*!
    137. * @brief API to disable deep sleep bit in the ARM Core.
    138. *
    139. * @param none
    140. * @return none
    141. */
    142. static inline void POWER_DisableDeepSleep(void)
    143. {
    144.     SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
    145. }

    146. /*!
    147. * @brief API to power down flash controller.
    148. *
    149. * @param none
    150. * @return none
    151. */
    152. static inline void POWER_PowerDownFlash(void)
    153. {
    154.     /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */
    155.     CLOCK_DisableClock(kCLOCK_Flash);

    156.     /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */
    157.     CLOCK_DisableClock(kCLOCK_Fmc);
    158. }

    159. /*!
    160. * @brief API to power up flash controller.
    161. *
    162. * @param none
    163. * @return none
    164. */
    165. static inline void POWER_PowerUpFlash(void)
    166. {
    167.     /* TURN OFF clock ip_2113 (only needed for FLASH programming, will be turned on by ROM API) */
    168.     CLOCK_EnableClock(kCLOCK_Fmc);
    169. }

    170. /*!
    171. * @brief Power Library API to power the PLLs.
    172. *
    173. * @param none
    174. * @return none
    175. */
    176. void POWER_SetPLL(void);

    177. /*!
    178. * @brief Power Library API to power the USB PHY.
    179. *
    180. * @param none
    181. * @return none
    182. */
    183. void POWER_SetUsbPhy(void);

    184. /*!
    185. * @brief Power Library API to enter different power mode.
    186. *
    187. * @param exclude_from_pd  Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on
    188. * during power mode selected.
    189. * @return none
    190. */
    191. void POWER_EnterPowerMode(power_mode_cfg_t mode, uint64_t exclude_from_pd);

    192. /*!
    193. * @brief Power Library API to enter sleep mode.
    194. *
    195. * @return none
    196. */
    197. void POWER_EnterSleep(void);

    198. /*!
    199. * @brief Power Library API to enter deep sleep mode.
    200. *
    201. * @param exclude_from_pd  Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) bits that needs to be
    202. * powered on during deep sleep
    203. * @return none
    204. */
    205. void POWER_EnterDeepSleep(uint64_t exclude_from_pd);

    206. /*!
    207. * @brief Power Library API to enter deep power down mode.
    208. *
    209. * @param exclude_from_pd   Bit mask of the PDRUNCFG0(low 32bits) and PDRUNCFG1(high 32bits) that needs to be powered on
    210. during deep power
    211. *                          down mode, but this is has no effect as the voltages are cut off.

    212. * @return none
    213. */
    214. void POWER_EnterDeepPowerDown(uint64_t exclude_from_pd);

    215. /*!
    216. * @brief Power Library API to choose normal regulation and set the voltage for the desired operating frequency.
    217. *
    218. * @param freq  - The desired frequency at which the part would like to operate,
    219. *                note that the voltage and flash wait states should be set before changing frequency
    220. * @return none
    221. */
    222. void POWER_SetVoltageForFreq(uint32_t freq);

    223. /*!
    224. * @brief Power Library API to return the library version.
    225. *
    226. * @param none
    227. * @return version number of the power library
    228. */
    229. uint32_t POWER_GetLibVersion(void);

    230. #ifdef __cplusplus
    231. }
    232. #endif

    233. #endif /* _FSL_POWER_H_ */
    复制代码
    哎...今天够累的,签到来了~
    回复

    使用道具 举报

  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
     楼主| 发表于 2020-9-23 11:41:42 | 显示全部楼层
    是不是使用了freertos后,低功耗处理得用freertos的库函数?
    哎...今天够累的,签到来了~
    回复

    使用道具 举报

  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
     楼主| 发表于 2020-9-23 14:19:31 | 显示全部楼层
    防尘
    哎...今天够累的,签到来了~
    回复

    使用道具 举报

    该用户从未签到

    712

    主题

    6371

    帖子

    0

    超级版主

    Rank: 8Rank: 8

    积分
    24891
    最后登录
    2025-7-21
    发表于 2020-9-23 16:15:38 | 显示全部楼层
    可以参考一下测量低功耗电流这篇文章:

    https://www.nxpic.org.cn/module/ ... p;extra=#pid2550095
    回复

    使用道具 举报

  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
     楼主| 发表于 2020-9-24 09:28:28 | 显示全部楼层
    小恩GG 发表于 2020-9-23 16:15
    可以参考一下测量低功耗电流这篇文章:

    https://www.nxpic.org.cn/module/forum/forum.php?mod=viewthread ...

    前辈你好,我看了下你写的这个基于LPC845的帖子也下了SDK看了下,比对了一下LPC845和LPC54606的demo,我发现在LPC54606的demo中没有DEMO_PreEnterLowPower()这个函数,也就是说demo里面没讲在进入低功耗之前要手动断掉一些时钟。所以想问下power库中像POWER_EnterPowerDown()这种函数是没有做自动关闭时钟的处理吗?
    SDK_2.4.1_LPC54606J512
    1. /*
    2. * The Clear BSD License
    3. * Copyright (c) 2016, Freescale Semiconductor, Inc.
    4. * Copyright 2016-2017 NXP
    5. * All rights reserved.
    6. *
    7. * Redistribution and use in source and binary forms, with or without modification,
    8. * are permitted (subject to the limitations in the disclaimer below) provided
    9. *  that the following conditions are met:
    10. *
    11. * o Redistributions of source code must retain the above copyright notice, this list
    12. *   of conditions and the following disclaimer.
    13. *
    14. * o Redistributions in binary form must reproduce the above copyright notice, this
    15. *   list of conditions and the following disclaimer in the documentation and/or
    16. *   other materials provided with the distribution.
    17. *
    18. * o Neither the name of the copyright holder nor the names of its
    19. *   contributors may be used to endorse or promote products derived from this
    20. *   software without specific prior written permission.
    21. *
    22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
    23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
    24. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    25. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
    27. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    28. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    29. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    30. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    31. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    33. */

    34. #include "fsl_debug_console.h"
    35. #include "board.h"
    36. #include "fsl_common.h"
    37. #include "fsl_power.h"
    38. #include "fsl_inputmux.h"
    39. #include "fsl_pint.h"
    40. #include "fsl_usart.h"

    41. #include "pin_mux.h"
    42. #include <stdbool.h>
    43. /*******************************************************************************
    44. * Definitions
    45. ******************************************************************************/

    46. #define APP_USART_RX_ERROR kUSART_RxError
    47. #define APP_RUNNING_INTERNAL_CLOCK BOARD_BootClockFRO12M()
    48. #define APP_USER_WAKEUP_KEY_NAME "SW5"
    49. #define APP_USER_WAKEUP_KEY_GPIO BOARD_SW5_GPIO
    50. #define APP_USER_WAKEUP_KEY_PORT BOARD_SW5_GPIO_PORT
    51. #define APP_USER_WAKEUP_KEY_PIN BOARD_SW5_GPIO_PIN
    52. #define APP_USER_WAKEUP_KEY_INPUTMUX_SEL kINPUTMUX_GpioPort1Pin1ToPintsel

    53. #define APP_EXCLUDE_FROM_SLEEP \
    54.     (SYSCON_PDRUNCFG_PDEN_SRAMX_MASK | SYSCON_PDRUNCFG_PDEN_SRAM0_MASK | SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_MASK)

    55. #define APP_EXCLUDE_FROM_DEEPSLEEP \
    56.     (SYSCON_PDRUNCFG_PDEN_SRAMX_MASK | SYSCON_PDRUNCFG_PDEN_SRAM0_MASK | SYSCON_PDRUNCFG_PDEN_SRAM1_2_3_MASK)

    57. #define APP_SYSCON_STARTER_MASK SYSCON_STARTER_PIN_INT0_MASK

    58. const char *gWakeupInfoStr[] = {"Sleep [Press the user key to wakeup]", "Deep Sleep [Press the user key to wakeup]",
    59.                                 "Deep Powerdown [Reset to wakeup]", "Deep Powerdown [Reset to wakeup]"};
    60. uint32_t gCurrentPowerMode;

    61. /*******************************************************************************
    62. * Prototypes
    63. ******************************************************************************/
    64. static uint32_t APP_GetUserSelection(void);
    65. static void APP_InitWakeupPin(void);
    66. static void pint_intr_callback(pint_pin_int_t pintr, uint32_t pmatch_status);

    67. /*******************************************************************************
    68. * Code
    69. ******************************************************************************/

    70. /*!
    71. * @brief Main function
    72. */
    73. int main(void)
    74. {
    75.     /* Init board hardware. */
    76.     CLOCK_EnableClock(kCLOCK_Gpio1); /* Enable the clock for GPIO1. */

    77.     /* attach 12 MHz clock to FLEXCOMM0 (debug console) */
    78.     CLOCK_AttachClk(BOARD_DEBUG_UART_CLK_ATTACH);

    79.     BOARD_InitPins();
    80.     BOARD_BootClockFROHF48M();
    81.     BOARD_InitDebugConsole();

    82.     /* Running 12 MHz to Core*/
    83.     APP_RUNNING_INTERNAL_CLOCK;

    84.     /* Attach Main Clock as CLKOUT */
    85.     CLOCK_AttachClk(kMAIN_CLK_to_CLKOUT);

    86.     APP_InitWakeupPin();

    87.     PRINTF("Power Manager Demo for LPC device.\r\n");
    88.     PRINTF("The "user key" is: %s\r\n", APP_USER_WAKEUP_KEY_NAME);

    89.     while (1)
    90.     {
    91.         gCurrentPowerMode = APP_GetUserSelection();
    92.         PRINTF("Entering %s ...\r\n", gWakeupInfoStr[gCurrentPowerMode]);

    93.         /* Enter the low power mode. */
    94.         switch (gCurrentPowerMode)
    95.         {
    96.             case kPmu_Sleep: /* Enter sleep mode. */
    97.                 POWER_EnterSleep();
    98.                 break;
    99.             case kPmu_Deep_Sleep: /* Enter deep sleep mode. */
    100.                 POWER_EnterDeepSleep(APP_EXCLUDE_FROM_DEEPSLEEP);
    101.                 break;
    102.             case kPmu_Deep_PowerDown: /* Enter deep power down mode. */
    103.                 PRINTF("Press any key to confirm to enter the deep sleep mode and wakeup the device by reset.\r\n\r\n");
    104.                 GETCHAR();
    105.                 POWER_EnterDeepPowerDown(APP_EXCLUDE_FROM_DEEPSLEEP);
    106.                 break;
    107.             default:
    108.                 break;
    109.         }

    110.         PRINTF("Wakeup.\r\n");
    111.     }
    112. }

    113. /*
    114. * Setup a GPIO input pin as wakeup source.
    115. */
    116. static void APP_InitWakeupPin(void)
    117. {
    118.     gpio_pin_config_t gpioPinConfigStruct;

    119.     /* Set SW pin as GPIO input. */
    120.     gpioPinConfigStruct.pinDirection = kGPIO_DigitalInput;
    121.     GPIO_PinInit(APP_USER_WAKEUP_KEY_GPIO, APP_USER_WAKEUP_KEY_PORT, APP_USER_WAKEUP_KEY_PIN, &gpioPinConfigStruct);

    122.     /* Configure the Input Mux block and connect the trigger source to PinInt channle. */
    123.     INPUTMUX_Init(INPUTMUX);
    124.     INPUTMUX_AttachSignal(INPUTMUX, kPINT_PinInt0, APP_USER_WAKEUP_KEY_INPUTMUX_SEL); /* Using channel 0. */
    125.     INPUTMUX_Deinit(INPUTMUX); /* Turnoff clock to inputmux to save power. Clock is only needed to make changes */

    126.     /* Enable wakeup for PinInt0. */
    127.     SYSCON->STARTERSET[0] |= APP_SYSCON_STARTER_MASK; /* GPIO pin interrupt 0 wake-up. */

    128.     /* Configure the interrupt for SW pin. */
    129.     PINT_Init(PINT);
    130.     PINT_PinInterruptConfig(PINT, kPINT_PinInt0, kPINT_PinIntEnableFallEdge, pint_intr_callback);
    131.     PINT_EnableCallback(PINT); /* Enable callbacks for PINT */

    132.     EnableDeepSleepIRQ(PIN_INT0_IRQn);
    133. }

    134. /*
    135. * Callback function when wakeup key is pressed.
    136. */
    137. static void pint_intr_callback(pint_pin_int_t pintr, uint32_t pmatch_status)
    138. {
    139.     PRINTF("Pin event occurs\r\n");
    140. }

    141. /*
    142. * Get user selection from UART.
    143. */
    144. static uint32_t APP_GetUserSelection(void)
    145. {
    146.     uint32_t ch;

    147.     /* Clear rx overflow error once it happens during low power mode. */
    148.     if (APP_USART_RX_ERROR == (APP_USART_RX_ERROR & USART_GetStatusFlags((USART_Type *)BOARD_DEBUG_UART_BASEADDR)))
    149.     {
    150.         USART_ClearStatusFlags((USART_Type *)BOARD_DEBUG_UART_BASEADDR, APP_USART_RX_ERROR);
    151.     }

    152.     PRINTF(
    153.         "Select an option\r\n"
    154.         "\t1. Sleep mode\r\n"
    155.         "\t2. Deep Sleep mode\r\n"
    156.         "\t3. Deep power down mode\r\n");

    157.     while (1)
    158.     {
    159.         ch = GETCHAR();
    160.         if ((ch < '1') || (ch > '3')) /* Only '1', '2', '3'. */
    161.         {
    162.             continue;
    163.         }
    164.         else
    165.         {
    166.             ch = ch - '1'; /* Only 0, 1, 2. */
    167.             break;
    168.         }
    169.     }
    170.     switch (ch)
    171.     {
    172.         case 0:
    173.             ch = kPmu_Sleep;
    174.             break;
    175.         case 1:
    176.             ch = kPmu_Deep_Sleep;
    177.             break;
    178.         case 2:
    179.             ch = kPmu_Deep_PowerDown;
    180.             break;
    181.         default:
    182.             break;
    183.     }
    184.     return ch;
    185. }
    复制代码
    哎...今天够累的,签到来了~
    回复

    使用道具 举报

  • TA的每日心情
    郁闷
    2019-11-7 11:26
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]初来乍到

    4

    主题

    16

    帖子

    0

    注册会员

    Rank: 2

    积分
    95
    最后登录
    2020-9-28
     楼主| 发表于 2020-9-24 09:37:59 | 显示全部楼层
    本帖最后由 l52571314 于 2020-9-24 10:06 编辑
    l52571314 发表于 2020-9-24 09:28
    前辈你好,我看了下你写的这个基于LPC845的帖子也下了SDK看了下,比对了一下LPC845和LPC54606的demo,我 ...

    未必是版本太老了? 我下了新版sdk2.7的发现有
    1. #if (defined(FSL_FEATURE_POWERLIB_EXTEND) && FSL_FEATURE_POWERLIB_EXTEND)
    2.                 DEMO_PreDeepPowerDown();
    3.                 POWER_EnterDeepPowerDown(APP_EXCLUDE_FROM_DEEPPOWERDOWN,
    4.                                          LOWPOWER_SRAMRETCTRL_RETEN_RAMX2 | LOWPOWER_SRAMRETCTRL_RETEN_RAMX3,
    5.                                          WAKEUP_RTC_LITE_ALARM_WAKEUP, 1);
    6. #else
    7.                 POWER_EnterDeepPowerDown(APP_EXCLUDE_FROM_DEEPSLEEP);
    8. #endif
    复制代码


    这个电源库扩展是要怎么做?,我可以按照LPC845的fsl_power文件移到现在LPC54606的工程吗?
    哎...今天够累的,签到来了~
    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /3 下一条

    Archiver|手机版|小黑屋|恩智浦技术社区

    GMT+8, 2025-7-22 01:40 , Processed in 0.090366 second(s), 23 queries , MemCache On.

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.

    快速回复 返回顶部 返回列表