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 -Port to Xmega - almost there but stuck on bind !?!

Hi,

I am currently in the middle of writing my own firmware for the CC3000 on an Xmega mcu.  I started by trying to port the generic program, but gave up after too many timing issues with the initialization process.  I then moved on to writing all my own software for it and have been moving smoothly ever since.  Until I tried to bind to my open TCP socket that is.

So to be clear I have to module working very well on the init and smart config.  I am able to join my ap using the smart config process via the app and can set my profiles so that it quickly rejoins my ap upon reboot. I correctly get the connected response and then the dhcp response with my ip address and then I try to open a TCP socket as a server.

I send (equivelant of socket(af_inet, sock_stream,ipproto_tcp))01 00 11 00 00 01 01 10 0c 02 00 00 00 01 00 00 00 06 00 00 00 00

and receive 02 00 00 00 09 04 01 10 05 00 00 00 00 00 which should be correct.  

I then send (equivalent of bind(sd,&sockaddr,(sizeof(sockaddr))))01 00 19 00 00 01 02 10 14 00 00 00 00 08 00 00 00 08 00 00 00 02 00 1f 90 c0 a8 00 10 00

but i get an error in response 02 00 00 00 09 04 02 10 05 00 ff ff ff ff.  

I am trying to bind my tcp socket (sd=0) to port 8080(1f90) to ip address 192.168.0.16(c0a80010).  Does anyone have any idea how my bind packet is incorrect?  

FYI: As suggested by someone on the forum, in response to the problem of not having an full command set document for the CC3000, I am stepping thru the provide software to generate my packets to send and thus far that has worked.  I still dont fully understand why TI will not release a Command Set document for the CC3000.  If they had I would be done already and would be buying lots of cc3000 mods so i so could sell my product.  Instead I am stuck in development creaping along slowly.  TI PLEASE RELEASE A COMMAND SET PDF ASAP.  

For the others struggling with no command set I will be putting my command set on the wiki once it is complete and if nothing else maybe TI will check it for us. I will post what I have now if anyone is interested.

Thanks in advance,

Chad

  • Hi,

    When doing bind, please set "0" in the IP address field. That should work. An example:

    unsigned long sockfd = 0xFFFFFFFF;

    unsigned long sockfd_child = 0xFFFFFFFF;

    sockaddr source_addr;

    sockfd= socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

    source_addr.sa_family = AF_INET;

    // Port number
    source_addr.sa_data[0] = 0xEB;
    source_addr.sa_data[1] = 0x14;//60180

    memset(&source_addr.sa_data[2], 0, 4);

    bind(sockfd, &source_addr, sizeof(source_addr));
    listen(sockfd, 0);

    sockfd_child = accept(sockfd, &dest_addr, &addr_len); 

    Regards,

    Tomer

  • Tomer,

    That was the issue, I was using the Ip address assigned by my ap via dhcp.  

    Thank you very much for the quick reply.

    Chad

  • Hey Chad, 

    I have been struggling to get the CC3000 up but without any proper programming documentation I am stuck. 

    Would you be able to help me out with the source code you have used for your XMEGA. I am working with XMEGA B1

    Thanks a lot

  • Tomer,

    Are you saying that the bind() function ONLY accepts 0 for an IP address (0 corresponds to ADDRANY_IN) ?

    Or are you replying that you know feeding 0 to bind does work (a similar, but different reply)?

    If your reply is the latter, I fully understand that many CC3000 users will be able to do what they want to do by binding to ADDRANY_IN; but regardless of that, I would like to learn (from you, or from whoever is the right TI expert) if binding to an address other than ADDRANY_IN is possible

    Blake
  • I got tired of waiting for an answer to my follow-on question to appear here (in this thread that already contains an answer to the original poster's question).

    So to improve my chances of getting a quick answer I put my question in this fresh topic/thread: http://e2e.ti.com/support/wireless_connectivity/f/851/t/390423 Please post any answers or discussion there.