CC3000 gets wrong address when connecting to wireless AP 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 192.168.1.64.

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


running 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 172.24.1.xx, where xx is whatever number between 50 and 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). 


I can't 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.
I realized that I was using firmware v 1.34 on the board, which is what it was configured with when I got it, and decided I would try to downgrade it to one of the fir;ware sets supplied by adafruit to see if that would work.

The firmware modifying program didn't actually compile on the desktop version of the arduino ide, so I decided to use codebender instead.

I'm not sure whether or not I should be disappointed or relieved, but downgrading the firmware actually made it work. I used the file titled driverpath_1_11, which I believe the libraries refer to as firmware version 0x113 or 0x118, which identifies itself as firmware version 1.24, which somehow actually worked.

The solution is here: https://codebender.cc/sketch:318229

The pins have been changed to correspond with the fixed pings used by the tinyduino.