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.

CC3220SF: 请问下,在启动SimpleLink服务后,能否关闭某些模块?

Part Number: CC3220SF

您好, 我使用CC3220SF搭配simplelink_cc32xx_sdk_4_30_00_06 进行开发,发现当启动sl_Start开启SimpleLink服务时,会默认开始所有SimpleLink服务。如何选择性的开启某些功能呢?比如我只想使用sl_File(文件系统),而不想使用WIFI。更不想开启WIFI模块。请问我应该怎么做?

  • /*!
        \brief Start the SimpleLink device
        
        This function initialize the communication interface, set the enable pin 
        of the device, and call to the init complete callback.
    
        \param[in]      pIfHdl              Opened Interface Object. In case the interface 
                                            must be opened outside the SimpleLink Driver, the
                                            user might give the handler to be used in \n
                                            any access of the communication interface with the 
                                            device (UART/SPI). \n
                                            The SimpleLink driver will open an interface port
                                            only if this parameter is null! \n
        \param[in]      pDevName            The name of the device to open. Could be used when 
                                            the pIfHdl is null, to transfer information to the 
                                            open interface function \n
                                            This pointer could be used to pass additional information to
                                            sl_IfOpen in case it is required (e.g. UART com port name)
        \param[in]      pInitCallBack       Pointer to function that would be called
                                            on completion of the initialization process.\n
                                            If this parameter is NULL the function is 
                                            blocked until the device initialization 
                                            is completed, otherwise the function returns 
                                            immediately.
    
        \return         Returns the current active role (STA/AP/P2P/TAG) or an error code:
                        - ROLE_STA, ROLE_AP, ROLE_P2P, ROLE_TAG in case of success and when pInitCallBack is NULL (the third parameter),\n
                        or, in case of pInitCallBack is not null - sl_start will return zero in case of success,
                        otherwise in failure one of the following is return:
                        - SL_ERROR_ROLE_STA_ERR  (Failure to load MAC/PHY in STA role)
                        - SL_ERROR_ROLE_AP_ERR  (Failure to load MAC/PHY in AP role)
                        - SL_ERROR_ROLE_P2P_ERR  (Failure to load MAC/PHY in P2P role)
                        - SL_ERROR_CALIB_FAIL (Failure of calibration)
                        - SL_ERROR_FS_CORRUPTED_ERR (FS is corrupted, Return to Factory Image or Program new image should be invoked (see sl_FsCtl, sl_FsProgram))
                        - SL_ERROR_FS_ALERT_ERR (Device is locked, Return to Factory Image or Program new image should be invoked (see sl_FsCtl, sl_FsProgram))
                        - SL_ERROR_RESTORE_IMAGE_COMPLETE (Return to factory image completed, perform reset)
                        - SL_ERROR_ROLE_TAG_ERR  (Failure to start TAG role)
                        - SL_ERROR_FIPS_ERR (Failure to start with FIPS mode enabled)
                        - SL_ERROR_GENERAL_ERR (General error during init)
    
         \sa             sl_Stop
    
        \note           Belongs to \ref basic_api
    
        \warning        This function must be called before any other SimpleLink API is used, or after sl_Stop is called for reinit the device
        \par            Example:
    
        - Open interface without callback routine. The interface name and handler are
          handled by the sl_IfOpen routine: 
        \code            
            if( sl_Start(NULL, NULL, NULL) < 0 )
            {
                LOG("Error opening interface to device\n"); 
            }
        \endcode
        <br>
    
        - Open interface with a callback routine:
        \code
            void SimpleLinkInitCallback(_u32 status)
            {
                LOG("Handle SimpleLink Interface acording to ststus %d\n", status);
            }
                        
            void main(void) 
            {
                if  (sl_Start(NULL, NULL, SimpleLinkInitCallback) < 0)
                {
                    LOG("Error opening interface to device\n");
                }
            }
        \endcode
    
    */
    #if _SL_INCLUDE_FUNC(sl_Start)
    _i16 sl_Start(const void* pIfHdl, _i8*  pDevName, const P_INIT_CALLBACK pInitCallBack);
    #endif
    

    打开文件系统不需要使用sl_Start,用sl_FsOpen打开,可以参考例程fatsd

  • 好的,那请问下,如果我想关闭WIFI是不是只能通过sl_stop关闭?

  • 因为我测试功耗发现,当调用sl_start开始网络服务的时候,整个CC3220SF总电流输入会增加大约50mA。而对于某些情况下整个网络服务来说其实我只需要WLAN以及Socket服务而已,我在想能否关闭某些服务从而降低功耗,因为目前整个代码运行花费的功耗来说有一半是在这个网络服务上面

  • 你好有看到我的回复吗?

  • 如果我想关闭WIFI是不是只能通过sl_stop关闭?

    是的

    我在想能否关闭某些服务从而降低功耗,因为目前整个代码运行花费的功耗来说有一半是在这个网络服务上面

    你可以参考Power Measurement例程,然后将低功耗模式添加到你的程序当中

  • 嗯谢谢,我的理解是:

    1、在Power Measurement例程中,只要设置了Power_enablePolicy();那么当所有线程进入sleep或者阻塞情况下的时候,系统会进入LPDS模式,不知道我这个理解是否正确?我在自己的开发板上做了如下测试:1、将程序中将WLAN模式设置为AP模式并通过PC连接上CC3220SF的热点,并在连接后将所有的线程置为SLEEP模式,发现总的电流还有75mA;2、不开启WLAN模式下,开启4个线程并让所有线程进入SLEEP,发现总的电流输入为11.6~15.2mA其中大部分时间保持在11.6mA,中间会有一个小波动其大小为15.2mA

    2、如果上述理解正确,那是不是可以说明在simpleLink启动网络服务的模式下即使开启LPDS模式,其功耗无法限制在一个较低的水平?

  • 1.可以在SDK \drivers 查看Power_Management文档中关于电源管理的说明

    你测的这些功耗都比较高,看起来都没有进入低功耗模式

    2.NWP打开时功耗是比较高,但进入LPDS模式,NWP应该是不工作的,只有32.768-KHz的晶振工作

  • 你好,我查阅Power_Management代码,发现CC3220SF都是工作在STA模式下,于是我在自己的代码中将CC3220SF的工作模式从ROLE_AP切换到ROLE_STA模式后,将所有线程进入阻塞状态,此时进入LPDS。整个CC3220SF的功耗在4μA左右。但是这并不是我想要的,当CC3220SF工作在AP模式下,LPDS能否为其减少功耗呢?你们的示例代码中只展示了WLAN在STA模式下的功耗,关于其它模式的你们并没有在代码中展示出来。关于其它模式的功耗是否有文档说明?

  • AP模式不能使用Power policy,低功耗模式仅在STA and P2P client mode使用

    AP一般都需要一直打开,尤其是当有多个station连接的时候,station要和它进行数据交换

    因此AP大多采用稳定电源供电而不是电池

  • 十分感谢您的答复,请问下您刚说的这句话可否有在文档中查阅得到

  • 在SimpleLinkTm Wi-Fi® CC3x20, CC3x3x Network Processor中:

    15.1.6 Power Modes versus Device Modes
    The low-power policies of the SimpleLink device are only available when it is in STA and P2P client mode. Once
    the device is put into AP or P2P group owner mode, the power-management profile is forced to always on.