CC3000 WebClient buffered read() is slow. [SOLVED]

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 WebClient buffered read() is slow. [SOLVED]

Post by technobly »

I've been trying hard to get the Arduino Ethernet shield to read data fast and it's fairly slow, maybe 3kbytes/second.

So I figured I'd see how fast the CC3000 could go, since it is a newer part maybe it has better stuffs.

So far I've tried the out of the box WebClient example and pointed it to a jpg that I know I can download in 12 seconds with the Ethernet shield. This is actually pretty slow for a 49kB file. That said, the single byte read() function of the WebClient example is dog slow... coming in somewhere around 160 seconds!

After that baseline test, I went straight after getting the buffered read() function working... and when I finally did, I did not see much of any improvement. I don't know if this matters but one thing I don't understand yet is the flags argument of the buffered read(). What are we supposed to set this to? I tried 0, 1, 2... those don't do anything different. Right now in my code you can see it's set to 0. Digging in the code utility files it seems it relates to blocking vs non-blocking mode, and that it's always blocking no matter what you set it to... but then why have it there?

There are also periods of time between reading 64 bytes at a time that there is NO data available. This is something that the Ethernet shield does as well that I would like to figure out.

Please try my code, and let's speed this puppy up!

Code: Select all

// MODIFIED WebClient example to use Buffered Read()
/*************************************************** 
  This is an example for the Adafruit CC3000 Wifi Breakout & Shield

  Designed specifically to work with the Adafruit WiFi products:
  ----> https://www.adafruit.com/products/1469

  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/
 
 /*
This example does a test of the TCP client capability:
  * Initialization
  * Optional: SSID scan
  * AP connection
  * DHCP printout
  * DNS lookup
  * Optional: Ping
  * Connect to website and print out webpage contents
  * Disconnect
SmartConfig is still beta and kind of works but is not fully vetted!
It might not work on all networks!
*/
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
//#include <Flash.h>
#include <string.h>
#include "utility/debug.h"

// These are the interrupt and control pins
#define ADAFRUIT_CC3000_IRQ   3  // MUST be an interrupt pin!
// These can be any two pins
#define ADAFRUIT_CC3000_VBAT  5
#define ADAFRUIT_CC3000_CS    10
// Use hardware SPI for the remaining pins
// On an UNO, SCK = 13, MISO = 12, and MOSI = 11
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT,
                                         SPI_CLOCK_DIV2); // you can change this clock speed

#define WLAN_SSID       "SSID"           // cannot be longer than 32 characters!
#define WLAN_PASS       "password"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2

// What page to grab!
#define WEBSITE      "www.fightcube.com"
#define WEBPAGE      "/testwifi/lava.jpg"


/**************************************************************************/
/*!
    @brief  Sets up the HW and the CC3000 module (called automatically
            on startup)
*/
/**************************************************************************/

uint32_t ip;

void setup(void)
{
  Serial.begin(115200);
  Serial.println(F("Hello, CC3000!\n")); 

  displayFreeRam();
  
  /* Initialise the module */
  Serial.println(F("\nInitializing..."));
  if (!cc3000.begin())
  {
    Serial.println(F("Couldn't begin()! Check your wiring?"));
    while(1);
  }
  
  // Optional SSID scan
  // listSSIDResults();
  
  cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);

  /* Try to use the smart config app (no   AES encryption)  */
//  Serial.println(F("Waiting for SmartConfig connection (~60s) ..."));
//  if (!cc3000.startSmartConfig(false))  {
//    Serial.println(F("SmartConfig failed"));
//    while(1);
//  }

   
  Serial.println(F("Connected!"));
  
  /* Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP())
  {
    delay(100); // ToDo: Insert a DHCP timeout!
  }  

  /* Display the IP address DNS, Gateway, etc. */  
  while (! displayConnectionDetails()) {
    delay(100);
  }

  ip = 0;
  // Try looking up the website's IP address
  Serial.print(WEBSITE); Serial.print(F(" -> "));
  while (ip == 0) {
    if (! cc3000.getHostByName(WEBSITE, &ip)) {
      Serial.println(F("Couldn't resolve!"));
    }
    delay(100);
  }

  cc3000.printIPdotsRev(ip);
  
  // Optional: Do a ping test on the website
  //Serial.print(F("\n\rPinging ")); cc3000.printIPdotsRev(ip); Serial.print("...");  
  //int replies = cc3000.ping(ip, 5);
  //Serial.print(replies); Serial.println(F(" replies"));

  /* Try connecting to the website */
  Adafruit_CC3000_Client www = cc3000.connectTCP(ip, 80);
  if (www.connected()) {
    www.print(F("GET "));
    www.print(WEBPAGE);
    www.print(F(" HTTP/1.0\r\n"));
    www.print(F("Host: ")); www.println(WEBSITE);
    www.println(F("Connection: close"));
    www.println();
  } else {
    Serial.println(F("Connection failed"));    
    return;
  }

  Serial.println(F("-------------------------------------"));
  Serial.println(F("Downloading lava.jpg... "));
  
  uint32_t start_time;
  uint16_t total_size;
  start_time = millis();
  total_size = 0;
  char buffer[64];
  uint32_t flags = 0;
  uint16_t last_size;
  
  while (www.connected()) {
    while (www.available()) {
      //int16_t Adafruit_CC3000_Client::read(void *buf, uint16_t len, uint32_t flags) 
      last_size = www.read(buffer, sizeof(buffer), flags); // buffer, length, flags
      if(last_size == -1) {
        Serial.print("."); // connected, but no data.
      }
      else {
        total_size += last_size;
      }
      Serial.print(F("Rcv'd: ")); // slows things down a little, 
      Serial.print(last_size);    // not much faster if commented out though
      Serial.println(F(" bytes.")); //
    }
    Serial.println(F("No data available... "));
  }
  Serial.println(F("Request complete!"));

  // Calculate download time
  Serial.print(F("Read ")); Serial.print(total_size); Serial.print(F(" bytes in "));
  Serial.print(millis() - start_time); Serial.println(F("ms - "));
  Serial.print((float)total_size/((millis() - start_time)/1000)); Serial.println(F("Bytes/s"));

  www.close();
  Serial.println(F("-------------------------------------"));
  
  /* You need to make sure to clean up after yourself or the CC3000 can freak out */
  /* the next time your try to connect ... */
  Serial.println(F("\n\nGood Bye!"));
  cc3000.disconnect();
  
}

void loop(void)
{
}

/**************************************************************************/
/*!
    @brief  Begins an SSID scan and prints out all the visible networks
*/
/**************************************************************************/

void listSSIDResults(void)
{
  uint8_t valid, rssi, sec, index;
  char ssidname[33]; 

  index = cc3000.startSSIDscan();

  Serial.print(F("Networks found: ")); Serial.println(index);
  Serial.println(F("================================================"));

  while (index) {
    index--;

    valid = cc3000.getNextSSID(&rssi, &sec, ssidname);
    
    Serial.print(F("SSID Name    : ")); Serial.print(ssidname);
    Serial.println();
    Serial.print(F("RSSI         : "));
    Serial.println(rssi);
    Serial.print(F("Security Mode: "));
    Serial.println(sec);
    Serial.println();
  }
  Serial.println(F("================================================"));

  cc3000.stopSSIDscan();
}

/**************************************************************************/
/*!
    @brief  Tries to read the IP address and other connection details
*/
/**************************************************************************/
bool displayConnectionDetails(void)
{
  uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
  
  if(!cc3000.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv))
  {
    Serial.println(F("Unable to retrieve the IP Address!\r\n"));
    return false;
  }
  else
  {
    Serial.print(F("\nIP Addr: ")); cc3000.printIPdotsRev(ipAddress);
    Serial.print(F("\nNetmask: ")); cc3000.printIPdotsRev(netmask);
    Serial.print(F("\nGateway: ")); cc3000.printIPdotsRev(gateway);
    Serial.print(F("\nDHCPsrv: ")); cc3000.printIPdotsRev(dhcpserv);
    Serial.print(F("\nDNSserv: ")); cc3000.printIPdotsRev(dnsserv);
    Serial.println();
    return true;
  }
}
and the output...

Code: Select all

Hello, CC3000!

Free RAM: 1066 bytes

Initializing...
Started AP/SSID scan

Connecting to DEATHSTAR...Waiting to connect...Connected!
Request DHCP

IP Addr: 192.168.1.18
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DHCPsrv: 192.168.1.1
DNSserv: 75.75.75.75
www.fightcube.com -> 74.208.28.90

Connect to 74.208.28.90:80
-------------------------------------
Downloading lava.jpg... 
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 56 bytes.
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 46 bytes.
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 36 bytes.
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
No data available... 
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 64 bytes.
Rcv'd: 34 bytes.
No data available... 
Request complete!
Read 49452 bytes in 169542ms - 
292.62Bytes/s
-------------------------------------


Good Bye!
"If I push these impulse engines too hard in the condition they're in, they'll blow apart." ...seems relevant.
Last edited by technobly on Sun Sep 08, 2013 12:32 pm, edited 1 time in total.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: CC3000 WebClient buffered read() is slow.

Post by adafruit »

One of the delays with read()'ing is theres a 5ms timeout socket query. Right now the CC3000 just isnt very fast - but it works and that counts for a lot! ;) We'll be filling out examples and hopefully getting some speedups. The API is fairly strict, TI sets up many of the interfaces and we just have to figure out how to work around them.

At this time we suggest the CC3000 for experimentation and bleeding-edge development, the firmware gets updated fairly often and we may end up changing the library as well!

User avatar
technobly
 
Posts: 118
Joined: Mon Oct 31, 2011 11:06 am

Re: CC3000 WebClient buffered read() is slow.

Post by technobly »

adafruit wrote:One of the delays with read()'ing is theres a 5ms timeout socket query.
Can you explain this more, and possibly show where that is in the code? I've traced the recv() call down to other calls, and it kinds of ends up getting abstracted away in so many calls I'm not following it. Is this 5ms per byte regardless of the fact that we are using a buffer? Is there something more that can be done if we make this non-blocking?

What does your Ti guy say about it? ;-) 300 Bytes/s is way too slow for a super fancy Wifi module that's capable of 500 Kilobytes/s with a decent processor behind it. Certainly the Arduino Uno and Mega are not that much of a slouch.

What other idea do you have to speed it up?

User avatar
technobly
 
Posts: 118
Joined: Mon Oct 31, 2011 11:06 am

Re: CC3000 WebClient buffered read() is slow.

Post by technobly »

Kevin Townsend recently updated the CC3000 library removing some debug code that delayed requests by 100ms. This has increased the read() and buffered read() by not one, but TWO orders of magnitude!

Previous read speed ~300 bytes/s
New read speed ~30,000 bytes/s !!!

Thanks KTOWN!

User avatar
technobly
 
Posts: 118
Joined: Mon Oct 31, 2011 11:06 am

Re: CC3000 WebClient buffered read() is slow. [SOLVED]

Post by technobly »

I was recently asked via twitter how I saw the above speed increase. It was after this debug delay was removed: https://github.com/adafruit/Adafruit_CC ... 745e09c9b7

Use the example code I posted above as well with the library as of this date and it should yield the same results:
https://github.com/adafruit/Adafruit_CC ... 745e09c9b7

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

Return to “Other Arduino products from Adafruit”