I bought a CC3000 Wifi Shield from Sparkfun and attached it to Arduino Uno board.
As first thing I tested the board with the board test example:
SparkFun CC3000 - Board Test
CC3000 initialization complete
Firmware version: 1.24
MAC address: 70:FF:76:01:30:1E
Finished board test
Then I scanned the networks:
SparkFun CC3000 - Scan Test
CC3000 initialization complete
Scanning APs. Waiting for scan to complete.
Access Points found:
SSID: dnhm MAC address: 20:AA:4B:08:AA:CC RSSI: 58 Security: WPA2
SSID: dnhm-guest MAC address: 20:AA:4B:08:AA:CE RSSI: 58 Security: Unsecured
Finished scan test
I set the SSID and the password and tried to connect:
SparkFun CC3000 - Connection Test
CC3000 initialization complete
Connecting to: dnhm
Error: Could not connect to AP
Error: Could not obtain connection details
Error: Could not disconnect from network Finished connection test
SparkFun CC3000 - Connection Test
CC3000 initialization complete Connecting to: dnhm-guest
Error: Could not connect to AP
Error: Could not obtain connection details
Error: Could not disconnect from network
Finished connection test
It did not connect none of the available connections, I reserved an IP address on the router for the mac address, but nothing changed.
I turned on logs on the router (Linksys e2500) and nothing appeared in logs as if the device never tried to connect. (I can see relevant logs when I re-connect with my notebook)
I use wpa2 so I kept the security setting as it is. I also have a 5ghz SSID and it does not show up in the scan. So I did not try to connect to it.
I also tried the smart config example with my ipad and it did not work either, the output:
SparkFun CC3000 - SmartConfig
CC3000 initialization complete
Starting SmartConfig
Send connection details from app now!
Waiting to connect…
Error: Could not connect with SmartConfig
Error: Could not obtain connection details
Looking up IP address of: www.sparkfun.com
Error: Could not lookup host by name
Pinging 0.0.0.0 3 times…
Error: no ping response
Error: Could not disconnect from network
Finished SmartConfig test
Obviously the board works (It can scan/find the networks), but cant connect them. What should I do as next step to troubleshoot the issue?
Here is the sample I used for connection testing: (I double checked the protocol from router's wifi settings to make sure I'm using the correct one)
/****************************************************************
ConnectionTest.ino
CC3000 Connection Test
Shawn Hymel @ SparkFun Electronics
January 30, 2014
https://github.com/sparkfun/SFE_CC3000_Library
Connects to the access point given by the SSID and password and
waits for a DHCP-assigned IP address. To use a static IP
address, change the #define USE_DHCP from 1 to 0 and assign an
IP address to static_ip_addr in the Constants section.
NOTE: Static IP is not working at this time.
The security mode is defined by one of the following:
WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA, WLAN_SEC_WPA2
Hardware Connections:
Uno Pin CC3000 Board Function
+5V VCC or +5V 5V
GND GND GND
2 INT Interrupt
7 EN WiFi Enable
10 CS SPI Chip Select
11 MOSI SPI MOSI
12 MISO SPI MISO
13 SCK SPI Clock
Resources:
Include SPI.h and SFE_CC3000.h
Development environment specifics:
Written in Arduino 1.0.5
Tested with Arduino UNO R3
This code is beerware; if you see me (or any other SparkFun
employee) at the local, and you've found our code helpful, please
buy us a round!
Distributed as-is; no warranty is given.
****************************************************************/
#include <SPI.h>
#include <SFE_CC3000.h>
// Pins
#define CC3000_INT 2 // Needs to be an interrupt pin (D2/D3)
#define CC3000_EN 7 // Can be any digital pin
#define CC3000_CS 10 // Preferred is pin 10 on Uno
// IP address assignment method
#define USE_DHCP 1 // 0 = static IP, 1 = DHCP
// Connection info data lengths
#define IP_ADDR_LEN 4 // Length of IP address in bytes
#define MAC_ADDR_LEN 6 // Length of MAC address in bytes
// Constants
char ap_ssid[] = "SSID"; // SSID of network
char ap_password[] = "PASSWORD"; // Password of network
unsigned int ap_security = WLAN_SEC_WPA2; // Security of network
unsigned int timeout = 30000; // Milliseconds
//const char static_ip_addr[] = "0.0.0.0";
// Global Variables
SFE_CC3000 wifi = SFE_CC3000(CC3000_INT, CC3000_EN, CC3000_CS);
void setup() {
ConnectionInfo connection_info;
int i;
// Initialize Serial port
Serial.begin(115200);
Serial.println();
Serial.println("---------------------------------");
Serial.println("SparkFun CC3000 - Connection Test");
Serial.println("---------------------------------");
// Initialize CC3000 (configure SPI communications)
if ( wifi.init() ) {
Serial.println("CC3000 initialization complete");
} else {
Serial.println("Something went wrong during CC3000 init!");
}
#if (USE_DHCP == 1)
// Connect using DHCP
Serial.print("Connecting to: ");
Serial.println(ap_ssid);
if(!wifi.connect(ap_ssid, ap_security, ap_password, timeout)) {
Serial.println("Error: Could not connect to AP");
}
#elif (USE_DHCP == 0)
// Connect using static IP
// ***TODO: Connect using static IP
#endif
// Print out connection details
if( !wifi.getConnectionInfo(connection_info) ) {
Serial.println("Error: Could not obtain connection details");
} else {
Serial.println("Connected!");
Serial.println();
// Print MAC address
Serial.print("CC3000 MAC Address: ");
for ( i = 0; i < MAC_ADDR_LEN; i++ ) {
if ( connection_info.mac_address[i] < 0x10 ) {
Serial.print("0");
}
Serial.print(connection_info.mac_address[i], HEX);
if ( i < MAC_ADDR_LEN - 1 ) {
Serial.print(":");
}
}
Serial.println();
// Print IP Address
Serial.print("IP Address: ");
printIPAddr(connection_info.ip_address);
Serial.println();
// Print subnet mask
Serial.print("Subnet Mask: ");
printIPAddr(connection_info.subnet_mask);
Serial.println();
// Print default gateway
Serial.print("Default Gateway: ");
printIPAddr(connection_info.default_gateway);
Serial.println();
// Print DHCP server address
Serial.print("DHCP Server: ");
printIPAddr(connection_info.dhcp_server);
Serial.println();
// Print DNS server address
Serial.print("DNS Server: ");
printIPAddr(connection_info.dns_server);
Serial.println();
// Print SSID
Serial.print("SSID: ");
Serial.println(connection_info.ssid);
Serial.println();
}
// Disconnect
if ( wifi.disconnect() ) {
Serial.println("Disconnected");
} else {
Serial.println("Error: Could not disconnect from network");
}
// Done!
Serial.println("Finished connection test");
}
void loop() {
// Do nothing
delay(1000);
}
// Print out an IP Address in human-readable format
void printIPAddr(unsigned char ip_addr[]) {
int i;
for (i = 0; i < IP_ADDR_LEN; i++) {
Serial.print(ip_addr[i]);
if ( i < IP_ADDR_LEN - 1 ) {
Serial.print(".");
}
}
}