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.
2 Answers 2
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.
-
1Please accept either your answer or the other so that the question shows as resolved and does not keep getting churned up for attention.Chris Stratton– Chris Stratton2017年07月24日 16:20:03 +00:00Commented Jul 24, 2017 at 16:20
Welcome to the wonderful world of Adafruit software. Some genius decided that the CC3000 should save the first address it is ever given to nonvolatile storage, and use that ever since no matter what DHCP may subsequently tell it. Check the library source.
-
I solved it by downgrading the firmware to one that was suggested for use with the adafruit library, but that actually seems like an equally plausible reason as to why it wasn't working. Not sure why the Sparkfun library also failed to work, too, but that one is pretty clearly a WIP.Partinarel– Partinarel2016年05月30日 02:59:50 +00:00Commented May 30, 2016 at 2:59
new station
? Can you post the output from the Adafruit example?