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.

[参考译文] CC3100BOOST:cc3100在 sl_start 处挂起

Guru**** 2553450 points
Other Parts Discussed in Thread: CC3100

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/1051522/cc3100boost-cc3100-hang-at-sl_start

器件型号:CC3100BOOST
主题中讨论的其他器件:CC3100

尊敬的 TI:

我正在通过 SPI 接口将 CC3100 WIFI 模块与 STM32H743ZI Nucleo 板搭配使用、我已向我的项目添加了简单的链接驱动程序。 当我运行项目时、它在 sl_start 上挂起。 当我通过逻辑分析仪进行调试时、我正在获取数据0XBA 0XDC 0XCD 0XAB 0x08 0x00 0x08 0x00 0XCD 0X30 0xFD 0XC0 0X11 0X11 0X11 0X11 0X11 0X11。

请帮助我解决此问题。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    实际上、您在 SPI 线路上得到的是良好的。

    我可以看到 INIT_COMPLETE 事件、0x11表示它处于 STATION 角色。

    您能否查看代码并让我知道代码的挂起位置?

    更具体地说、我将在回调中查看它应该向对象发出信号的位置。

    _SlReturnVal_t _sl_HandleAsync_InitComplete(void *pVoidBuf)
    {
        InitComplete_t     *pMsgArgs   = (InitComplete_t *)_SL_RESP_ARGS_START(pVoidBuf);
    
        SL_DRV_PROTECTION_OBJ_LOCK_FOREVER();
        
        if(g_pCB->pInitCallback)
        {
            g_pCB->pInitCallback(_sl_GetStartResponseConvert(pMsgArgs->Status));
        }
        else
        {
            sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(InitComplete_t));
            SL_DRV_SYNC_OBJ_SIGNAL(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
        }
        
        SL_DRV_PROTECTION_OBJ_UNLOCK();
       
        if(g_pCB->pInitCallback)
        {
    		SL_SET_DEVICE_STARTED;
            _SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);
        }
    
    
    	return SL_RET_CODE_OK;
    }
    

    返回 SL_RET_CODE_OK;

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Shlomi、

    感谢您的回复、代码在 sl_IfRegIntHdlr (sl_P_EVENT_handler)_SlDrvRxIrqHandler、NULL)上挂起;

    void _SlDriverHandleError (SlDeviceDriverError_e eError、_u32 Info1、_u32 info2)

     在此过程中、我将收到一个 msg  sl_device_driver_timeout_ASYNC_EVENT

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您很可能不会在 sl_IfRegIntHdlr ()上被阻止,因为您会得到 init_complete 事件,该事件仅在芯片组打开后才会触发,这种情况仅在您调用 sl_DeviceEnable()的下一行发生。

    当您等待要调用的 IRQ 处理程序时,可能会在_SlDrvSyncObjWaitTimeout()上的超时被阻止。

    我可以想到的唯一原因是、如果您没有将 IRQ 处理程序连接到正确的物理引脚。

    通常、您需要查看 user.h 头文件以了解需要配置的平台和操作系统相关变量。

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    /*
     * user.h - CC31xx/CC32xx Host Driver Implementation
     *
     * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
    */
    
    
    #ifndef __USER_H__
    #define __USER_H__
    
    
    #ifdef  __cplusplus
    extern "C" {
    #endif
    
    
    /*!
     ******************************************************************************
    
        \defgroup       porting_user_include        Porting - User Include Files
    
        This section IS NOT REQUIRED in case user provided primitives are handled
        in makefiles or project configurations (IDE)
    
        PORTING ACTION:
            - Include all required header files for the definition of:
                -# Transport layer library API (e.g. SPI, UART)
                -# OS primitives definitions (e.g. Task spawn, Semaphores)
                -# Memory management primitives (e.g. alloc, free)
    
     ******************************************************************************
     */
    
    #include <string.h>
    #include "board.h"
    #include "spi.h"
    #include "timer_tick.h"
    #include "cli_uart.h"
    
    typedef P_EVENT_HANDLER                         SL_P_EVENT_HANDLER;
    
    /*!
        \def        MAX_CONCURRENT_ACTIONS
    
        \brief      Defines the maximum number of concurrent action in the system
                    Min:1 , Max: 32
    
                    Actions which has async events as return, can be
    
        \sa
    
        \note       In case there are not enough resources for the actions needed
                    in the system, error is received: POOL_IS_EMPTY one option is
                    to increase MAX_CONCURRENT_ACTIONS (improves performance but
                    results in memory consumption) Other option is to call the API
                    later (decrease performance)
    
        \warning    In case of setting to one, recommend to use non-blocking
                    recv\recvfrom to allow multiple socket recv
    */
    #define MAX_CONCURRENT_ACTIONS 10
    
    /*!
     ******************************************************************************
    
        \defgroup       proting_capabilities        Porting - Capabilities Set
    
        This section IS NOT REQUIRED in case one of the following pre defined
        capabilities set is in use:
        - SL_TINY
        - SL_SMALL
        - SL_FULL
    
        PORTING ACTION:
            - Define one of the pre-defined capabilities set or uncomment the
              relevant definitions below to select the required capabilities
    
        @{
    
     *******************************************************************************
    */
    
    /*!
        \def        SL_INC_ARG_CHECK
    
        \brief      Defines whether the SimpleLink driver perform argument check
                    or not
    
                    When defined, the SimpleLink driver perform argument check on
                    function call. Removing this define could reduce some code
                    size and improve slightly the performances but may impact in
                    unpredictable behavior in case of invalid arguments
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning    Removing argument check may cause unpredictable behavior in
                    case of invalid arguments.
                    In this case the user is responsible to argument validity
                    (for example all handlers must not be NULL)
    */
    #define SL_INC_ARG_CHECK
    
    
    /*!
        \def        SL_INC_STD_BSD_API_NAMING
    
        \brief      Defines whether SimpleLink driver should expose standard BSD
                    APIs or not
    
                    When defined, the SimpleLink driver in addtion to its alternative
                    BSD APIs expose also standard BSD APIs.
        Stadrad BSD API includs the following functions:
                    socket , close , accept , bind , listen , connect , select ,
                    setsockopt  , getsockopt , recv , recvfrom , write , send , sendto ,
                    gethostbyname
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    
    #define SL_INC_STD_BSD_API_NAMING
    
    
    /*!
        \brief      Defines whether to include extended API in SimpleLink driver
                    or not
    
                    When defined, the SimpleLink driver will include also all
                    exteded API of the included packages
    
        \sa             ext_api
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_EXT_API
    
    /*!
        \brief      Defines whether to include WLAN package in SimpleLink driver
                    or not
    
                    When defined, the SimpleLink driver will include also
                    the WLAN package
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_WLAN_PKG
    
    /*!
        \brief      Defines whether to include SOCKET package in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also
                    the SOCKET package
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_SOCKET_PKG
    
    /*!
        \brief      Defines whether to include NET_APP package in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also the
                    NET_APP package
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_NET_APP_PKG
    
    /*!
        \brief      Defines whether to include NET_CFG package in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also
                    the NET_CFG package
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_NET_CFG_PKG
    
    /*!
        \brief      Defines whether to include NVMEM package in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also the
                    NVMEM package
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_NVMEM_PKG
    
    /*!
        \brief      Defines whether to include socket server side APIs
                    in SimpleLink driver or not
    
                    When defined, the SimpleLink driver will include also socket
                    server side APIs
    
        \sa             server_side
    
        \note
    
        \warning
    */
    #define SL_INC_SOCK_SERVER_SIDE_API
    
    /*!
        \brief      Defines whether to include socket client side APIs in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also socket
                    client side APIs
    
        \sa             client_side
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_SOCK_CLIENT_SIDE_API
    
    /*!
        \brief      Defines whether to include socket receive APIs in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also socket
                    receive side APIs
    
        \sa             recv_api
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_SOCK_RECV_API
    
    /*!
        \brief      Defines whether to include socket send APIs in SimpleLink
                    driver or not
    
                    When defined, the SimpleLink driver will include also socket
                    send side APIs
    
        \sa             send_api
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define SL_INC_SOCK_SEND_API
    
    /*!
    
     Close the Doxygen group.
     @}
    
     */
    
    
    /*!
     ******************************************************************************
    
        \defgroup   porting_enable_device       Porting - Device Enable/Disable
    
        The enable/disable line (nHib) provide mechanism to enter the device into
        the least current consumption mode. This mode could be used when no traffic
        is required (tx/rx).
        when this hardware line is not connected to any IO of the host this define
        should be left empty.
    
    
        \note   Not connecting this line results in ability to start the driver
                only once.
    
        PORTING ACTION:
            - Bind the GPIO that is connected to the device to the SimpleLink
              driver
    
        @{
    
     ******************************************************************************
    */
    /*!
        \brief		Preamble to the enabling the Network Processor.
                            Placeholder to implement any pre-process operations
                            before enabling networking operations.
    
        \sa			sl_DeviceEnable
    
        \note       belongs to \ref ported_sec
    
    */
    #define sl_DeviceEnablePreamble()		
    
    /*!
        \brief      Enable the device by set the appropriate GPIO to high
    
        \sa         sl_DeviceDisable
    
        \note           belongs to \ref proting_sec
    
        \warning    if nHib/nShutdown pins are not connected to the host this define
                    should be left empty. Not connecting on of these lines may result
                    in higher power consumption and inability to start and stop the
                    driver correctly.
    */
    #define sl_DeviceEnable       CC3100_enable
    
    /*!
        \brief      Disable the device by setting the appropriate GPIO to Low
    
        \sa         sl_DeviceEnable
    
        \note           belongs to \ref proting_sec
    
        \warning    if nHib/nShutdown pins are not connected to the host this define
                    should be left empty. Not connecting on of these lines may result
                    in higher power consumption and inability to start and stop the
                    driver correctly.
    */
    
    #define sl_DeviceDisable      CC3100_disable
    
    /*!
    
     Close the Doxygen group.
     @}
    
     */
    
    /*!
     ******************************************************************************
    
        \defgroup   porting_interface         Porting - Communication Interface
    
        The simple link device can work with different communication
        channels (e.g. spi/uart). Texas Instruments provides single driver
        that can work with all these types. This section bind between the
        physical communication interface channel and the SimpleLink driver
    
    
        \note       Correct and efficient implementation of this driver is critical
                    for the performances of the SimpleLink device on this platform.
    
    
        PORTING ACTION:
            - Bind the functions of the communication channel interface driver with
              the simple link driver
    
        @{
    
     ******************************************************************************
    */
    
    #define _SlFd_t                 int
    
    /*!
        \brief      Opens an interface communication port to be used for communicating
                    with a SimpleLink device
    
                    Given an interface name and option flags, this function opens
                    the communication port and creates a file descriptor.
                    This file descriptor is used afterwards to read and write
                    data from and to this specific communication channel.
                    The speed, clock polarity, clock phase, chip select and all other
                    specific attributes of the channel are all should be set to hardcoded
                    in this function.
    
        \param      ifName  -   points to the interface name/path. The interface name is an
                                optional attributes that the simple link driver receives
                                on opening the driver (sl_Start).
                                In systems that the spi channel is not implemented as
                                part of the os device drivers, this parameter could be NULL.
    
        \param      flags   -   optional flags parameters for future use
    
        \return     upon successful completion, the function shall open the channel
                    and return a non-negative integer representing the file descriptor.
                    Otherwise, -1 shall be returned
    
        \sa         sl_IfClose , sl_IfRead , sl_IfWrite
    
        \note       The prototype of the function is as follow:
                        Fd_t xxx_IfOpen(char* pIfName , unsigned long flags);
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define sl_IfOpen                           spi_Open
    
    /*!
        \brief      Closes an opened interface communication port
    
        \param      fd  -   file descriptor of opened communication channel
    
        \return     upon successful completion, the function shall return 0.
                    Otherwise, -1 shall be returned
    
        \sa         sl_IfOpen , sl_IfRead , sl_IfWrite
    
        \note       The prototype of the function is as follow:
                        int xxx_IfClose(Fd_t Fd);
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define sl_IfClose                          spi_Close
    
    /*!
        \brief      Attempts to read up to len bytes from an opened communication channel
                    into a buffer starting at pBuff.
    
        \param      fd      -   file descriptor of an opened communication channel
    
        \param      pBuff   -   pointer to the first location of a buffer that contains enough
                                space for all expected data
    
        \param      len     -   number of bytes to read from the communication channel
    
        \return     upon successful completion, the function shall return the number of read bytes.
                    Otherwise, 0 shall be returned
    
        \sa         sl_IfClose , sl_IfOpen , sl_IfWrite
    
    
        \note       The prototype of the function is as follow:
                        int xxx_IfRead(Fd_t Fd , char* pBuff , int Len);
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define sl_IfRead                           spi_Read
    
    /*!
        \brief attempts to write up to len bytes to the SPI channel
    
        \param      fd      -   file descriptor of an opened communication channel
    
        \param      pBuff   -   pointer to the first location of a buffer that contains
                                the data to send over the communication channel
    
        \param      len     -   number of bytes to write to the communication channel
    
        \return     upon successful completion, the function shall return the number of sent bytes.
                    therwise, 0 shall be returned
    
        \sa         sl_IfClose , sl_IfOpen , sl_IfRead
    
        \note       This function could be implemented as zero copy and return only upon successful completion
                    of writing the whole buffer, but in cases that memory allocation is not too tight, the
                    function could copy the data to internal buffer, return back and complete the write in
                    parallel to other activities as long as the other SPI activities would be blocked until
                    the entire buffer write would be completed
    
                   The prototype of the function is as follow:
                        int xxx_IfWrite(Fd_t Fd , char* pBuff , int Len);
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define sl_IfWrite                          spi_Write
    
    /*!
        \brief      register an interrupt handler routine for the host IRQ
    
        \param      InterruptHdl    -   pointer to interrupt handler routine
    
        \param      pValue          -   pointer to a memory structure that is passed
                                        to the interrupt handler.
    
        \return     upon successful registration, the function shall return 0.
                    Otherwise, -1 shall be returned
    
        \sa
    
        \note       If there is already registered interrupt handler, the function
                    should overwrite the old handler with the new one
    
        \note       If the handler is a null pointer, the function should un-register the
                    interrupt handler, and the interrupts can be disabled.
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    #define sl_IfRegIntHdlr(InterruptHdl , pValue) \
                                    registerInterruptHandler(InterruptHdl , pValue)
    /*!
        \brief      Masks the Host IRQ
    
        \sa         sl_IfUnMaskIntHdlr
    
    
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    
    #define sl_IfMaskIntHdlr()
    
    /*!
        \brief     Unmasks the Host IRQ
    
        \sa        sl_IfMaskIntHdlr
    
    
    
        \note      belongs to \ref proting_sec
    
        \warning
    */
    
    #define sl_IfUnMaskIntHdlr()
    
    /*!
        \brief      Write Handers for statistics debug on write
    
        \param      interface handler   -   pointer to interrupt handler routine
    
    
        \return     no return value
    
        \sa
    
        \note       An optional hooks for monitoring before and after write info
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    /*
    #define SL_START_WRITE_STAT
    */
    
    #ifdef SL_START_WRITE_STAT
    #define sl_IfStartWriteSequence                       SlStudio_SpiStartWriteSeq
    #define sl_IfEndWriteSequence                         SlStudio_SpiEndWriteSeq
    #endif
    /*!
    
     Close the Doxygen group.
     @}
    
    */
    
    /*!
     ******************************************************************************
    
        \defgroup   porting_mem_mgm             Porting - Memory Management
    
        This section declare in which memory management model the SimpleLink driver
        will run:
            -# Static
            -# Dynamic
    
        This section IS NOT REQUIRED in case Static model is selected.
    
        The default memory model is Static
    
        PORTING ACTION:
            - If dynamic model is selected, define the alloc and free functions.
    
        @{
    
     *****************************************************************************
    */
    
    /*!
        \brief      Defines whether the SimpleLink driver is working in dynamic
                    memory model or not
    
                    When defined, the SimpleLink driver use dynamic allocations
                    if dynamic allocation is selected malloc and free functions
                    must be retrieved
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    /*
    #define SL_MEMORY_MGMT_DYNAMIC
    */
    
    #ifdef SL_MEMORY_MGMT_DYNAMIC
    
    /*!
        \brief
    
        \sa
    
        \note           belongs to \ref proting_sec
    
        \warning
    */
    #define sl_Malloc(Size)
    
    /*!
        \brief
    
        \sa
    
        \note           belongs to \ref proting_sec
    
        \warning
    */
    #define sl_Free(pMem)
    
    #endif
    
    /*!
    
     Close the Doxygen group.
     @}
    
    */
    
    /*!
     ******************************************************************************
    
        \defgroup   porting_os          Porting - Operating System
    
        The simple link driver can run on multi-threaded environment as well
        as non-os environment (mail loop)
    
        This section IS NOT REQUIRED in case you are working on non-os environment.
    
        If you choose to work in multi-threaded environment under any operating system
        you will have to provide some basic adaptation routines to allow the driver
        to protect access to resources from different threads (locking object) and
        to allow synchronization between threads (sync objects).
    
        PORTING ACTION:
            -# Uncomment SL_PLATFORM_MULTI_THREADED define
            -# Bind locking object routines
            -# Bind synchronization object routines
            -# Optional - Bind spawn thread routine
    
        @{
    
     ******************************************************************************
    */
    
    /*
    #define SL_PLATFORM_MULTI_THREADED
    */
    
    #ifdef SL_PLATFORM_MULTI_THREADED
    
    /*!
        \brief
        \sa
        \note           belongs to \ref proting_sec
        \warning
    */
    #define SL_OS_RET_CODE_OK
    
    /*!
        \brief
        \sa
        \note           belongs to \ref proting_sec
        \warning
    */
    #define SL_OS_WAIT_FOREVER
    
    /*!
        \brief
        \sa
        \note           belongs to \ref proting_sec
        \warning
    */
    #define SL_OS_NO_WAIT
    
    /*!
        \brief type definition for a time value
    
        \note   On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
    
        \note       belongs to \ref proting_sec
    */
    #define _SlTime_t
    
    /*!
        \brief  type definition for a sync object container
    
        Sync object is object used to synchronize between two threads or thread and interrupt handler.
        One thread is waiting on the object and the other thread send a signal, which then
        release the waiting thread.
        The signal must be able to be sent from interrupt context.
        This object is generally implemented by binary semaphore or events.
    
        \note   On each porting or platform the type could be whatever is needed - integer, structure etc.
    
        \note       belongs to \ref proting_sec
    */
    #define _SlSyncObj_t
    
    
    /*!
        \brief  This function creates a sync object
    
        The sync object is used for synchronization between diffrent thread or ISR and
        a thread.
    
        \param  pSyncObj    -   pointer to the sync object control block
    
        \return upon successful creation the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
    
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_SyncObjCreate(pSyncObj,pName)
    
    
    /*!
        \brief  This function deletes a sync object
    
        \param  pSyncObj    -   pointer to the sync object control block
    
        \return upon successful deletion the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_SyncObjDelete(pSyncObj)
    
    
    /*!
        \brief      This function generates a sync signal for the object.
    
        All suspended threads waiting on this sync object are resumed
    
        \param      pSyncObj    -   pointer to the sync object control block
    
        \return     upon successful signaling the function should return 0
                    Otherwise, a negative value indicating the error code shall be returned
        \note       the function could be called from ISR context
        \warning
    */
    #define sl_SyncObjSignal(pSyncObj)
    
    /*!
        \brief  This function waits for a sync signal of the specific sync object
    
        \param  pSyncObj    -   pointer to the sync object control block
        \param  Timeout     -   numeric value specifies the maximum number of mSec to
                                stay suspended while waiting for the sync signal
                                Currently, the simple link driver uses only two values:
                                    - OSI_WAIT_FOREVER
                                    - OSI_NO_WAIT
    
        \return upon successful reception of the signal within the timeout window return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_SyncObjWait(pSyncObj,Timeout)
    
    /*!
        \brief  type definition for a locking object container
    
        Locking object are used to protect a resource from mutual accesses of two or more threads.
        The locking object should suppurt reentrant locks by a signal thread.
        This object is generally implemented by mutex semaphore
    
        \note   On each porting or platform the type could be whatever is needed - integer, structure etc.
        \note       belongs to \ref proting_sec
    */
    #define _SlLockObj_t
    
    /*!
        \brief  This function creates a locking object.
    
        The locking object is used for protecting a shared resources between different
        threads.
    
        \param  pLockObj    -   pointer to the locking object control block
    
        \return upon successful creation the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_LockObjCreate(pLockObj,pName)
    
    /*!
        \brief  This function deletes a locking object.
    
        \param  pLockObj    -   pointer to the locking object control block
    
        \return upon successful deletion the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_LockObjDelete(pLockObj)
    
    /*!
        \brief  This function locks a locking object.
    
        All other threads that call this function before this thread calls
        the osi_LockObjUnlock would be suspended
    
        \param  pLockObj    -   pointer to the locking object control block
        \param  Timeout     -   numeric value specifies the maximum number of mSec to
                                stay suspended while waiting for the locking object
                                Currently, the simple link driver uses only two values:
                                    - OSI_WAIT_FOREVER
                                    - OSI_NO_WAIT
    
    
        \return upon successful reception of the locking object the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_LockObjLock(pLockObj,Timeout)
    
    /*!
        \brief  This function unlock a locking object.
    
        \param  pLockObj    -   pointer to the locking object control block
    
        \return upon successful unlocking the function should return 0
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    #define sl_LockObjUnlock(pLockObj)
    
    #endif
    /*!
        \brief  This function call the pEntry callback from a different context
    
        \param  pEntry      -   pointer to the entry callback function
    
        \param  pValue      -   pointer to any type of memory structure that would be
                                passed to pEntry callback from the execution thread.
    
        \param  flags       -   execution flags - reserved for future usage
    
        \return upon successful registration of the spawn the function should return 0
                (the function is not blocked till the end of the execution of the function
                and could be returned before the execution is actually completed)
                Otherwise, a negative value indicating the error code shall be returned
        \note       belongs to \ref proting_sec
        \warning
    */
    /*
    #define SL_PLATFORM_EXTERNAL_SPAWN
    */
    
    #ifdef SL_PLATFORM_EXTERNAL_SPAWN
    #define sl_Spawn(pEntry,pValue,flags)
    #endif
    
    /*!
    
     Close the Doxygen group.
     @}
    
     */
    
    
    /*!
     ******************************************************************************
    
        \defgroup       porting_events      Porting - Event Handlers
    
        This section includes the asynchronous event handlers routines
    
        PORTING ACTION:
            -Uncomment the required handler and define your routine as the value
            of this handler
    
        @{
    
     ******************************************************************************
     */
    
    /*!
        \brief
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    
    #define sl_GeneralEvtHdlr       SimpleLinkGeneralEventHandler
    
    
    /*!
        \brief          An event handler for WLAN connection or disconnection indication
                        This event handles async WLAN events.
                        Possible events are:
                        SL_WLAN_CONNECT_EVENT - indicates WLAN is connected
                        SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected
        \sa
    
        \note           belongs to \ref proting_sec
    
        \warning
    */
    #define sl_WlanEvtHdlr                              SimpleLinkWlanEventHandler
    
    /*!
        \brief          An event handler for IP address asynchronous event. Usually accepted after new WLAN connection.
                        This event handles networking events.
                        Possible events are:
                        SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static)
    
        \sa
    
        \note           belongs to \ref proting_sec
    
        \warning
    */
    
    #define sl_NetAppEvtHdlr   SimpleLinkNetAppEventHandler
    
    /*!
        \brief      A callback for HTTP server events.
                    Possible events are:
                    SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of
                    a specific token SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the
                    host a new value for a specific token
    
        \param      pServerEvent - Contains the relevant event information
                    (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE)
    
        \param      pServerResponse - Should be filled by the user with the relevant
                    response information (i.e SL_NETAPP_HTTPSETTOKENVALUE as a
                    response to SL_NETAPP_HTTPGETTOKENVALUE event)
    
        \sa
    
        \note       belongs to \ref proting_sec
    
        \warning
    */
    
    #define sl_HttpServerCallback        SimpleLinkHttpServerCallback
    /*!
        \brief
    
        \sa
    
        \note           belongs to \ref proting_sec
    
        \warning
    */
    /*
    #define sl_SockEvtHdlr                  SimpleLinkSockEventHandler
    */
    
    /*!
        \brief
    
        \sa
    
        \note           belongs to \ref porting_sec
    
        \warning
    */
    
    #define sl_AsyncCmdHdlr   SimpleLinkCmdHandler
    
    #define  SL_STORE_RESTORE_CONTEXT
    #ifdef   SL_STORE_RESTORE_CONTEXT
    #define  sl_SuspenedStoreContext   SimpleLinkSuspenedStoreContextHandler
    #define  sl_ResumeRestoreContext   SimpleLinkResumeRestoreContextHandler
    #endif
    
    /*!
    
     Close the Doxygen group.
     @}
    
     */
    
    
    /* comment  the following if timestamp is not supported */
    
    #define sl_GetTimestamp                         timer_GetCurrentTimestamp   
    #define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS   MILLISECONDS_TO_TICKS(10)
    #define SL_TIMESTAMP_MAX_VALUE                  MAX_TIMER_TICKS
    
    
    
    #ifdef  __cplusplus
    }
    #endif // __cplusplus
    
    #endif // __USER_H__
    
    

    主席先生、您好、感谢您的回复、我使用端口 C 引脚6作为外部 GPIO 中断、您刚才提到查看 user.h、可以指出对我有用的代码行。

    GPIO_InitStruct.Pin = GPIO_PIN_6;
    GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    HAL_GPIO_Init (GPIOC、&GPIO_InitStructt);

    /* EXTI 中断 init*/
    HAL_NVIC_setPriority (EXTI9_5_IRQn、0、0);
    HAL_NVIC_EnableIRQ (EXTI9_5_IRQn);

    void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin)

    if ((GPIO_Pin =MCU_IRQ_PIN)&&(NULL!= pIrqEventHandler))

    pIrqEventHandler (0);

     对于您的类型信息,我只是将 CC3100 UART 线路连接到逻辑分析仪,并在这个  sl_DeviceEnable(); API 完成后获取 init complete msg (data)。  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    user.h 用于将驱动程序移植到您的平台。

    例如、您提到了 UART 线路、但当我查看您的附加文件时、我可以看到 sl_IfOpen 指向 SPI 实现。

    我建议下载基于 CC31xx 的 SDK (除非您已经下载)、而不是基于 CC32xx 的 SDK、然后查看其中的示例以及我们如何使用 TI 参考板执行该操作。

    我看到的最新版本是  SimpleLink MSP432E4 SDK (4.20.00.12)

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    HII Shlomi、

    感谢您的回复、正如您所说、我已经完成了交叉验证、我发现了连接到 IRQ 的物理引脚中的问题 并清除了问题、但现在我将继续 if (NULL = pInitCallBack) 它将移动_SlDrvSyncObjWaitTimeoutAPI、最后我收到相同的异步超时错误。

    2.根据 user.h 文件,我使用 SPI 接口与 cc3100进行通信是正确的。  连接到逻辑分析仪的 UART TX 引脚的目的是检查我是否接收到任何有助于我验证通信的数据(这只是一个测试目的、它不会影响任何东西)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    它看起来像同一个地方、所以我不确定你做了什么。

    您很可能没有 IRW 处理程序连接到 IRQ 线路。

    在 sl_Start()中,您有:

    SL_IfRegIntHdlr ((sl_P_EVENT_Handler)_SlDrvRxIrqHandler、NULL);

    这意味着在 IRQ 触发时,您应该在  driver.c 中到达_SlDrvRxIrqHandler()

    您能否在 _SlDrvRxIrqHandler()内放置一个断点并检查您是否在那里停止?

    此外、最好在 SPI 线路和 IRQ 线路上连接逻辑分析仪并进行检查。

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    抱歉,正如您提到的,一旦触发 IRQ,它将移至  driver.c 中的_SlDrvRxIrqHandler()并进入 else 条件

    其他
       {
           (空) sl_spawn ((_SlSpawnEntryFunc_t)_SlDrvMsgReadSpawnCtx、NULL、sl_spawn_FLAG_FROM sl_IRQ_handler);
       }

    它返回 SL_OS_RET_CODE_OK,并在 sl_start()中的_SlDrvsynctObjWaitTimeout 内挂起。

     

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    好的、

    由于芯片的初始响应与主机发送的命令无关(因为您只是第一次打开芯片)、因此您可以转到其他位置并进行创建、以便在另一个上下文中处理。

    在 user.h 中也提到了 sl_spawn 在您的案例中、sl_spawn 是什么?

    您是否正在使用操作系统?

    基本而言、您需要 实现已执行的 sprawn、如果执行正确、则跳转至回调 _SlDrvMsgReadSpawnCtx。 您也可以检查自己并在 _SlDrvMsgReadSpawnCtx 中放置断点。

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

     我们不使用任何操作系统、我们在项目中使用的 user.h 文件直接从 cc3100SDK-1.3.0 STM32文件中取出。

    我们将断点放置在 _SlDrvMsgReadSpawnCtx 上,但 它无法到达,而是移动到_SlNonOsSpawn (_SlSpawnEntryFunc_t pantry、void* pValue、_u32 flags)。 请提供可能性建议。

    我还有一件事需要您澄清、就是 TIME_TICK 放置一个角色、如果是、请检查并确认配置

    我的计时器时钟频率为240MHz

    #define ACLOCK_FREQ 240000000 //设置为240 [MHz]
    #define TIMER_PRESCAAR 24000//100 //值介于0和0xFFFF 之间
    #define TIMER_CLK (ACLOCK_FREQ/TIMER_PRESCAAR)//计时器频率[Hz]或周期/秒

    #define milliseconds (ms)((timer_CLK * ms)/1000)//输入:ms 的数量、输出:给定计时器频率下的节拍数
    #define TICKS_TO_milliseconds (TICKs)((TICKs)/(TIMER_CLK)/1000)//输入:节拍数、输出:给定定时器频率下的 ms 数
    #define MAX_TIMER_TICKs 0xFFFF //计时器最大计数值或计时器周期

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    计时器设置看起来正常。

    如果您进入 sl_spawn (),您会在哪里得到?

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Itzhak、

    调试时,在_SlDrvRxIrqHandler API 中,代码对 else 条件(void) sl_spawn ((_SlSpawnEntryFunc_t)_SlDrvMsgReadSpawnCtx,NULL,sl_spawn_FLAG_FROM _SL_IRQ_handler)进行统计,然后它转到_NonSpoTimeOsr_NonSpawnTimeStr (_NonSpon_NonSpurt*和_SloutStamp_NonSpurt_SloutStr (_NonSpnTimeStamp_NonSpt) 在此 API 中、代码会挂起一段时间、最后移至_SlSlSlReturnVal_t _SlDrvSyncObjWaitTimeout (_SlSyncObj_t * pSyncObj、_u32 timeoutVal、DriverIdTimeout_e API)在此处返回_DriverHandleError (sl_device_driver_timeoutVal、apix_apiAPI);

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这很奇怪。 让我向您解释一下它应该如何在您使用的 Nonos 风味中工作。

    正如 您所说的那样,sawn 将进入_SlNonOsSpawn (),实现方法只是在回调数组 中注册 CB 函数,即 SpawnEntry []。

    您可以看到实现:

    _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , _u32 flags)
    {
    	 _i8 i = 0;
    
         (void)flags;
        
    #ifndef SL_TINY_EXT 	
    	for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
    #endif     
    	{
    		_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
    	
    		if (pE->IsAllocated == FALSE)
    		{
    			pE->pValue = pValue;
    			pE->pEntry = pEntry;
    			pE->IsAllocated = TRUE;
    #ifndef SL_TINY_EXT 	                        
    			break;
    #endif                        
    		}
    	}
            
            
            return NONOS_RET_OK;
    }
    

    然后、中断上下文完成。

    此 CB 作为 _SlNonOsMainLoopTask()的一部分被调用,如实现中所示:

    _SlNonOsRetVal_t _SlNonOsMainLoopTask(void)
    {
    	_i8 i=0;
    	void*  pValue;
    
    #ifndef SL_TINY_EXT
    	for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
    #endif
    	{
    		_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
    		
    
    		if (pE->IsAllocated == TRUE)
    		{
    			_SlSpawnEntryFunc_t  pF = pE->pEntry;
    			pValue = pE->pValue;
    
    
    			/* Clear the entry */
    			pE->pEntry = NULL;
    			pE->pValue = NULL;
    			pE->IsAllocated = FALSE;
    
    			/* execute the spawn function */
                pF(pValue);
    		}
    	}
            
            return NONOS_RET_OK;
    }
    

    这是在中断上下文结束时从主上下文中调用的。

    对于所有未经请求 的事件(即未生成命令),在本例中,此主循环从您在流程 中声称您获得的 WAIT 函数本身调用,_SlNonOsSemGet ()。

    请参阅实现:

    _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout)
    {
    #if (!defined (SL_TINY)) && (defined(sl_GetTimestamp))
          _SlTimeoutParams_t      TimeoutInfo={0};
    #endif
    
    	 /* If timeout 0 configured, just detect the value and return */
          if ((Timeout ==0) && (WaitValue == *((volatile _u8 *)pSyncObj)) )
    	  {
    		  *pSyncObj = SetValue;
    		  return NONOS_RET_OK;
    	  }
    
    #if (!defined (SL_TINY)) && (defined(sl_GetTimestamp))
          if ((Timeout != NONOS_WAIT_FOREVER) && (Timeout != NONOS_NO_WAIT))
          {
        	  _SlDrvStartMeasureTimeout(&TimeoutInfo, Timeout);
          }
    #endif
    
    #ifdef _SlSyncWaitLoopCallback
        _SlNonOsTime_t timeOutRequest = Timeout; 
    #endif
        while (Timeout>0)
        {
            if (WaitValue == *((volatile _u8 *)pSyncObj))
            {
                *pSyncObj = SetValue;
                break;
            }
    #if (!defined (sl_GetTimestamp)) ||  (defined (SL_TINY_EXT))
            if (Timeout != NONOS_WAIT_FOREVER)
            {		
                Timeout--;
            }
    #else        
            if ((Timeout != NONOS_WAIT_FOREVER) && (Timeout != NONOS_NO_WAIT))
            {
                if (_SlDrvIsTimeoutExpired(&TimeoutInfo))
                {
                	return (_SlNonOsRetVal_t)NONOS_RET_ERR;
                }
    
            }
     #endif       
    
            /* If we are in cmd context and waiting for its cmd response
             * do not handle spawn async events as the global lock was already taken */
            if (FALSE == g_pCB->IsCmdRespWaited)
            {
            (void)_SlNonOsMainLoopTask();
            }
    #ifdef _SlSyncWaitLoopCallback
            if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) )
            {
                if (WaitValue == *((volatile _u8 *)pSyncObj))
                {
                    *pSyncObj = SetValue;
                    break;
                }
                _SlSyncWaitLoopCallback();
            }
    #endif
        }
    
        if (0 == Timeout)
        {
            return NONOS_RET_ERR;
        }
        else
        {
            return NONOS_RET_OK;
        }
    }

    您所需要的只是调试和理解为什么在代码中您没有到达 _SlNonOsMainLoopTask(),它位于 _SlNonOsSemGet ()内。

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Itshak、

    感谢您的回复,很遗憾,现在 评论了_SlNonOsMainLoopTask() ,我取消了对 API 及其在_SlNonOsMainLoopTask() API 中的运行的注释,它检查此条件是否为(PE->IsAllocated == true ) 但这始终为真,它将运行到 max. entries,然后从该 API 返回,最后我得到了 ASYNC_TIMEOUT_ERROR。

    在答复邮件中,您提到 了“这是在中断已经结束时从主上下文调用的”——您是说, 我在从设备接收到中断后,需要在主程序中调用 API _SLONonOSMainLoopTask()。(如果错误,请更正我)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    有人对其进行了注释、这很奇怪。

    无论如何、这是正确的、因为已将其变为 true、这是可以的。

    既然这是真的,您应该调用设置为 PE->Pendry 的回调。

    您可以在_SlNonOsMainLoopTask 中看到

    • PF = PE->Pendry;
    • /*执行 sprawn 函数*/
      PF (pValue);

    因此、您应该调用 CB。 请验证。

    关于您的另一个问题,如果您使用的是 Nonos 类型,则需要 从 main()调用_slNonOsMainLoopTask(),因为如果您不使用,您将无法读取事件。

    您可以在 SDK 上的一些 Nonos 示例中查找此调用。

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    嗨、ishtak、

    感谢您的回复,现在我可以进入_sl_NonOsMainLoopTask()。最后,当我调用 configuresumplelinktodefaultmode 时,我得到的结果是设备设置为工作站模式,之后我尝试更改为 AP 模式,但我在 sl_stop 上挂起。 请建议我解决此问题。

    /*停止 CC3100器件*/
    sl_Stop (0xFF);

    /*正在初始化 CC3100器件*/
    SL_Start (0、0、0);

    RET=SL_WlanSetMode (Role_AP);

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    每个命令都应该是可以的,因为它有一个从 _SlNonOsMainLoopTask()内部 的_SlNonOsMainLoopTask()调用的命令完成。

    但是,正如我之前提到的,如果是未经请求的事件,您需要 从主上下文中自己调用_SlNonOsMainLoopTask(),否则,任何内容都不会轮询该事件,您会被卡住。

    更改为 AP 模式是一种典型情况、因为您收到 IP_required 的未经请求的事件。 也可以在我们的 Nonos 示例中看到它。 在您的情况下、您需要按如下方式修改代码:

    /*停止 CC3100器件*/
    sl_Stop (0xFF);

    /*正在初始化 CC3100器件*/
    SL_Start (0、0、0);

    RET=SL_WlanSetMode (Role_AP);

    /*正在初始化 CC3100器件*/
    MODE = SL_Start (0、0、0);

    如果(Role_AP =模式)

    /*如果设备处于 AP 模式,我们需要等待
    *事件
    *
    while (!is_ip_acquired (g_ulStatus)){_SlNonOsMainLoopTask();}

    如果使用 sl_Stop (timeout)挂起, 应该释放 wait()的信号() 不是来自 sawn (),而是直接来自中断处理程序,因为命令完成正暂挂。 查看代码:

    if (TRUE =g_PCC->IsCmdRespited)

    OSI_RET_OK_CHECK (sl_SyncObjSignalFromIRQ (&g_PCC->CmdSyncObj));

    其他

    (空) sl_spawn ((_SlSpawnEntryFunc_t)_SlDrvMsgReadSpawnCtx、NULL、sl_spawn_FLAG_FROM sl_IRQ_handler);

    此致、

    Shlomi

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Itzhak、

    非常感谢、模块现在正在工作。