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.

gets stuck in event handler loop.

Hi

While working with stm32f103 and cc3000 chip combination (wifi project) , my code is getting stuck in event handler. Actually it is completing smart configuration and getting some dynamic IP address also. Initially it is getting through event handler , but after half or 1 sec it is getting stuck in event handler of cc3000 and it seems to be waiting for some interrupt. cc3k_int_poll();. and not getting ahead of 1st if-loop.

Initially it works properly and automatically after sometime gets stuck...so what might be the issue? Same is repeating after reset.

some part of event handler code i have written below

UINT8 * hci_event_handler(void *pRetParams, UINT8 *from, UINT8 *fromlen)
{
    UINT8 *pucReceivedData, ucArgsize;
    UINT16 usLength;
    UINT8 *pucReceivedParams;
    UINT16 usReceivedEventOpcode = 0;
    UINT32 retValue32;
    UINT8 * RecvParams;
    UINT8 *RetParams;


    while (1)
    {
         cc3k_int_poll();
        if (tSLInformation.usEventOrDataReceived != 0)
        {                
            pucReceivedData = (tSLInformation.pucReceivedData);

            if (*pucReceivedData == HCI_TYPE_EVNT)
            {
                // Event Received
                STREAM_TO_UINT16((CHAR *)pucReceivedData, HCI_EVENT_OPCODE_OFFSET,
                    usReceivedEventOpcode);
                pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;        
                RecvParams = pucReceivedParams;
                RetParams = pRetParams;

                // In case unsolicited event received - here the handling finished
                if (hci_unsol_event_handler((CHAR *)pucReceivedData) == 0)
                {
                    STREAM_TO_UINT8(pucReceivedData, HCI_DATA_LENGTH_OFFSET, usLength);

                    switch(usReceivedEventOpcode)
                    {       

  • Hi Tejas,

    What is the implementation of cc3k_int_poll(); ?

    What is the SDK version and Service Pack version that you are using? Can you please use the host driver that is provided with the SDK?

    Regards,
    Raghavendra

  • Hi Raghavendra

    void cc3k_int_poll()
    {
      if (ReadWlanInterruptPin() == 0 && ccspi_is_in_irq == 0 && ccspi_int_enabled != 0)
      {
         cc3000_irq();
      }
    }

     void cc3000_irq()  
            {    
              Delay(10);
      ccspi_is_in_irq = 1;
            if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
            {
                /* This means IRQ line was low call a callback of HCI Layer to inform on event */
                 sSpiInformation.ulSpiState = eSPI_STATE_INITIALIZED;
            }
            else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE)
            {
                sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;
                            
                /* IRQ line goes down - start reception */
                ASSERT_CS();

                //
                // Wait for TX/RX Compete which will come as DMA interrupt
                //
                    SpiReadHeader();

                sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;

                SSIContReadOperation();
            }
            else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ)
            {
                SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength);

                sSpiInformation.ulSpiState = eSPI_STATE_IDLE;

                DEASSERT_CS();
            }    
    ccspi_is_in_irq = 0;
    }

    SDK version i am using is 1.12,

    I am using host driver version 15.

    Thanks and regards

    Tejas Pidkalwar

  • Hi Tejas,

    After getting the dynamic IP what command was sent to the chip that made it wait for the IRQ line (command complete event)?

    Regards,
    Raghavendra

  • Hi Raghavendra,

    Its not getting stuck exactly after getting IP address. The actual scenario is

    -after getting IP address it will go to scheduler(which is in while(1) loop, continuously scheduling tasks) where few tasks are scheduled to perform

    -among those task receive data is 1 task, where data is received over wifi

    -when it will be waiting for receiving data it will continuously go through event handler loop which i have mentioned above and it will be getting interrupt which why it passes through that event handler loop

    -But as soon as i start sending packets over wifi , jst after 1-2 packets it will get stuck in there waiting for interrupt and i checked probing to interrupt pin what i found is that interrupt is not occurring  only, which is why gets stuck there.

    -that's why my guess was there might be any internal memory which is getting full,

    Regards

    Tejas

  • Hi Tejas,

    Can you please use the standard host driver that is released with the 1.12 SDK release and test this?
    It looks like the driver that you are using now is a customized driver. It is also important to use the corresponding Service Pack along with this (1.26 in this case).

    Regards,
    Raghavendra
  • Hi

    My project uses main board as STM32f103 MCU and CC3000 as daughter board and uses SPI as main communication. Both boards hardware designed by us. In this project application, we are communicating with CC3000 from our android based app. This mobile app will use IP address assigned to CC3000 after smart configuration to connect to CC300 over TCP/IP. This app will send some commands in the form of string packets to CC3000 which will be transferred to main board for further process and in return it will send acknowledgment in string packet format and will come to mobile app via CC3000.


    With this setup, all initial process ( smart config, mobile app connection) works in proper way. Even we are able to process some specific number of commands. But after some specific number of commands process, code will get stuck in event-handler waiting for interrupt to occur. What we found is it will allow some specific amount bytes data transfer and after that wont take any data in. No interrupt occur and all communication lines between main board and daughter board will be idle. So need help here with this issue, why this is happening?

    We tried hardware setup with main board stm32f103 (our designed) and CC3000 TI evaluation board, here it was working completely fine without getting stuck.

    So i am not getting whether software issue or hardware?

  • Hi Tejas,

    As indicated in the other E2E thread (e2e.ti.com/.../1450574) , can you please use the standard CC3000 host driver from 1.12 SDK and share your results?
    Also, what has changed in the software since you tested with the working "stm32f103 and CC3000 TI evaluation board"?

    Regards,
    Raghavendra
  • Hi Raghavendra,

    I am using standard CC3000 host driver from 1.12 SDK.

    And while using stm32f103 and TI evaluation CC3000 board , i am not changing any code, same code i am using here also. By just replacing daughter board with TI evaluation board, and same main board with same code i am trying.

    Thanks and Regards
    Tejas
  • Hi Raghavendra,

    I am using standard host driver of SDK 1.12, integrated with our application code.
    Now we are using here, CC3000 board designed by us with main board STM32f103. But same code when we are using with same main board STM32f103 and TI evaluation CC3000 board, complete process works fine.

    Thanks and Regards

    Tejas

  • Hi Tejas,

    The above driver code with cc3k_int_poll etc, does not look to be a code from CC3000 standard driver. You can download the driver from: processors.wiki.ti.com/.../CC3000_Wi-Fi_Downloads.

    Also, can you please share the air sniffer logs? Also, logs from the host driver printing all the cmd/event pair would help.

    Regards,
    Raghavendra
  • Hi Raghavendra

    Sorry to be late here. Whatever host driver code we are using is same as original one, except polling interrupt which is cc3k_int_poll. I tried by putting original host driver code also, but no progress.

    And sorry we dont have air sniffer.

    Thanks and Regards

    Tejas

  • Hi Tejas,

    Thanks for the confirmation. Would it be possible to share the host driver logs (command / event pair) as requested above? I would like to understand which command is creating issue.

    Please use the 1.12 driver and add logs in evnt_handler.c for all the received events. And print the command opcodes in 'hci_command_send' function.

    Regards,
    Raghavendra
  • Hi Raghavendra

    As we are not using UART in our project, i cant save the host driver logs. Can you suggest me any way to log/print the commands? Is wifi-sniffer logs will be helpful for you?

    Thanks and Regards

    Tejas
  • Hi Tejas,

    The wifi sniffer logs would help. Along with that, an understanding of what command causes the problem would have been even more helpful.
    If there is a way to check these commands on your platform please make a note of them and share it.

    Would it also be possible to pull the debug logs from CC3000? (processors.wiki.ti.com/.../CC3000_Logger)

    Regards,
    Raghavendra
  • Hi Raghavendra,

    Sorry, I dont have air sniffer to capture logs.

    Can u help me with using CC3000 as constant packet mode? How to make CC3000 work in Constant packet mode? Is there any production binary for this? If it is there, where it will be available? and how to download that in CC3000?

    Thanks and Regards
    Tejas
  • Hi Tejas,

    Can you please explain a bit more in detail about constant packet mode?

    Regards,
    Raghavendra
  • Hi Raghavendra

    This problem is solved. The problem was because of patches were not getting updated properly in our CC3000 module. Thanks for your support.

    Now 1 issue i am facing is DHCP lease timeout. After DHCP , CC3000 is getting dynammic IP address, but it is getting lost after 2-3 hours. I want it to be remain forever. To configure this , following API is also available.

    INT32 netapp_timeout_values(UINT32 *aucDHCP, UINT32 *aucARP,UINT32 *aucKeepalive, UINT32 *aucInactivity)

    i tried calling this API, with all values as 0, still problem is not solved. Can you help me with this? Where exactly we should call this API? and What values we should pass so that IP assigned will be forever?

    Thanks and Regards,
    Tejas
  • Hi Tejas,

    Can you please try aucDHCP with 0xffffffff? I would suggest that you try this with a different AP as well to see if the behavior remains the same.

    Regards,
    Raghavendra