CC3000 randomly locks up

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

CC3000 randomly locks up

Post by philg »

I have a cc3000/Uno collecting data and posting it to a database on my LAN. After running for some time, it stops and locks up in the readResponse routine. A reset fixes the problem each time but I would like to have it run continuously unattended. The cc3000 firmware is v1.24. Here's the routine where it is when it stops while printing chars to the screen while in debug mode. I have similar Unos running on the same LAN but using ethernet shields and they have been working for 3 months without a hitch.

Code: Select all

/**************************************************************************/
/*
    Read and display response from server
    Return true if client was available
*/
/**************************************************************************/
boolean readResponse(Adafruit_CC3000_Client cl)
{
  boolean stat = false;
  /* Read data until either the connection is closed, or the idle timeout is reached. */ 
  unsigned long lastRead = millis();
  while (cl.connected() && (millis() - lastRead < IDLE_TIMEOUT_MS)) 
  {
    while (cl.available()) 
    {
      char c = cl.read();
      DEBUG_PRINT(c);
      lastRead = millis();
      stat = true;
    }
  } 
 return stat; 
}
Update: It just locked up at the following location:

Code: Select all

    DEBUG_PRINTLNF(F("\n...Connecting..."));      
    Adafruit_CC3000_Client server = cc3000.connectTCP(ServerIP, 80); 
    delay(100);    

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 randomly locks up

Post by adafruit_support_mike »

Try adding a call to cc3000.checkConnected() to make sure the wifi link is still active before calling any functions that need it.

Wifi connections are much more susceptible to noise and interference than wired ones. It isn't a question of whether the link will drop, but when.

User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

Re: CC3000 randomly locks up

Post by philg »

I'll give it a try. Thanks Mike.

User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

Re: CC3000 randomly locks up

Post by philg »

I added code with checkConnected that does a reboot if necessary. It still eventually failed while receiving the reply from the server.

Code: Select all

/**************************************************************************/
/*
    Restart CC3000 using reboot then (re)connect
*/
/**************************************************************************/

void reConnectIfNecessaryCC3000()
{
  if(! cc3000.checkConnected() )
  {
    cc3000.reboot();
    delay(3000);
    // Now connect to the AP again 
     DEBUG_PRINT(F("\nAttempting to connect to ")); DEBUG_PRINTLN(WLAN_SSID);
    if (!cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY)) 
    {
      DEBUG_PRINTLN(F("Failed!"));
      while(1);
    }
    
    DEBUG_PRINTLN(F("Connected!"));
    delay(1000);
      /* Display the IP address DNS, Gateway, etc. */  
      displayConnectionDetails();
  }
}
Is there something else I can try?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 randomly locks up

Post by adafruit_support_mike »

I can't think of anything short of a full power cycle.

User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

Re: CC3000 randomly locks up

Post by philg »

Really? Is this a TI bug? Is there a hardware watchdog that can be enabled in Arduino?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 randomly locks up

Post by adafruit_support_mike »

It sounds like you're running into a cache overflow in the CC3000 firmware, and yes, that's a TI bug.

The Arduino does have a watchdog timer, but you could probably use clock-based interrupts too. Set a timeout interval just before calling a function that could hang, then clear it immediately after the function call. If the call succeeds, the timeout gets shut down before doing anything. If the call hangs, the timeout will trigger an interrupt handler that can do damage control.

User avatar
philg
 
Posts: 90
Joined: Sun Mar 06, 2011 4:42 pm

Re: CC3000 randomly locks up

Post by philg »

I can do that. So there is no newer version of the fw that fixes this? Is it on their radar?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: CC3000 randomly locks up

Post by adafruit_support_mike »

You'd have to check with TI on that. There have been a couple of upgrades since we first started using the CC3000, but knowing a bug exists is different from knowing whether you can fix it in code or need to spin hardware changes into the chip.

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

Return to “Arduino Shields from Adafruit”