1

I am working on an Arduino Uno and CC3000 WiFi shield. I interfaced it over my Arduino and added the SparkFun library SFE_CC3000_Library. Then I opened the TestBoard example, but it hangs on setup in the first command wifi.init().

How can I solve this problem, and how can I enable debug mode?

Here's the code

#include <SPI.h>
#include <SFE_CC3000.h>
#include <utility/netapp.h>

#define DEBUG     1
// 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

// Constants
#define FW_VER_LEN      2   // Length of firmware version in bytes
#define MAC_ADDR_LEN    6   // Length of MAC address in bytes

// Global Variables
SFE_CC3000 wifi = SFE_CC3000(CC3000_INT, CC3000_EN, CC3000_CS);

void setup() {

  int i;
  unsigned char fw_ver[FW_VER_LEN];
  unsigned char mac_addr[MAC_ADDR_LEN];

  // Initialize Serial port
  Serial.begin(115200);
  Serial.println();
  Serial.println("----------------------------");
  Serial.println("SparkFun CC3000 - Board Test");
  Serial.println("----------------------------");

  // Initialize CC3000 (configure SPI communications)
  if ( wifi.init() ) {
    digitalWrite(13, HIGH);
    Serial.println("CC3000 initialization complete");
  } else {
    Serial.println("Something went wrong during CC3000 init!");
  }

  // Read and display CC3000 firmware version
  if ( wifi.getFirmwareVersion(fw_ver) ) {
    Serial.print("Firmware version: ");
    Serial.print(fw_ver[0], DEC);
    Serial.print(".");
    Serial.print(fw_ver[1], DEC);
    Serial.println();
  } else {
    Serial.println("Could not read firmware version from CC3000");
  }    

  // Read and display CC3000 MAC address
  if ( wifi.getMacAddress(mac_addr) ) {
    Serial.print("MAC address: ");
    for ( i = 0; i < MAC_ADDR_LEN; i++ ) {
      if ( mac_addr[i] < 0x10 ) {
        Serial.print("0");
      }
      Serial.print(mac_addr[i], HEX);
      if ( i < MAC_ADDR_LEN - 1 ) {
        Serial.print(":");
      }
    }
    Serial.println();
  } else {
    Serial.println("Could not read MAC address from CC3000");
  } 

  // Done!
  Serial.println("Finished board test");

}

void loop() {

  // Do nothing
  delay(1000);
  Serial.println("Loop_Problem");

    }

2 Answers 2

2

Solved it, the problem was because the SparkFun library was not working with my shield. I replaced it using the Adafruit_CC3000_Library and now it works fine.

0
-1

I was having the same problem with the ethernet shield (and i still have it). In my case it was caused by the network router. When my modem/router couldn't connect to the net (bad weather etc...) the shield couldn't take an IP and the initialaization was failing every time just because i was disconnected from the internet. The library works almost the same way. Basicaly you have to make sure it can connect.

1
  • Thanks for sharing solution with me. I solved it using another library. Solution is shared above. Commented Mar 12, 2015 at 11:20

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.