CC3000 Speeding up Connecting Time

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
technobly
 
Posts: 118
Joined: Mon Oct 31, 2011 11:06 am

CC3000 Speeding up Connecting Time

Post by technobly »

It's not much, but if you want to squeeze it, you can shave about 5.2 seconds off the connecting time.

BEFORE MOD RESULTS:
Initialization takes me about 2.6 seconds
Connecting to AP takes me about 13.4 seconds
Waiting for DHCP to resolve takes 10.2 seconds
IP Config displayed in 100ms
DNS lookup completes in 300 - 500ms

AFTER MOD RESULTS:
Initialization takes me about 2.6 seconds
Connecting to AP takes me about 8.2 seconds
Waiting for DHCP to resolve takes 10.2 seconds
IP Config displayed in 100ms
DNS lookup completes in 300 - 500ms

BEFORE MOD CODE (Adafruit_CC3000.ccp):

Code: Select all

// Connect with timeout
void Adafruit_CC3000::connectToAP(char *ssid, char *key, uint8_t secmode) {
  int16_t timer = WLAN_CONNECT_TIMEOUT;

  do {  
    /* MEME: not sure why this is absolutely required but the cc3k freaks
       if you dont. maybe bootup delay? */
    // Setup a 4 second SSID scan
    scanSSIDs(4000);
    // Wait for results
    delay(4500);
    scanSSIDs(0);
AFTER MOD CODE (Adafruit_CC3000.cpp):

Code: Select all

// Connect with timeout
void Adafruit_CC3000::connectToAP(char *ssid, char *key, uint8_t secmode) {

  do {  
    int16_t timer = WLAN_CONNECT_TIMEOUT; // inside the do-while() to reset timer
    // Setup a 10 minute SSID scan, don't wait for results... stop it right away.
    scanSSIDs(1); // 1 = 10 mins, 2-1000 = 1000, above that equals that time in ms
    scanSSIDs(0); // stop the SSID scan
Reference to the routine used in scanSSIDs()
http://software-dl.ti.com/ecs/simplelin ... 557c18ed0e

One extra improvement here is moving the 'timer' initialization into the do-while() loop. This is necessary if you don't connect the first time, to reset the timer... or it will be zero the next time through.

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

Re: CC3000 Speeding up Connecting Time

Post by adafruit_support_mike »

Interesting technique.. thanks!

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

Return to “Other Arduino products from Adafruit”