I tried using both the SparkFun and Adafruit CC3000 libraries first with what I actually wanted as a program, but when that didn't work, the examples for those libraries, and I always seem to get the same problem.
The CC3000 will connect to my AP, which uses a private address in the range
172.24.1.1/24, and somehow it will end up with the address
I know that it is connecting, since iw event lists the device MAC address as it connects.
The only changes I have made to the source code at this point are the ssid and password, and changing the interrupt and vbat pins to match the configuration of the tinyduino cc3000 board.
The device has firmware 1.34. Here is the code.
The specific output I get from the arduino is as follows (Note I commented out the disconnect at the bottom):
Connected at 115200 --------------------------------- SparkFun CC3000 - Connection Test --------------------------------- CC3000 initialization complete Connecting to: my_wifi_ap Connected! CC3000 MAC Address: 70:FF:76:04:B9:5B IP Address: 192.168.1.62 Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.254 DHCP Server: 0.0.0.0 DNS Server: 192.168.1.254 SSID: my_wifi_ap Finished connection test
iw event -f on my AP before running a connection test gives me the following output:
wlan0: new station 70:ff:76:04:b9:5b
When another device, like my phone, connects to this AP, we get
xx is whatever number between
150 that DHCP assigns us.
Edit: Also, if I comment out the disconnect at the end of the test, I can see the device is sending keepalives every three or four seconds using:
iw dev wlan0 station get 70:ff:76:04:b9:5b //(inactive time never exceeds 4000ms).
ping 192.168.1.64 because that network is obviously unreachable, but trying to
ping 172.24.1.64 gives me a exception:
icmp open socket: Operation not permitted
Output from Adafruit Example:
RX Buffer : 131 bytes TX Buffer : 131 bytes Free RAM: 1221 Initialising the CC3000 ... Firmware V. : 1.32 MAC Address : 0x70 0xFF 0x76 0x04 0xB9 0x5B Started AP/SSID scan Networks found: 20 ================================================ ... SSID Name : my_wifi_ap RSSI : 83 Security Mode: 3 SSID Name : my_other_wifi_ap RSSI : 67 Security Mode: 3 ... ================================================ Deleting old connection profiles Attempting to connect to my_wifi_ap Started AP/SSID scan Connecting to my_wifi_ap...Waiting to connect...Connected! Request DHCP IP Addr: 192.168.1.62 Netmask: 255.255.255.0 Gateway: 192.168.1.254
The actual device being connected to is a Raspberry Pi AP, which was set up with DNSMASQ and hostapd. The configuration works, and has been proven to work with other embedded networking devices.