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.

What is the SPI argument format for the HCI_CMND_CONNECT command?

I am writing an open source managed driver for the CC3000.  I have many of the basic SPI commands working, but I can't get the HCI_CMND_CONNECT arguments right.  In accordance with the guide, I have set my policy to 0,0,0 and want to directly connect to a particular ssid.  I also have the Stellaris working with the CC3000, but the example for connecting to AP (Command 02 following by ssid and ssid length) does not seem to work.  When I look at the SPI command in my logic analyzer, I don't the the SSID (encoded in ASCII) anywhere in the message transmitted.  Is there an updated/patched version of this example that can connect explicitly?  

Does anyone have the argument format (byte sizes and order) for the HCI_CMND_CONNECT SPI command?  Obviously, referencing the non-working example is not useful.  

Or Can anyone give me a logic Analyzer trace (or byte array) of an example connection with SSID encoded?  

Thanks.  

  • OK, I did some digging and found an SPI trace on the internet that contains a garbled version of the connect command.  It greatly helped me understand the arguments. I annotated it below.  Using this as a guide, I was able to make the connect command work.  

    0x01, 0x00, 0x39, 0x00, 0x00, 0x01, 0x01, 0x00, 0x34, 0x1C, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x50, 0x2D, 0x4C, 0x49, 0x4E, 0x4B, 0x5F, 0x32, 0x43, 0x45, 0x39, 0x31, 0x45, 0x64, 0x65, 0x61, 0x64, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61

    0x01, Write
    0x00, 0x39, Length
    0x00, 0x00, Busy bytes
    0x01, Type Command
    0x01, 0x00, Opcode Wlan connect 0001
    0x34, ArgsLength, this is the whole payload size
    0x1C, 0x00, 0x00, 0x00, A constant of some sort -- 0x0000001c
    0x0E, 0x00, 0x00, 0x00, SSID Length, 0x0E is 14 in decimal
    0x03, 0x00, 0x00, 0x00, SSID Type (3 == WPA2)
    0x1E, 0x00, 0x00, 0x00, SSID Length + 0x10 (note: that is 10h which is 16 decimal)
    0x0A, 0x00, 0x00, 0x00, Key Length
    0x00, 0x00, Divider bytes?
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, Bssid? 6 * 0x00
    0x54, 0x50, 0x2D, 0x4C, 0x49, 0x4E, 0x4B, 0x5F, 0x32, 0x43, 0x45, 0x39, 0x31, 0x45, SSID Ascii for TP-LINK_2CE91E
    0x64, 0x65, 0x61, 0x64, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 Key in Ascii, but we have an extra byte. Codes for: deadaaaaaaa

  •  

      bytefill(@spi_buffer,0,128)                            'fill in everything with 0
      word[@spi_buffer] := $0100                             'cmdtype
      word[@spi_buffer+2] := $0001                           'cmd value
      spi_buffer[4] := strsize(ssid)+strsize(sec)+28         'hci lenght  max 255
      spi_buffer[5] := $1c                                   'opcode
      spi_buffer[9] := strsize(ssid)                         'ssid lengt
      spi_buffer[13] := sectype                              'sequrity type
      spi_buffer[17] := strsize(ssid)+16                     'ssid lengt+16
      spi_buffer[21] := strsize(sec)                         'key lengt
      bytemove(@spi_buffer+33,ssid,strsize(ssid))            'fill in ssid
      bytemove(@spi_buffer+33+strsize(ssid),sec,strsize(sec))'fill in key
                                 

  • This thread was about HCI_CMND_WLAN_CONNECT.  Not HCI_CMND_CONNECT which is a socket command.  Sorry for the typos.