CC3000 Breakout Whistling?!

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mackintosh18
 
Posts: 4
Joined: Sun Aug 24, 2014 4:52 pm

CC3000 Breakout Whistling?!

Post by mackintosh18 »

I purchased a CC3000 breakout board from Adafruit several months ago. I finally got around to using it... and it worked great! As of yesterday, it's been failing to connect to the network 9 times out of 10. I assumed it was related to this note in the example code "NOTE: This sketch may cause problems with other sketches since the .disconnect() function is never called, so the AP may refuse connection requests from the CC3000 until a timeout period passes. This is normal behaviour since there isn't an obvious moment to disconnect with a server." However, I realized my board was making an inconsistent whistling noise, like a leaking capacitor... And the board is hot... I played around with it and determined the following: the whistling only occurs after the reset button is pressed. When the Arduino is physically unplugged, and plugged in again, the CC3000 operates normally (no whistling, no heat, code works). Is my unit faulty or am I doing something wrong? I'm pretty sure my wiring is correct as the board operates normally at boot. I'll produce a drawing and image showing my wiring if necessary.

The code I've been running is a telnet server that echos text to an Adafruit 1.8" tft display. Here is the code:

Code: Select all

#include <Adafruit_CC3000.h>
#include <SPI.h>
#include "utility/debug.h"
#include "utility/socket.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>

//definitions required for CC3000 wifi module
//i.e. pin marked IRQ on Adafruit CC3000 breakout is wired to pin 3
//use standard SPI pins, SCK = 13, MISO = 12, and MOSI = 11
#define ADAFRUIT_CC3000_IRQ 3
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
//modify these for your network!
#define WLAN_SSID "home"           
#define WLAN_PASS "brent4445"
//other security types include WLAN_SEC_UNSEC, WLAN_SEC_WEP, or WLAN_SEC_WPA, WLAN_SEC_WPA2
#define WLAN_SECURITY WLAN_SEC_WPA2
#define LISTEN_PORT 23

//tft display defines
//use standard SPI pins, SCK = 13, MISO = 12, and MOSI = 11
#define cs 9
#define dc 8
#if defined(__SAM3X8E__)
    #undef __FlashStringHelper::F(string_literal)
    #define F(string_literal) string_literal
#endif


Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIVIDER);
Adafruit_CC3000_Server server(LISTEN_PORT);
Adafruit_CC3000_Client client;
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, 0);

void setup() {
  Serial.begin(9600);
  
  /*
    Here's a list of colors!
    ST7735_RED, ST7735_MAGENTA, ST7735_YELLOW, ST7735_GREEN, ST7735_BLUE,
    ST7735_BLACK, ST7735_WHITE.
  */
  
  //fixes silly pixel offset
  tft.initR(INITR_BLACKTAB);
  
  //initial tft display settings
  tft.fillScreen(ST7735_BLACK);
  tft.setTextColor(ST7735_GREEN);
  tft.setTextWrap(true);
  tft.setCursor(0,0);
  
  //initialze cc3000 module
  tft.println(F("Initializing wifi..."));
  if (!cc3000.begin()) while(true) ;
  
  //connect to network
  tft.println(F("Connecting..."));
  if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) {
    tft.println(F("Error connecting!"));
    while(true) ;
  }

  //acquire IP address from DHCP
  tft.println(F("Acquiring IP... "));
  while (!cc3000.checkDHCP()) delay(500);

  //print ip address to serial.
  while (!displayConnectionDetails()) delay(1000);
  
  //start server
  server.begin();
  
  tft.println(F("Listening..."));
}

void loop() {
  //try and grab a client
  Adafruit_CC3000_ClientRef client = server.available();

  //if a client was in fact grabbed, do stuff
  if (client) {
    //tft.print(server.read()) method works fine. i.e. buffer hop.
    
    char input[64];
    promptUser(input, client, sizeof(input)/sizeof(char));
    
    //print it!
    tft.println(input);
  }
  
  //long refresh is fine.
  delay(1000);
}

//Adafruit's nice little print function
bool displayConnectionDetails(void) {
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv)) return false;
  else {
    Serial.print(F("\nIP address: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCP: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNS: ")); cc3000.printIPdotsRev(dnsserv);
    Serial.println();
    return true;
  }
}

void promptUser(char *input, Adafruit_CC3000_ClientRef client, int len) {  
  if (client) {
    //wait until receives data
    while (!client.available());
    //wait ridiculously long time for bytes to accumulate in buffer.
    delay(1000);
    
    //read byte into input if available and not newline character
    //throw a \0 on the end
    int place = 0;
    char ch;
    for (int i = 0; i < len-1 && client.available() && (ch = client.read()) != '\n'; i++) {
      *(input+i) = ch;
      place = i;
    }
    *(input+place+1) = '\0';
  }
}

User avatar
mackintosh18
 
Posts: 4
Joined: Sun Aug 24, 2014 4:52 pm

Re: CC3000 Breakout Whistling?!

Post by mackintosh18 »

Now the device always whistles, regardless of how I start the sketch (replug or reset).

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: CC3000 Breakout Whistling?!

Post by Franklin97355 »

OK, time for pictures. Could you post clear, detailed pictures of both sides of your board showing any soldering you have done and the connections to it?

User avatar
mackintosh18
 
Posts: 4
Joined: Sun Aug 24, 2014 4:52 pm

Re: CC3000 Breakout Whistling?!

Post by mackintosh18 »

Sure thing! Sorry I took so long; it was a secondary project and I forgot about it. Something else broke and it reminded me of this! It worked fine for a while. I attached pictures of the board and an old picture of the project working.

http://imgur.com/a/FCbQ9

Thank you!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”