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.

CC3000 recvfrom receive problem

Hi,
CC3000 connected WLAN and CC3000 opened socket TCP.
I use recvfrom fonction for receive data from TCP server.
iReturnValue = recvfrom(ulSocket, pucCC3000_Rx_Buffer, CC3000_APP_BUFFER_SIZE, 0, &tSocketAddr, &tRxPacketLength);
and than microcontroller waits CC3000 response.
Microcontroller always wait that response. CC3000 doesn't send HCI_EVNT_RECVFROM. Only CC3000 send HCI_EVNT_RECVFROM when TCP server send any data to CC3000 modul. 

iReturnValue = recvfrom(ulSocket, pucCC3000_Rx_Buffer, CC3000_APP_BUFFER_SIZE, 0, &tSocketAddr, &tRxPacketLength);
SPI
TX 01 00 11 00 00 01 0D 10 0C 00 00 00 00 0F 00 00 00 00 00 00 00 00
RX 02 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Descriptions
01 WRITE
00 11 Payload length
00 00 BUSY BUSY
SPI PAYLOAD
01 HCI_TYPE_CMND
0D 10 COMMAND OPERATION CODE  (HCI_CMND_RECVFROM)
0C ARGUMENT LENGTH
00 00 00 00 0F 00 00 00 00 00 00 00 HCI Payload
00 OPTIONAL PADDING

CC3000 doesn't response. Always wait.

After TCP server send data(0xa1) to CC3000.

SPI

TX 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
RX 02 00 00 00 11 04 0D 10 0D 00 00 00 00 00 01 00 00 00 01 00 00 00
02 REPLY
00 00 BUSY
00 11 PAYLOAD LENGTH HIGH BYTE + LOW BYTE
04 HCI_TYPE_EVNT
0D 10 EVENT OPERATION CODE LOW BYTE + HIGH BYTE (HCI_EVNT_RECVFROM)
0D ARGUMENT LENGTH
00 00 00 00 00 01 00 00 00 01 00 00 HCI PAYLOAD
00 OPTIONAL PADDING

TX 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
RX 02 00 00 00 1F 02 84 18 19 00 00 00 00 00 0C 00 00 00 01 00 00 00 00 00 00 00 02 00 15 B3 C0 A8 01 02 A1

02 REPLY
00 00 BUSY
00 1F PAYLOAD LENGTH
02 HCI_TYPE_DATA
84 DATA OPERATION CODE (HCI_DATA_RECVFROM)
18 ARGUMENT LENGTH
19 00 PAYLOAD LENGTH LOW BYTE + HIGH BYTE
00 00 00 00 0C 00 00 00 01 00 00 00 00 00 00 00 02 00 15 B3
C0 A8 01 02 PC IP ADDRESS
A1 DATA

Regards&Thanks

Hakki

  • Hi Hakki,

    That is the right behavior. When you call recvfrom, you will not get a command complete event immediately. You will get the event when the remote device sends you the data. You will get 2 kinds of packets. First would Command complete event, which is followed by the actual data.

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,

    Thank you for informaiton. If Tcp server did'nt send data to CC3000. How to return function? Can I use methode for return function?

     

    Regards

    Hakki

  • Hi Hakki,

    If you want to unblock from waiting on recv., then please use non-blocking recv.

    You can call the setsockopt for the following opt name 'SOCKOPT_RECV_NONBLOCK'. This will make the sequence not to block at the recv API.

    Thanks & Regards,
    Raghavendra

  • Hi Raghavendra,

    Thank you very much. I will be try.

    Have a nice day.

     

    Regards

    Hakki

  • May I know is there a pause between the first package of data received and the second package of data received?
    I manage to get the first response as yours. But, when I waiting for the IRQ to go HIGH again, it waits forever. May I know how you get the second data package with the data on it? Thanks!


    Code:

    TX 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
    RX 02 00 00 00 11 04 0D 10 0D 00 00 00 00 00 01 00 00 00 01 00 00 00

    Any Pause in between here?

    TX 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
    RX 02 00 00 00 1F 02 84 18 19 00 00 00 00 00 0C 00 00 00 01 00 00 00 00 00 00 00 02 00 15 B3 C0 A8 01 02 A1