nRF91-QA-低功耗例程-SLM AT指令

一:按键切换LED与串口外设进入低功耗模式与唤醒

  1. 测试环境:ncs v1.8.0
  2. 例程路径:ncs\v1.8.0\nrf\applications\serial_lte_modem
  3. 测试固件:ncs\v1.8.0\nrf\applications\serial_lte_modem\build\zephyr\merged.hex
  4. modem固件:mfw_nrf9160_1.3.0
  5. 例程源码:链接测试例程(功耗 外设 DFU FDS AT)/nRF91/v1.8.0/serial_lte_modem.zip
  6. AT+CFUN=1附着网络后电流:651uA 图片
  7. AT#XSLEEP=2后电流:64uA 图片
  8. 相关at指令
     //serial_lte_modem 增强at指令
     Power saving #XSLEEP
     ====================
    
     The ``#XSLEEP`` command makes the nRF91 development kit go into idle or sleep mode.
    
     If you are going to do power measurements on the nRF9160 DK while running the SLM application it is recommended to disable unused peripherals.
     By default UART2 is enabled in the :file:`nrf9160dk_nrf9160_ns.overlay` file so disable the UART2 by switching the status.
     Change the line ``status = "okay"`` to ``status = "disabled"`` and then save the :file:`nrf9160dk_nrf9160_ns.overlay`` file to make sure you will get the expected power consumption numbers when doing the measurements.
    
     Set command
     -----------
    
     The set command makes the nRF91 development kit go into either idle or sleep mode, or it powers off the UART device.
    
     Syntax
     ~~~~~~
    
     ::
    
     #XSLEEP=<shutdown_mode>
    
     The ``<shutdown_mode>`` parameter accepts only the following integer values:
    
     * ``0`` - Enter Idle.
     In this mode, the SLM service is terminated, but the LTE connection is maintained.
     * ``1`` - Enter Sleep.
     In this mode, both the SLM service and the LTE connection are terminated.
     * ``2`` - Power off UART.
     In this mode, both the SLM service and the LTE connection are maintained.
    
     * In case of Idle, it will exit by interface GPIO.
     * In case of Sleep, it will wake up by interface GPIO.
     * In case of UART power off, UART will be powered on by interface GPIO or internally by SLM when needed.
    
     Examples
     ~~~~~~~~
    
     ::
    
     AT#XSLEEP=0
     OK
    
     ::
    
     AT#XSLEEP=1
     OK
    
     ::
    
     AT#XSLEEP=2
     OK
    
     Read command
     ------------
    
     The read command is not supported.
    
     Test command
     ------------
    
     The test command tests the existence of the AT command and provides information about the type of its subparameters.
    
     Syntax
     ~~~~~~
    
     ::
    
     #XSLEEP=?
    
     Response syntax
     ~~~~~~~~~~~~~~~
    
     ::
    
     #XSLEEP: <list of shutdown_mode>
    
     Example
     ~~~~~~~
    
     ::
    
     #XSLEEP: (0,1,2)
     OK
    
  9. 测试log
    2022-02-10T07:50:49.602Z DEBUG modem >> AT+CFUN=1
    2022-02-10T07:50:49.645Z DEBUG modem << OK
    2022-02-10T07:50:51.409Z INFO Modem port is closed
    2022-02-10T07:50:51.415Z INFO Modem port is opened
    2022-02-10T07:50:51.419Z DEBUG modem >> AT+CFUN?
    2022-02-10T07:50:51.433Z DEBUG modem << +CFUN: 1
    2022-02-10T07:50:51.434Z DEBUG modem << OK
    2022-02-10T07:50:51.437Z DEBUG modem >> AT+CGSN=1
    2022-02-10T07:50:51.446Z DEBUG modem << +CGSN: "352656100375701"
    2022-02-10T07:50:51.447Z DEBUG modem << OK
    2022-02-10T07:50:51.451Z DEBUG modem >> AT+CGMI
    2022-02-10T07:50:51.464Z DEBUG modem << Nordic Semiconductor ASA
    2022-02-10T07:50:51.467Z DEBUG modem << 
    2022-02-10T07:50:51.468Z DEBUG modem << OK
    2022-02-10T07:50:51.470Z DEBUG modem >> AT+CGMM
    2022-02-10T07:50:51.484Z DEBUG modem << nRF9160-SICA
    2022-02-10T07:50:51.485Z DEBUG modem << OK
    2022-02-10T07:50:51.494Z DEBUG modem >> AT+CGMR
    2022-02-10T07:50:51.511Z DEBUG modem << mfw_nrf9160_1.3.1
    2022-02-10T07:50:51.512Z DEBUG modem << OK
    2022-02-10T07:50:51.513Z INFO Nordic Semiconductor ASA nRF9160-SICA [mfw_nrf9160_1.3.1] SerNr: 352656100375701
    2022-02-10T07:50:51.514Z DEBUG modem >> AT+CEMODE?
    2022-02-10T07:50:51.528Z DEBUG modem << +CEMODE: 0
    2022-02-10T07:50:51.529Z DEBUG modem << OK
    2022-02-10T07:50:51.534Z DEBUG modem >> AT%XCBAND=?
    2022-02-10T07:50:51.547Z DEBUG modem << %XCBAND: (1,2,3,4,5,8,12,13,17,19,20,25,26,28,66)
    2022-02-10T07:50:51.550Z DEBUG modem << OK
    2022-02-10T07:50:51.562Z DEBUG modem >> AT+CMEE?
    2022-02-10T07:50:51.578Z DEBUG modem << +CMEE: 0
    2022-02-10T07:50:51.579Z DEBUG modem << OK
    2022-02-10T07:50:51.582Z DEBUG modem >> AT+CMEE=1
    2022-02-10T07:50:51.594Z DEBUG modem << OK
    2022-02-10T07:50:51.599Z DEBUG modem >> AT+CNEC?
    2022-02-10T07:50:51.613Z DEBUG modem << +CNEC: 0
    2022-02-10T07:50:51.614Z DEBUG modem << OK
    2022-02-10T07:50:51.618Z DEBUG modem >> AT+CNEC=24
    2022-02-10T07:50:51.629Z DEBUG modem << OK
    2022-02-10T07:50:51.632Z DEBUG modem >> AT+CGEREP?
    2022-02-10T07:50:51.646Z DEBUG modem << +CGEREP: 0,0
    2022-02-10T07:50:51.648Z DEBUG modem << OK
    2022-02-10T07:50:51.650Z DEBUG modem >> AT+CGDCONT?
    2022-02-10T07:50:51.661Z DEBUG modem << +CGDCONT: 0,"","","",0,0
    2022-02-10T07:50:51.662Z DEBUG modem << OK
    2022-02-10T07:50:51.667Z DEBUG modem >> AT+CGACT?
    2022-02-10T07:50:51.678Z DEBUG modem << +CGACT: 0,0
    2022-02-10T07:50:51.679Z DEBUG modem << OK
    2022-02-10T07:50:51.684Z DEBUG modem >> AT+CGEREP=1
    2022-02-10T07:50:51.695Z DEBUG modem << OK
    2022-02-10T07:50:51.699Z DEBUG modem >> AT+CIND=1,1,1
    2022-02-10T07:50:51.711Z DEBUG modem << OK
    2022-02-10T07:50:51.713Z DEBUG modem >> AT+CEREG=5
    2022-02-10T07:50:51.727Z DEBUG modem << OK
    2022-02-10T07:50:51.731Z DEBUG modem >> AT+CEREG?
    2022-02-10T07:50:51.745Z DEBUG modem << +CEREG: 5,2,"1D2D","008D2752",9
    2022-02-10T07:50:51.747Z DEBUG modem << OK
    2022-02-10T07:50:51.752Z DEBUG modem >> AT%CESQ=1
    2022-02-10T07:50:51.761Z DEBUG modem << OK
    2022-02-10T07:50:51.766Z DEBUG modem >> AT+CESQ
    2022-02-10T07:50:51.783Z DEBUG modem << +CESQ: 99,99,255,255,17,60
    2022-02-10T07:50:51.785Z DEBUG modem << OK
    2022-02-10T07:50:51.793Z DEBUG modem >> AT%XSIM=1
    2022-02-10T07:50:51.800Z DEBUG modem << OK
    2022-02-10T07:50:51.802Z DEBUG modem >> AT%XSIM?
    2022-02-10T07:50:51.812Z DEBUG modem << %XSIM: 1
    2022-02-10T07:50:51.813Z DEBUG modem << OK
    2022-02-10T07:50:51.817Z DEBUG modem >> AT+CPIN?
    2022-02-10T07:50:51.828Z DEBUG modem << +CPIN: READY
    2022-02-10T07:50:51.830Z DEBUG modem << OK
    2022-02-10T07:50:51.835Z DEBUG modem >> AT+CPINR="SIM PIN"
    2022-02-10T07:50:51.849Z DEBUG modem << +CPINR: "SIM PIN",3
    2022-02-10T07:50:51.852Z DEBUG modem << 
    2022-02-10T07:50:51.853Z DEBUG modem << OK
    2022-02-10T07:50:51.864Z DEBUG modem >> AT+CIMI
    2022-02-10T07:50:51.877Z DEBUG modem << 460046428407775
    2022-02-10T07:50:51.878Z DEBUG modem << OK
    2022-02-10T07:50:51.879Z INFO IMSIdentity: 460046428407775
    2022-02-10T07:50:51.915Z DEBUG modem << %CESQ: 60,3,18,2
    2022-02-10T07:50:52.315Z DEBUG modem << %CESQ: 60,3,24,3
    2022-02-10T07:50:53.357Z DEBUG modem << +CGEV: ME PDN ACT 0,0
    2022-02-10T07:50:53.359Z DEBUG modem << +CNEC_ESM: 50,0
    2022-02-10T07:50:53.361Z DEBUG modem >> AT+CGDCONT?
    2022-02-10T07:50:53.364Z DEBUG modem << +CEREG: 1,"1D2D","008D2752",9,,,"11100000","11100000"
    2022-02-10T07:50:53.365Z DEBUG modem << 
    2022-02-10T07:50:53.366Z DEBUG modem << +CIND: "service",1
    2022-02-10T07:50:53.366Z DEBUG modem << 
    2022-02-10T07:50:53.377Z DEBUG modem << +CGDCONT: 0,"IP","cmnbiot","100.114.178.20",0,0
    2022-02-10T07:50:53.379Z DEBUG modem << OK
    2022-02-10T07:50:53.384Z DEBUG modem >> AT+CGACT?
    2022-02-10T07:50:53.395Z DEBUG modem << +CGACT: 0,1
    2022-02-10T07:50:53.396Z DEBUG modem << OK
    2022-02-10T07:50:54.326Z DEBUG modem << %CESQ: 60,3,29,4
    2022-02-10T07:50:56.126Z DEBUG modem << %CESQ: 60,3,23,3
    2022-02-10T07:50:57.326Z DEBUG modem << %CESQ: 60,3,29,4
    2022-02-10T07:50:58.326Z DEBUG modem << %CESQ: 60,3,24,3
    2022-02-10T07:50:59.926Z DEBUG modem << %CESQ: 60,3,29,4
    2022-02-10T07:51:01.326Z DEBUG modem << %CESQ: 60,3,24,3
    2022-02-10T07:51:05.127Z DEBUG modem << %CESQ: 60,3,29,4
    2022-02-10T07:51:06.326Z DEBUG modem << %CESQ: 60,3,24,3

二:执行AT+CFUN=1,无信号情况下再执行AT+CFUN=0,进入不了低功耗,需使用AT+CFUN=44

  • 测试环境
    1. 测试板子DK板 PCA10090 0.9.0 2019.21
    2. 测试例程:serial_lte_modem
    3. 功耗分析仪器:例如PPK2
    4. 附着网络时,网络信号正常
    5. 关闭网络时,把DK板放入屏蔽箱中
  • 测试步骤:
    1. 低功耗设置:AT+CPSMS=1,,,”00111000”,”00011110”
    2. 打开射频:AT+CFUN=1
    3. 等待附着到网络
    4. 打开 Socket: socket_fd = nrf_socket(NRF_AF_INET, NRF_SOCK_STREAM, NRF_IPPROTO_TCP);
    5. 获取IP:nrf_getaddrinfo();
    6. 连接Socket: nrf_connect(socket_fd, &ipv4Address, sizeof(nrf_sockaddr_in_t));
    7. 关闭Socket: ret = nrf_close(pContext->socket_fd);
    8. 关闭射频:

    测试一:AT+CFUN=0 功耗较高 测试二:AT+CFUN=44 功耗较低

三:参考文档

  1. nRF Connect Doc
  2. Devzone:Case ID: 228923
  3. Devzone:Case ID: 226439

新手必知

海量第三方学习资源.

超全常用工具与文档.

本站常用资源下载.

常见问题搜索.

QQ群: 542294007.

文章引用自:元仓库 OLIB.cn.