CC3000 Packets per second

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
diablo_sv21
 
Posts: 10
Joined: Sun Sep 01, 2013 7:46 pm

CC3000 Packets per second

Post by diablo_sv21 »

I'm having some trouble getting the CC3000 to send more than 10 packets per second. The unit is meant to be capable of 4-6Mbps but even if I was able to send 1500 bytes per packet I would still only be getting 15kbps.

But none the less, is it possible to speed up the packet rate? For testing it I've just altered the WebClient example to do the following:

Code: Select all

  Adafruit_CC3000_Client www = cc3000.connectUDP(ip, 8216);
  if (www.connected()) {
    char *str = "Test data packet";
    while(true) {
      www.write(str, strlen(str), 0);
    }
  }
The size of the packet has little to no impact on the packet rate, so where is the bottleneck? I'm thinking maybe an interrupt that is taking too long?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: CC3000 Packets per second

Post by adafruit_support_rick »

The problem could very well be a poor quality wireless connection. If you are in a location where the signal from your base-station is weak or intermittent, then the CC3000 could be doing a lot of retries on dropped packets.

Try moving closer to the access point and see if your throughput improves.

diablo_sv21
 
Posts: 10
Joined: Sun Sep 01, 2013 7:46 pm

Re: CC3000 Packets per second

Post by diablo_sv21 »

adafruit_support_rick wrote:The problem could very well be a poor quality wireless connection. If you are in a location where the signal from your base-station is weak or intermittent, then the CC3000 could be doing a lot of retries on dropped packets.

Try moving closer to the access point and see if your throughput improves.
I'm testing it quite close to the AP, about 2 meters away. I get full strength on my laptop. But just to be sure, I tried a few different locations around the house, both closer and further away, and keep getting exactly the same rate. It sits pretty firmly at 9.94 packets per second.

Have you performed any tests with high packet rates? If you have any working sample code to run against it might help point out where I'm going wrong.

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

Re: CC3000 Packets per second

Post by adafruit »

the library is not optimized for speed right now - theres likely some more optimizations that can be done but right now we are focused on functionality...this is the only fully-working CC3000 arduino library out there and it took 3 months of hacking just to get it to this point! :)

If you have any low-level questions about the TI host code, you can post a message to their forums
http://e2e.ti.com/support/low_power_rf/f/851.aspx

diablo_sv21
 
Posts: 10
Joined: Sun Sep 01, 2013 7:46 pm

Re: CC3000 Packets per second

Post by diablo_sv21 »

No worries, I do really appreciate the work you guys have done. I've certainly never had WiFi work this well on Arduino before! I'll just keep at it and if I can find any room for optimisation I'll certainly share it.

diablo_sv21
 
Posts: 10
Joined: Sun Sep 01, 2013 7:46 pm

Re: CC3000 Packets per second

Post by diablo_sv21 »

I've found the problem, and a solution!

Turns out this little guy was at fault, in ccspi.cpp

Code: Select all

void WlanInterruptEnable()
{
  DEBUGPRINT_F("\tCC3000: WlanInterruptEnable.\n\r");
  delay(100);
  attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
Not surprisingly, that delay(100) is quite limiting. I figure the delay is probably there for a reason so I tested slowly reducing this delay, right down to 1ms. It had no negative impact whatsoever.

Code: Select all

void WlanInterruptEnable()
{
  DEBUGPRINT_F("\tCC3000: WlanInterruptEnable.\n\r");
  delay(1); // 100x faster!
  attachInterrupt(g_IRQnum, SPI_IRQ, FALLING);
}
Oh, and I can now transmit nearly 1,000 packets per second.

I'd happily submit this to the repository but I'm hesitant as I don't really know what I've altered. I believe the delay was there due to packets potentially coming in at the same time, and somehow this helps fix a problem because of that. 100ms seems a bit of an insane amount of time to wait though.

By the way, this won't just help with transmitting packets at higher rates. Every SPI command uses this method so all of them had the 100ms delay. Not any more!

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: CC3000 Packets per second

Post by adafruit_support_bill »

Thanks for posting your findings. I'll forward them to the team!

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

Re: CC3000 Packets per second

Post by adafruit »

Thanks! we think that was part of a debugging element we had to use while developing and should have been #ifdef'd out! we're still working out kinks, but this line will be fixed shortly

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: CC3000 Packets per second

Post by ktownsend »

Good eye! I just pushed an update to this. It was a leftover from debugging and initial development.

diablo_sv21
 
Posts: 10
Joined: Sun Sep 01, 2013 7:46 pm

Re: CC3000 Packets per second

Post by diablo_sv21 »

Fantastic!

This is a good result I think :-)

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

Return to “Other Arduino products from Adafruit”