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.

How to Accept the TCP connection in CC3000 with SPI Command Code?

Hi Everyone,

I am currently trying to connect the CC3000 to low-level MCU with SPI. I managed to connect to the AP and connect to the Wifi, Sending TCP data successfully, but when comes to receiving data. The website doesn't even show a sign on how to build up the HCI_CMND as shown in this page . And I get stuck somewhere in the Accept() function for my TCP connection. May I know is there any solution on this? And, where can I get the full SPI Command Code instead of the fracture version?

Sincerely,

Kwan

  • Hi Kwan,

    We do not have any document describing this. I would suggest you to take a look at the standard host driver code that is available. This should be able to show you the way to form the exact command for accept.

    Regards,
    Raghavendra
  • Hi Raghavendra,

    Below are the steps I did to initiate the TCP server mode for the CC3000:

    1. HCI_CMND_Socket

    2. HCI_CMND_BIND

    3. HCI_CMND_LISTEN

    4. HCI_CMND_ACCEPT

    (From this HCI_CMND_ACCEPT, I manage to connect to the CC3000 with the Telnet. But, the new port giving is a "-2" without any new port number returned. The opcode is as below:

    HCI_CMND_ACCEPT
    TX:  01 00 09 00 00 01 05 10 04  00 00 00 00 00
    RX: 02 00 FF 00 00 00 00 00 00  00  00 00 00 00

    HCI_EVNT ACCEPT

    TX:  03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    RX: 02 00 00 00 15  04 05 10 11 00 00 00 00 00 FE FF FF FF 02 00 00 00 00 00 00

    As you can see, it's giving a new port value with "-2". It's seem like keep waiting for another connection while the Telnet has been connected to it.

    May I know is there any fix to it?

  • Hi Kwan,

    The error code -2 is not an error as such. It is EAGAIN. That is, if you get -2, please keep calling accept again until any other occurs or the connection succeeds.

    Regards,
    Raghavendra
  • Hi Raghavendra,

    But, the Telnet already connected to it. And, I tried to connect it with a C# program, I tried to delay by 3 second before Accept() as well. Still, it's keep waiting.

    Sincerely,

    Kwan

  • Hi Raghavendra,

    I done with the Accept() part by keep spamming it, may I know what about the RECV() part? Is it like the Accept part? Or just call it for once and keep waiting for response?

    Thanks.

    Sincerely,
    Kwan