PDA

View Full Version : WiFi module with an SPI interface- project...



stevech
07-17-2013, 03:08 PM
This WiFi module with an SPI interface would be a very interesting project...

Need to find a supplier for single unit quantities

http://www.ti.com/lit/ds/symlink/cc3000.pdf

potatotron
07-17-2013, 03:49 PM
I have a library for that module, https://github.com/cmagagna/ArduinoCC3000. There are prototype boards with the module, like the CC3000EM, but none have standard pinouts. Last weekend I made a breadboard-friendly board, https://github.com/cmagagna/CC3000-Breakout-Board. I've got prototype boards on order from Osh Park so hope to have them running in 3-4 weeks.

As for the module itself, DigiKey has them for $12.51 in qty 1, http://www.digikey.com/product-detail/en/CC3000MODR/296-35512-1-ND/3768439.

stevech
07-17-2013, 04:01 PM
I'd be interested in such a breakout board.
Similar to this?
http://www.mouser.com/ProductDetail/Texas-Instruments/CC3000EM/?qs=sGAEpiMZZMuJ3l9lTgMBp3aB7BcyfEOME4718ZPEjWA%3d

We tried the Roving Networks product... rather buggy so far.

potatotron
07-17-2013, 04:15 PM
Yep that's the one I'm using right now for developing the library. I think it's out of stock everywhere right now, but I think the CC3000BOOST is available -- same module and support chips, slightly different form factor.

689

stevech
07-17-2013, 04:27 PM
I have two of TI's BoosterPack boards - these stack. Using them with the TI 802.15.4 radio Eval Module that plugs in.
Testing '15.4 minus ZigBee, via UART and SPI - to the Teensy3 eventually. Starting now with UART to PC, developing in C++, then move to T3. Using TI's firmware on the radios that provides UART/SPI, so no altering of radio's firmware is needed.

adrianfreed
08-08-2013, 04:13 AM
adafruit's new CC3300 board has level shifters and the usual TLC (mounting holes, curved edges, good PCB layout).

http://www.adafruit.com/products/1469

jimmayhugh
08-29-2013, 06:31 PM
adafruit's new CC3300 board has level shifters and the usual TLC (mounting holes, curved edges, good PCB layout).

http://www.adafruit.com/products/1469

The Adadfruit library and examples do not compile for the Teensy 3.0

Headroom
08-29-2013, 09:16 PM
Without the console output its a bit hard to troubleshoot ;-)

jimmayhugh
08-29-2013, 10:02 PM
Without the console output its a bit hard to troubleshoot ;-)


In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:113:0: warning: "ENOBUFS" redefined [enabled by default]
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/errno.h:14:0,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/cc3000_common.h:50,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:25,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/errno.h:153:0: note: this is the location of the previous definition
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:172:0: warning: "FD_SET" redefined [enabled by default]
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:5,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:54,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:232:0: note: this is the location of the previous definition
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:173:0: warning: "FD_CLR" redefined [enabled by default]
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:5,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:54,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:233:0: note: this is the location of the previous definition
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:174:0: warning: "FD_ISSET" redefined [enabled by default]
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:5,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:54,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:234:0: note: this is the location of the previous definition
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:175:0: warning: "FD_ZERO" redefined [enabled by default]
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:5,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:54,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:235:0: note: this is the location of the previous definition
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:275:0,
from ntpTest.ino:32:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/socket.h:156:3: error: conflicting declaration 'typedef struct _types_fd_set _types_fd_set'
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:5,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:54,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from ntpTest.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:228:3: error: '_types_fd_set' has a previous declaration as 'typedef struct _types_fd_set _types_fd_set'
In file included from ntpTest.ino:32:0:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/sntp.h:357:1: warning: 'typedef' was ignored in this declaration [enabled by default]
ntpTest.ino:56:83: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
ntpTest.ino: In function 'void setup()':
ntpTest.ino:150:16: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
ntpTest.ino:154:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
ntpTest.ino:154:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
ntpTest.ino:172:16: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
ntpTest.ino:172:85: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

PaulStoffregen
08-29-2013, 10:19 PM
I'll take a look shortly.

My initial impression is this library tries to implement the BSD standard sockets API. If it's only ever been tested on AVR, where avr-libc has no sockets stuff, it probably conflicts when used with newlib which has sockets stuff.

PaulStoffregen
08-29-2013, 10:39 PM
Ok, here's my first attempt....

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

This compiled, but there are still numerous warnings in verbose mode. I'll look into those soon. Will keep updating this repository as I find things.

I don't have the hardware connected yet. Please let me know if this code works?

PaulStoffregen
08-29-2013, 11:39 PM
I pushed a couple more commits, to fix more C library conflicts and add const to the pointers to constant strings.

Please give this code a try and let me know if it works with Teensy3 and Adafruit's module?

Also, if anyone has one of these modules connected to a normal Arduino Uno, please run this modified code. It will almost certainly work... but Adafruit will ask if anyone has verified this before they accept the changes to the official version of the library.

potatotron
08-30-2013, 01:43 AM
Also, if anyone has one of these modules connected to a normal Arduino Uno, please run this modified code. It will almost certainly work... but Adafruit will ask if anyone has verified this before they accept the changes to the official version of the library.

Just tested with a Uno, it compiled with no errors and the example 'buildtest' ran with no issues.

I will test with a Teensy 3 later tonight.

jimmayhugh
08-30-2013, 02:39 PM
Tested with a Teensy 3.0 and Adafruit's "buildtest" example. Seems to connect to my Netgear router, but fails when pining to outside world:



Networks found: 3
================================================
SSID Name : Ed
RSSI : 32
Security Mode: 1

SSID Name :
RSSI : 83
Security Mode: 3

SSID Name : LinkME
RSSI : 40
Security Mode: 1

================================================

Deleting old connection profiles

Attempting to connect to XXXXXXXXX
Started AP/SSID scan




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

IP Addr: 10.0.0.5
Netmask: 255.255.255.0
Gateway: 10.0.0.1
DHCPsrv: 10.0.0.1
DNSserv: 10.0.0.1
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...0 replies


Closing the connection

jimmayhugh
08-30-2013, 02:58 PM
Next tried my Linksys router using the Adafruit "InternetTime" sketch and it worked...


Firmware V. : 1.19
MAC Address : 0x08 0x00 0x28 0x01 0xA8 0x28

Deleting old connection profiles

Attempting to connect to Linksys
Started AP/SSID scan




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

IP Addr: 192.168.1.13
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DHCPsrv: 192.168.1.1
DNSserv: 8.8.8.8
Locating time server...
Attempting connection...
Connect to 198.199.87.75:123
connected!
Issuing request...
Awaiting response...OK
Current UNIX time: 1377874531 (seconds since 1/1/1970 UTC)
Current UNIX time: 1377874546 (seconds since 1/1/1970 UTC)
Current UNIX time: 1377874561 (seconds since 1/1/1970 UTC)
Current UNIX time: 1377874576 (seconds since 1/1/1970 UTC)


Adafruit "buildtest" also worked:

Firmware V. : 1.19
MAC Address : 0x08 0x00 0x28 0x01 0xA8 0x28
Started AP/SSID scan


Networks found: 1
================================================
SSID Name :
RSSI : 83
Security Mode: 3

================================================

Deleting old connection profiles

Attempting to connect to Linksys
Started AP/SSID scan




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

IP Addr: 192.168.1.13
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DHCPsrv: 192.168.1.1
DNSserv: 8.8.8.8
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...5 replies
Ping successful!
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...5 replies
Ping successful!
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...5 replies
Ping successful!
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...5 replies
Ping successful!

potatotron
08-30-2013, 03:05 PM
Tested with a Teensy 3.0 and Adafruit's "buildtest" example. Seems to connect to my Netgear router, but fails when pining to outside world:



...
IP Addr: 10.0.0.5
...


This is a known issue with the board and the 10.x.x.x network. It's unclear if it's an Adafruit library bug or a TI firmware issue; they're looking into it:

http://forums.adafruit.com/viewtopic.php?f=22&t=43073&p=214530&hilit=cc3000#p214530

jimmayhugh
08-30-2013, 03:36 PM
Thanks for that info, using a local address works fine...


Firmware V. : 1.19
MAC Address : 0x08 0x00 0x28 0x01 0xA8 0x28
Started AP/SSID scan


Networks found: 2
================================================
SSID Name :
RSSI : 83
Security Mode: 3

SSID Name : westell7517
RSSI : 36
Security Mode: 2

================================================

Deleting old connection profiles

Attempting to connect to Netgear
Started AP/SSID scan




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

IP Addr: 10.0.0.5
Netmask: 255.255.255.0
Gateway: 10.0.0.1
DHCPsrv: 10.0.0.1
DNSserv: 10.0.0.1
www.adafruit.com -> 207.58.139.247

Pinging 207.58.139.247...0 replies


eMachines.local -> 10.0.0.11

Pinging 10.0.0.11...3 replies
Ping successful!
eMachines.local -> 10.0.0.11

Pinging 10.0.0.11...5 replies
Ping successful!
eMachines.local -> 10.0.0.11

Pinging 10.0.0.11...5 replies
Ping successful!
eMachines.local -> 10.0.0.11

Pinging 10.0.0.11...5 replies
Ping successful!

stevech
08-30-2013, 06:06 PM
Sounds like the router firmware doesn't have the correct list of which address ranges/classes are public/private.
That's pretty gross.

PaulStoffregen
08-30-2013, 06:16 PM
It's 10.x.x.x supposed to be only for private networks that can't route to the internet?

http://en.wikipedia.org/wiki/Private_network

I know they've very commonly used with NAT routing. But if the access point tried to pass a 10.x.x.x without translating the address, it's not supposed to work, is it?

stevech
08-30-2013, 06:35 PM
Right. 10.x.x.x is a non-routable address. If it's use as the destination of IP traffic, say ICMP/ping, it would not be NATed out to the WAN. It would be used with the switch's ARP tables to decide where in the LAN to send the packet.

THere should be no difference between 10.x.x.x and 192.168.x.x so long as the subnet masks are correct.

PaulStoffregen
08-31-2013, 02:01 AM
Good news: the Teensy3 changes have been merged into Adafruit's official version of the library. :)

stevech
08-31-2013, 03:56 AM
I'd be interested in such a breakout board.
Similar to this?
http://www.mouser.com/ProductDetail/Texas-Instruments/CC3000EM/?qs=sGAEpiMZZMuJ3l9lTgMBp3aB7BcyfEOME4718ZPEjWA%3d

We tried the Roving Networks product... rather buggy so far. I have read of this buggy issue for months, on other forums.

potatotron
09-20-2013, 02:24 AM
Hello all,

I've got an alpha version of my Arduino-fied CC3000 firmware upgrader. The repository is here:

https://github.com/cmagagna/CC3000Patch

The code currently works on a Uno, or any ATMega328 board with OptiBoot (it's too big for the other bootloaders). I'll be working on Teensy 3 support this weekend.

This will upgrade a CC3000 to service pack 1.11.1 / firmware version 1.24 (T.I. has an interesting way of naming). They've fixed the weird 10.x.x.x bug as well as several other issues:

http://processors.wiki.ti.com/index.php/CC3000_Release_Notes

jimmayhugh
09-20-2013, 01:55 PM
If anybody is using the AdaFruit Library for the CC3000 and Teensy 3.0, be aware that the latest commits no longer work for the Teensy 3.0:


Arduino: 1.0.5 (Linux), Board: "Teensy 3.0"
In file included from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:25:0,
from InternetTime.ino:26:
/home/jimm/sketchbook/libraries/Adafruit_CC3000/utility/cc3000_common.h:171:23: error: conflicting declaration 'typedef long unsigned int time_t'
In file included from /home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/stdio.h:46:0,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Print.h:35,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Stream.h:24,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/HardwareSerial.h:87,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/WProgram.h:16,
from /home/jimm/arduino/hardware/teensy/cores/teensy3/Arduino.h:1,
from /home/jimm/sketchbook/libraries/Adafruit_CC3000/Adafruit_CC3000.h:21,
from InternetTime.ino:26:
/home/jimm/arduino/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/include/sys/types.h:109:18: error: 'time_t' has a previous declaration as 'typedef long int time_t'

Paul's version still works.

PaulStoffregen
09-20-2013, 07:02 PM
Looks like I need to work on another pull request. Will probably work on it early next week. Remind me if I don't post a followup here by the middle of the week.

I'll definitely need help with testing, since I don't have a CC3000 set up right now. Adafruit wants at least a check the patch works on Teensy and Arduino Uno before accepting the code.

I have a couple ideas for reworking this so it'll survive future code updates from TI. I want to give that a try, rather than just redoing this the same way as last time.

Edit: this is also being discussed on Adafruit's forum (http://forums.adafruit.com/viewtopic.php?f=19&t=43796&p=218551#p218551).

jimmayhugh
09-20-2013, 10:26 PM
I can help with that, I have two of the Adafruit boards.

t3andy
09-22-2013, 12:26 AM
By running the CC3000 library examples on an Arudino clone, the resources needed by the examples really requires a Teensy 3 with a large amount of flash. 32K of flash, on the Arduino, won't cut it unless you are NOT running other user applications in the same sketch.
:cool:

PaulStoffregen
09-22-2013, 01:25 AM
Here's a fix. Please let me know if this works?

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

t3andy
09-22-2013, 01:58 AM
XP/SP3/Seeeduino Duemilanove 328P - no optiboot

23k of 30K CC3000 library example: GeoLocation
21K of 30k CC3000 library example: Internettime
23.5K of 30k CC3000 library example: NptTest
28K of 30k CC3000 library example: SendTweet
20K of 30K CC3000 library example: WebClient

I feel a lot better using the Teensy 3 (131K) - IMHO
:cool:

MichaelMeissner
09-22-2013, 04:26 AM
I feel a lot better using the Teensy 3 (131K) - IMHO
:cool:
Note, since the AVR uses a different processor the sizes between AVR and ARM won't be the same. I.e. 23k in an AVR may become 15k or 45k in the ARM. But having 4 times the memory is quite helpful.

potatotron
09-22-2013, 04:20 PM
By running the CC3000 library examples on an Arudino clone, the resources needed by the examples really requires a Teensy 3 with a large amount of flash. 32K of flash, on the Arduino, won't cut it unless you are NOT running other user applications in the same sketch.
:cool:

Well...yes and no....

You're right the library is huge, but I've already got a couple of cases where 32K is good enough. One is a board that sends the readings from a temperature sensor and light sensor every hour to a server (and even syncs time with NTP), the other runs an extremely simple web server that pulses an IO pin that blips an optoisolator connected to a DSLR, to take pictures remotely.

Additionally, you can set the CC3000_TINY_DRIVER flag and recompile and the library will only take up ~ 4K. You'll lose most of the neat features like SmartConfig and SSID scanning, but it works great if all you need is something basic to send and receive a few dozen bytes at a time.

Having said all that...I agree with you. To do really interesting things with the CC3000 you need a Teensy 3. The CC3000 is the reason I jumped from ATMega328s to the Teensy.

PaulStoffregen
09-22-2013, 04:36 PM
Can anyone give this update a quick run on a Teensy3 and also an Arduino Uno? I don't have either hooked up to a CC3000 right now....

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

This fix is so very simple, so I'm almost certain it will work. Still, Adafruit usually wants actual confirmation on both boards before they'll accept a pull request.

potatotron
09-22-2013, 04:57 PM
Can anyone give this update a quick run on a Teensy3 and also an Arduino Uno? I don't have either hooked up to a CC3000 right now....

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

This fix is so very simple, so I'm almost certain it will work. Still, Adafruit usually wants actual confirmation on both boards before they'll accept a pull request.

Uno - compiles with no errors, 'buildtest' example runs with no issues.

Teensy3 - compiles with no errors, hangs on "Initialising the CC3000 ..." in buildtest.

I don't think the Teensy3 problem is related to your patch, it looks like it's hanging on init_spi(). This is the first time I've tried the Adafruit library with a Teensy3 -- has this worked for anyone? (my test code https://github.com/cmagagna/ArduinoCC3000Test runs so I know the wiring etc. is good).

jimmayhugh
09-22-2013, 05:42 PM
Uno - compiles with no errors, 'buildtest' example runs with no issues.

Teensy3 - compiles with no errors, hangs on "Initialising the CC3000 ..." in buildtest.

I don't think the Teensy3 problem is related to your patch, it looks like it's hanging on init_spi(). This is the first time I've tried the Adafruit library with a Teensy3 -- has this worked for anyone? (my test code https://github.com/cmagagna/ArduinoCC3000Test runs so I know the wiring etc. is good).

Same result here...

PaulStoffregen
09-23-2013, 09:17 PM
I finally got my CC3000 breakout board wired up, and sure enough, it also hangs.

Will dig into the code soon.....

PaulStoffregen
09-24-2013, 11:35 AM
A couple quick photos.....

960

959

PaulStoffregen
09-24-2013, 11:45 AM
Here are more fixes to the library.

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

With these changes I was able to get my CC3000 to detect the nearby networks with "buildtest". I tested on both Teensy2 and Teensy3. Sadly, I don't have time to run the other examples right now... several other pretty urgent things to do.

Please give this new version a try. Does it work on your Teensy? Can you confirm if it still works on Arduino Uno (it really should... these edits are only to #ifdef'd stuff)?

I'd like to hold off submitting another pull request to Adafruit until more verification has been done, so any testing you can do on real hardware will *really* help!! :)

potatotron
09-24-2013, 08:29 PM
Hi Paul,

No problems at all with the examples on the Uno + Adafruit board.

The samples compile fine with Teensy3 + Adafruit board and as you say 'buildtest' enumerates the nearby networks, but getMacAddress() fails as does getting an IP address via DHCP etc. 'GeoLocation' is similar, it hangs at "connecting to network...".

I will investigate further and let you know.

jimmayhugh
09-25-2013, 12:46 AM
WebClient hangs here:

Hello, CC3000!

Free RAM: 8044

Initializing...


buildtest here:

Hello, CC3000!

RX Buffer : 131 bytes
TX Buffer : 131 bytes
Free RAM: 8148

Initialising the CC3000 ...
Firmware V. : 1.19
MAC Address : Networks found: 3
================================================
SSID Name :
RSSI : 83
Security Mode: 3

SSID Name : LinkME
RSSI : 43
Security Mode: 1

SSID Name : westell7517
RSSI : 33
Security Mode: 2

================================================

Deleting old connection profiles

Attempting to connect to GMJLinksys


ntpTest here:

Hello, CC3000!

Free RAM: 8164

Initialising the CC3000 ...
Firmware V. : 1.19

Deleting old connection profiles

Attempting to connect to GMJLinksys

potatotron
09-25-2013, 05:26 AM
Some small progress....

It looks like the library is actually getting further along than it says, it's just not printing anything. At line 185 in Adafruit_CC3000.cpp:



#if defined(UDR0) || defined(UDR1)
CC3KPrinter = &Serial;
#else
CC3KPrinter = 0;
// no default serial port found
#endif


Teensyduino doesn't know about UDR0 or UDR1 so here's a quick hack to force the issue:



// #if defined(UDR0) || defined(UDR1)
CC3KPrinter = &Serial;
// #else
// CC3KPrinter = 0;
// // no default serial port found
// #endif


Now when I run 'buildtest' the device's MAC address prints out and I can see more status updates.

Unfortunately it's still not working; it loops forever timing out while trying to connect to my network, but hopefully this is still progress.

Attached is a modified version of Adafruit_CC3000.cpp if you want to try it out and don't want to edit the file yourself.

964

PaulStoffregen
09-25-2013, 11:25 AM
Thanks. That's actually one of many things I patched, but didn't push to github. I've been trying to keep the public patches as simple as possible, so Adafruit's people will have an easier time accepting a pull request.

I must confess, yesterday when I saw it detect the SSIDs of networks, I didn't go any further. Instead I spent the rest of the day trying to figure out why Windows adds a delay when enumerating.

I'll dig deeper into the CC3000 library today and hopefully find & fix this problem.

PaulStoffregen
09-25-2013, 02:11 PM
I just tried buildtest, this time with my ssid and key. It seems to work. It was failing to print some info (but working), because of the missing CC3KPrinter definition. I've pushed that to github:

https://github.com/PaulStoffregen/Adafruit_CC3000_Library

One other thing I discovered is you must use an array of binary data if using a WEP key. For example:



#define WLAN_SECURITY WLAN_SEC_WEP
//#define WLAN_PASS "526F62694E" // <--- this format will NOT work!
const char WLAN_PASS[6] = {0x52, 0x6F, 0x62, 0x69, 0x4E, 0}; // <--- this works :-)

PaulStoffregen
09-25-2013, 02:12 PM
I personally verified this works on Teensy 2.0, Teensy 3.0 and Arduino Uno (wired it up on a prototype shield this morning). I'm going to submit it as a pull request now.

potatotron
09-25-2013, 05:37 PM
Hi Paul,

I just downloaded & tried your latest push, and everything is working as advertised...builttest, geolocation, internettime examples all run using an Adafruit board with the stock 1.19 firmware.

Everything is still failing with a Teensy3 + Adafruit board I upgraded to the new T.I. firmware version 1.24, but since the new firmware isn't officially supported by Adafruit I don't think it's something I'm going to worry about.

Thanks for all your help on this.

PaulStoffregen
09-25-2013, 06:51 PM
Adafruit has merged the changes to the official library. :-)

My one and only Adafruit CC3000 breakout board has firmware 1.19. Sounds like I should probably leave it as-is.

t3andy
09-25-2013, 08:49 PM
Paul S said ... using 1.19 firmware

I personally verified this works on Teensy 2.0, Teensy 3.0 and Arduino Uno

Potatotron said ...

Everything is still failing with a Teensy3 + Adafruit board I upgraded to the new T.I. firmware version 1.24

Question - @ Potatotron does 1.19 work on the Teensy 3 and all of the examples? :confused:

jimmayhugh
09-25-2013, 10:42 PM
I tried most of the examples (not smartconfig or sendtweet) and they all compiled an ran fine on the 1.19 firmware on a Teensy 3.0

potatotron
09-25-2013, 11:02 PM
Paul S said ... using 1.19 firmware


Potatotron said ...


Question - @ Potatotron does 1.19 work on the Teensy 3 and all of the examples? :confused:

Sorry for the confusion. Everything works great with a Teensy 3 and an Adafruit board running 1.19. I tried buildtest, GeoLocation, InternetTime, and WebClient. All good.

In other good news I've just found the problem with firmware 1.24, or I should say I found out my router was to blame...it didn't like the MAC address of the upgraded board (which was 6 random bytes I made up while porting the firmware upgraded). I changed the first 5 bytes to match the working board and now all is well.

I'm now confident that the board, firmware, library, and Teensy 3 are all playing nice now so I can finally start working on a web server. More details soon....

stevech
09-26-2013, 12:19 AM
For network devices that have no manufacturer assigned MAC address, such as the WizNet modules, I've long used the IEEE defined "self administred" MAC address range.
In this range, no devices with manufacturer define addresses should exist. So you manage the addresses in this self administered range , rather than hoping, or swiping a MAC assigned by some NIC or WiFi vendor.

simply use a MAC address with bit 1 of the MSB set. Like 0x02 xx xx xx ...
where you choose the xx's

In one case, I took high order parts of the MAC address of an 802.15.4 radio to use as the xx bytes - and used that for the WizNet modules. Ensured that the self administered address was unique and I didn't have to keep records of what I'd already used.

Just don't expose a device with a self administered MAC address to the WAN/internet - which wouldn't happen if you have a router tied to a modem of some sort. Indeed, Verizon's LTE modems don't have a public address at all. They double-NAT IPv4 unroutable addresses in net 10 on the LAN side AND the WAN side.

t3andy
09-26-2013, 02:55 AM
Just curious... will the CC3000 be compatible with IPv5?;)
whoops I mean IPv6?

potatotron
09-26-2013, 03:17 AM
Just curious... will the CC3000 be compatible with IPv5?;)
whoops I mean IPv6?

Unfortunately no.

http://e2e.ti.com/support/low_power_rf/f/851/t/160075.aspx

jimmayhugh
10-05-2013, 07:40 PM
I'm now confident that the board, firmware, library, and Teensy 3 are all playing nice now so I can finally start working on a web server. More details soon....


Any updates on this? I'm actually more interested in the UDP side of things (want the CC3000 and Teensy 3.0 to act as a UDP server), but progress is progress ;)

potatotron
10-06-2013, 04:54 AM
Work progresses, slowly but surely.

Because the CC3000 library is pretty low-level Berkeley sockets, a UDP server won't look very much like a TCP server so I'm not sure how much help webserver code will be for you.

For UDP you'd follow these steps:

1. Allocate a UDP socket
2. Bind it to a UDP port
3. Set socket options to nonblocking (optional, will depend on your code flow)
4. Loop in recvfrom() or send(), depending on your code flow

Here's some code I just found that will be pretty close to what you want to do. It's Linux C, so the #includes and prints will obviously be different, but the network code should be pretty close:

http://www.abc.se/~m6695/udp.html

Good luck!

jimmayhugh
10-12-2013, 06:08 AM
Looks like I got it working, thanks for all the help.

freja
10-14-2013, 04:29 PM
Hey Guys,
i can't get the serial monitor to work with a teensy 3, i downloaded the last version of the lib, or tried to change some lines as mentioned on a previous page but nothing ...
its working perfectly with an UNO board .

@jimmayhugh would you mind sharing your UDPapp example ?

thank you!

freja
10-14-2013, 07:48 PM
update: i am running the IDE 1.0.5 on a osx 10.8.5, none of the example from the library got the serial monitor working.

jimmayhugh
10-15-2013, 11:36 AM
Hey Guys,
i can't get the serial monitor to work with a teensy 3, i downloaded the last version of the lib, or tried to change some lines as mentioned on a previous page but nothing ...
its working perfectly with an UNO board .

@jimmayhugh would you mind sharing your UDPapp example ?

thank you!

Added to Adafruit_CC3000.h:


class Adafruit_CC3000_Server : public Print {
public:
Adafruit_CC3000_Server(uint16_t s);
Adafruit_CC3000_Server(void);

bool connected(void);
size_t write(uint8_t c);

size_t fastrprint(const char *str);
size_t fastrprintln(const char *str);
size_t fastrprint(const __FlashStringHelper *ifsh);
size_t fastrprintln(const __FlashStringHelper *ifsh);

int16_t write(const void *buf, uint16_t len, uint32_t flags = 0);
int16_t read(void *buf, uint16_t len, uint32_t flags = 0);
uint8_t read(void);
int32_t close(void);
uint8_t available(void);

uint8_t _rx_buf[RXBUFFERSIZE], _rx_buf_idx;
char _tx_buf[TXBUFFERSIZE];
int16_t bufsiz;

private:
int16_t _socket;

};


Adafruit_CC3000.cpp:


Adafruit_CC3000_Server Adafruit_CC3000::connectAndBindUDP(uint32_t destIP, uint16_t destPort)
{
sockaddr socketAddress;
uint32_t udp_socket;

// Create the socket(s)
// socket = SOCK_STREAM, SOCK_DGRAM, or SOCK_RAW
// protocol = IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW
//if (CC3KPrinter != 0) CC3KPrinter->print(F("Creating socket... "));
udp_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (-1 == udp_socket)
{
CC3KPrinter->println(F("Failed to open socket"));
return Adafruit_CC3000_Server();
}
//if (CC3KPrinter != 0) { CC3KPrinter->print(F("DONE (socket ")); CC3KPrinter->print(udp_socket); CC3KPrinter->println(F(")")); }

// Try to open the socket
memset(&socketAddress, 0x00, sizeof(socketAddress));
socketAddress.sa_family = AF_INET;
socketAddress.sa_data[0] = (destPort & 0xFF00) >> 8; // Set the Port Number
socketAddress.sa_data[1] = (destPort & 0x00FF);
socketAddress.sa_data[2] = destIP >> 24;
socketAddress.sa_data[3] = destIP >> 16;
socketAddress.sa_data[4] = destIP >> 8;
socketAddress.sa_data[5] = destIP;

if (CC3KPrinter != 0) {
CC3KPrinter->print(F("Connect to "));
printIPdotsRev(destIP);
CC3KPrinter->print(':');
CC3KPrinter->print(destPort);
CC3KPrinter->print(F(", Socket: "));
CC3KPrinter->println(udp_socket);
}

//printHex((byte *)&socketAddress, sizeof(socketAddress));
if (-1 == bind(udp_socket, &socketAddress, sizeof(socketAddress)))
{
if (CC3KPrinter != 0) CC3KPrinter->println(F("Connection error"));
closesocket(udp_socket);
return Adafruit_CC3000_Server();
}

return Adafruit_CC3000_Server(udp_socket);
}


/************************************************** ********************/
Adafruit_CC3000_Server::Adafruit_CC3000_Server(voi d) {
_socket = -1;
}

Adafruit_CC3000_Server::Adafruit_CC3000_Server(uin t16_t s) {
_socket = s;
bufsiz = 0;
_rx_buf_idx = 0;
}

bool Adafruit_CC3000_Server::connected(void) {
if (_socket < 0) {
// if (CC3KPrinter != 0) CC3KPrinter->println("connected() - _socket < 0");
return false;
}

if (! available() && closed_sockets[_socket] == true) {
// if (CC3KPrinter != 0) CC3KPrinter->println("No more data, and closed!");
closesocket(_socket);
closed_sockets[_socket] = false;
_socket = -1;
return false;
}

else return true;
}

int16_t Adafruit_CC3000_Server::write(const void *buf, uint16_t len, uint32_t flags)
{
return send(_socket, buf, len, flags);
}


size_t Adafruit_CC3000_Server::write(uint8_t c)
{
int32_t r;
r = send(_socket, &c, 1, 0);
if ( r < 0 ) return 0;
return r;
}

size_t Adafruit_CC3000_Server::fastrprint(const __FlashStringHelper *ifsh)
{
uint8_t idx = 0;

const char PROGMEM *p = (const char PROGMEM *)ifsh;
size_t n = 0;
while (1) {
unsigned char c = pgm_read_byte(p++);
if (c == 0) break;
_tx_buf[idx] = c;
idx++;
if (idx >= TXBUFFERSIZE) {
// lets send it!
n += send(_socket, _tx_buf, TXBUFFERSIZE, 0);
idx = 0;
}
}
// reached the end before filling the buffer completely
n += send(_socket, _tx_buf, idx, 0);

return n;
}

size_t Adafruit_CC3000_Server::fastrprintln(const __FlashStringHelper *ifsh)
{
size_t r = 0;
r = fastrprint(ifsh);
r+= fastrprint("\n\r");
return r;
}

size_t Adafruit_CC3000_Server::fastrprintln(const char *str)
{
size_t r = 0;
if ((r = write(str, strlen(str), 0)) <= 0) return 0;
if ((r += write("\n\r", 2, 0)) <= 0) return 0; // meme fix
return r;
}

size_t Adafruit_CC3000_Server::fastrprint(const char *str)
{
return write(str, strlen(str), 0);
}


int16_t Adafruit_CC3000_Server::read(void *buf, uint16_t len, uint32_t flags)
{
return recv(_socket, buf, len, flags);

}

int32_t Adafruit_CC3000_Server::close(void) {
int32_t x = closesocket(_socket);
_socket = -1;
return x;
}

uint8_t Adafruit_CC3000_Server::read(void)
{
while ((bufsiz <= 0) || (bufsiz == _rx_buf_idx)) {
cc3k_int_poll();
// buffer in some more data
bufsiz = recv(_socket, _rx_buf, sizeof(_rx_buf), 0);
if (bufsiz == -57) {
close();
return 0;
}
//if (CC3KPrinter != 0) { CC3KPrinter->println("Read "); CC3KPrinter->print(bufsiz); CC3KPrinter->println(" bytes"); }
_rx_buf_idx = 0;
}
uint8_t ret = _rx_buf[_rx_buf_idx];
_rx_buf_idx++;
//if (CC3KPrinter != 0) { CC3KPrinter->print("("); CC3KPrinter->write(ret); CC3KPrinter->print(")"); }
return ret;
}

uint8_t Adafruit_CC3000_Server::available(void) {
// not open!
if (_socket < 0) {
// if (CC3KPrinter != 0) CC3KPrinter->println("available() - _socket < 0");
return 0;
}

if ((bufsiz > 0) // we have some data in the internal buffer
&& (_rx_buf_idx < bufsiz)) { // we havent already spit it all out
// if (CC3KPrinter != 0) CC3KPrinter->println("available() - data in buffer");
return (bufsiz - _rx_buf_idx);
}

// do a select() call on this socket
timeval timeout;
fd_set fd_read;

memset(&fd_read, 0, sizeof(fd_read));
FD_SET(_socket, &fd_read);

timeout.tv_sec = 0;
timeout.tv_usec = 5000; // 5 millisec

int16_t s = select(_socket+1, &fd_read, NULL, NULL, &timeout);
//if (CC3KPrinter != 0) } CC3KPrinter->print(F("Select: ")); CC3KPrinter->println(s); }
if (s == 1) {
return 1; // some data is available to read
}else{
// if (CC3KPrinter != 0) CC3KPrinter->println("available() - no data is available");
return 0; // no data is available
}
}



Setup code:


Adafruit_CC3000_Server server;

// Local server IP, port, and repository (change with your settings !)
unsigned int localPort = 2652; // local port to listen on

setup()
{
if(setDebug & udpDebug)
{
Serial.println(F("Initializing CC3000 nic"));
}
// Initialise the CC3000 module
if (!cc3000.begin())
{
while(1);
}

// Per http://e2e.ti.com/support/low_power_rf/f/851/t/292664.aspx
// aucInactivity needs to be set to 0 (never timeout) or the socket will close after
// 60 seconds of no activity
unsigned long aucDHCP = 14400;
unsigned long aucARP = 3600;
unsigned long aucKeepalive = 30;
unsigned long aucInactivity = 0;
if(aucInactivity == 0)
{
Serial.println(F("Setting netapp to not timeout..."));
}else{
Serial.print(F("Setting netapp to timeout in "));
Serial.print(aucInactivity);
Serial.println(F(" Seconds"));
}
long iRet = netapp_timeout_values(&aucDHCP, &aucARP, &aucKeepalive, &aucInactivity);
if (iRet!=0)
{
Serial.print(F("Could not set netapp option, iRet = "));
Serial.println(iRet);
Serial.println(F(", aborting..."));
while(1);
}else{
Serial.print(F("set netapp option, iRet = "));
Serial.println(iRet);
}

displayMACAddress();

// Connect to WiFi network
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
Serial.println("Connected to WiFi network!");


// Check DHCP
Serial.print(F("Requesting address from DHCP server..."));
for(t=millis(); !cc3000.checkDHCP() && ((millis() - t) < dhcpTimeout); delay(1000));
if(cc3000.checkDHCP()) {
Serial.println(F("OK"));
displayConnectionDetails();
} else {
Serial.println(F("failed"));
return;
}

timer = millis();
timer2 = millis();

for(int q = 0; q < UDP_TX_PACKET_MAX_SIZE; q++) // clear the buffer udp buffers
{
ReplyBuffer[q] = 0x00;
PacketBuffer[q] = 0x00;
}
unsigned long startTime;

Serial.println(F("Attempting connection..."));

startTime = millis();

do
{
server = cc3000.connectAndBindUDP(0x0, localPort);
} while((!server.connected()) &&
((millis() - startTime) < connectTimeout));

if(server.connected())
{
Serial.println(F("connected!"));
server.println("@");
}else{
Serial.println(F("NOT connected!"));
while(1);
}
}

loop()
{
while(server.available())
{
char c = server.read();

if(c != 0x00)
{
PacketBuffer[rpBufferCnt] = c;
if(PacketBuffer[rpBufferCnt] == '\n')
{
if(setDebug & udpDebug)
{
Serial.print(PacketBuffer);
}
break;
}else{
rpBufferCnt++;
}
}
}
if(PacketBuffer[0] != 0x00)
{
udpProcess();
}
}

freja
10-21-2013, 04:48 PM
Thank you jimmayhugh,

everything working fine!!!

freja
10-21-2013, 09:13 PM
@jimmayhugh hey i seen you were looking for a way to setup a static ip to the cc3000, did you finally found a way to do it with the arduino IDE or using the terminal and the cc3000 uart ??
cheerios

stevech
10-22-2013, 02:16 AM
T.I. docs say
For the static IP configuration, the NetappDHCP API call is triggered with a non-0 IP address and subnetmask parameters. Otherwise, the 0 IP address is passed to the API call and informs a device that DHCP must be used. The following figure shows the required behavior.

renasis
10-25-2013, 04:09 AM
Paul,

I am trying to get the cc3000 breakout board from Adafruit hooked up to the Teensy 3.0. Thanks for posting the wiring above. From what I can tell the termination is as follows:

cc3000-teensy 3.0
CLK-13
MISO-12
MOSI-11
CS-10
VBLEN-5
IRQ-3

Just having trouble hooking up the power. Not too experienced on the electrical side. Do you have all those pins going to ground after termination to the Teensy? From what I read the cc3000 consumes 275mA, which will be too much for the Teensy 3.0 to deliver(100mA max). I have an Arduino 328p and 3.3V(https://www.sparkfun.com/products/526) regulator at my disposal. Could you let me know how to hook it up? Do I need to modify the Teensy?

Thanks,

-ren

potatotron
10-25-2013, 04:34 AM
The pin connections are correct. If you want to be really pedantic you can use any available pins for CS, VBLEN, and IRQ, but it's probably safest to get it working first with Adafruit's default pin usage.

I'm a little confused by "do you have all those pins going to ground after termination to the Teensy", but no you would only connect ground on the Teensy 3 to ground on the CC3000 board. You definitely wouldn't ground the SPI, IRQ etc. pins.

If you're powering the Teensy 3 via USB then you'd run the 5V coming off the Teensy 3's VIN pin into your voltage regulator, then the 3.3V from the regulator into the 3V3 pin of the CC3000 board. The Adafruit CC3000 board has its own regulator but I believe if you run 5V into its VIN then the data pins will also be 5V, which is not good for the 3V3 only Teensy 3.

Good luck!

renasis
10-25-2013, 01:05 PM
Potatotron,
1053
Thanks for the info. The question about running the leads from the teensy to ground came from leads(pointed to with a red arrow) attached.

Thanks,

-ren

PaulStoffregen
10-25-2013, 01:29 PM
Potatotron is correct, I wired the CC3000 VIN pin to Teensy3's VIN pin. The "3.3V" pin on CC3000 is not connected.

Those prototype boards I use have a ground plane on the top side. The short wire you see in the photo is just a solder connection through a nearby hole to the top side.

jimmayhugh
10-25-2013, 04:18 PM
Any particular reason that the is5100() and is5200() functions are private? I'm working with a board that I designed that can be used with the WIZ812mj, WIZ820io or the Adafruit CC3000 breakout board, and I'm trying to make my code recognize which nic is installed, since it appears that the max udp packet size varies widely for each device.

stevech
10-25-2013, 04:50 PM
The MAX IP packet size, regardless of TCP, UDP, ICMP, can be the standard MTU size as I recall from working with the 812MJ. The UDP packet is sent to the host with a header (proprietary format) that shows the source IP, Socket, etc.

potatotron
10-25-2013, 05:05 PM
stevech is right, the max packet size is the same for All Things Ethernet, ~ 1500 bytes. Things are a little weirder than that because actually the IP stack is supposed to hide the packet size from the higher-level protocols; the official maximum datagram size for UDP is 64K. In practice, especially for smaller MCUs like the CC3000, maximum UDP size = maximum Ethernet size = about 1500 bytes (I say 'about' because the actual number depends on if you're talking about data payload, actual frame size including vlan info etc., etc. etc. etc.).

jimmayhugh, I think what you may be seeing is the default size of the Adafruit library's buffer which I think is about 130 bytes? The CC3000 & library doesn't have any ability to fragment packets so if you tried to send 1000 bytes it won't send 8 packets, it will just send 1 and discard the extra data.

If you're using the Teensy3 you don't have the RAM limit a regular Arduino has, try increasing the buffer size in cc3000_common.h.

jimmayhugh
10-25-2013, 06:04 PM
Actually what I'm looking at is the defined size of UDP_TX_PACKET_MAX_SIZE in EthernetUDP.h, which is set at 24 bytes. I'm aware of the restriction in the CC3K, and have a work-around for that.

stevech
10-25-2013, 08:09 PM
24 bytes is illogical. Must have been demo code for a small RAM micro like an AVR.

PaulStoffregen
10-25-2013, 09:23 PM
Any particular reason that the is5100() and is5200() functions are private?

Not really, other than there's no API in the Ethernet library regarding the underlying hardware. I wanted to make it "just work" with either chip.

Should they be "protected" or "public" instead of "private"? Most of the other methods that direct access the hardware are private.

potatotron
10-25-2013, 11:05 PM
Actually what I'm looking at is the defined size of UDP_TX_PACKET_MAX_SIZE in EthernetUDP.h, which is set at 24 bytes. I'm aware of the restriction in the CC3K, and have a work-around for that.

My mistake. I didn't know we were talking about a non-CC3000 board.

On the other hand...24 bytes...?

PaulStoffregen
10-25-2013, 11:16 PM
Ok, I know lots of UDP stuff using more than 24 bytes actually works.

I just did a little searching. It seems UDP_TX_PACKET_MAX_SIZE is not actually used anywhere within the Ethernet library. It is used in the UDPSendReceiveString.ino example. Why it's defined inside the library for only an example is a mystery. Maybe that #define is a leftover an early version used a fixed buffer?

The actual UDP code does not appear to have any built-in limit, other than the limits imposed by the W5100/W5200 chip. Here's the UDP write code. The "bufferData" function copies right into the W5100.



size_t EthernetUDP::write(uint8_t byte)
{
return write(&byte, 1);
}

size_t EthernetUDP::write(const uint8_t *buffer, size_t size)
{
uint16_t bytes_written = bufferData(_sock, _offset, buffer, size);
_offset += bytes_written;
return bytes_written;
}

stevech
10-26-2013, 03:29 AM
becuause Wiznet adds the header bytes (prepends), the host has to expect these extra bytes.

For me, the hardest part of the '5100 code was to make TCP streams so that packet boundaries are hidden. But I was working in bare-metal, no libraries.

renasis
10-26-2013, 05:05 AM
Guys,

Finally got it to work, thanks! I was able to get Webclient and GeoLocation sketch working from the library(https://github.com/PaulStoffregen/Adafruit_CC3000_Library) with the connections below:

cc3000-teensy 3.0
CLK-13
MISO-12
MOSI-11
CS-10
VBLEN-5
IRQ-3

Made the additional connections:
Vin-Vin(3.7 to 5.5V)
Gnd-Gnd(next to pin 0)


Thanks,

-ren

renasis
10-29-2013, 05:26 AM
Is there a way to get the SPI running @ 8Mhz on the teensy 3.0 board? If not I guess the closest I can get to this is 12Mhz , correct?

Thanks,

-ren

Headroom
10-29-2013, 01:41 PM
In THIS (http://forum.pjrc.com/threads/17951-WIZ820io-Ethernet-and-2nd-power-supply-with-teensy-3-0?highlight=wiz820io) thread user manitou has posted results in speeding up SPI transfers, mainly with the aim to improve throughput using the WIZ820io Ethernet module.
His little github repository (https://github.com/manitou48/teensy3) namely the file W5100.cpp.fat, includes code that allows you to change the SPI bus frequency/data rate. Works very nicely BTW.

jimmayhugh
11-04-2013, 11:53 AM
Here's a screenshot of the webpage of my Teensy 3.0/CC3000 board monitoring/ controlling a combination of up to 12 DS18B20/DS2406+ digital thermometers/switches:
1067
The UDP server is working pretty well.

renasis
11-08-2013, 04:51 AM
Headroom,

Thanks for the link. That seems like the same code as have been using with the sdfat library found here(http://code.google.com/p/beta-lib/downloads/detail?name=SdFatBeta20130621.zip&can=2&q=). With this sdfat library the Teensy 3.0 works perfect(with the sketches I have tested). I also modified the adafruit cc3000 library to run with the sdfat spi routines, works perfect. The problem I am facing is switching between the cc3000 and sdfat. There seems to be an issue with switching the clock polarity and phase(CPHA) between the two devices, CPHA=0 for sdfat, CPHA=1 for cc3000. It is very annoying. I created a simple sketch,it inits the sd, runs the adafruit build test, then opens a file for reading. It works up till the point where it needs to open the file. I am switching the mode between the two, but it doesn't work. I did have some success reading the file by putting a 2 ms delay after sd card chip select goes low. It seems like some sort of timing issue related to spi, but I can't nail it down.

-ren

lhagan
11-24-2013, 04:00 PM
Anyone have any luck with the (new) server functionality in the Adafruit library? All the client stuff works fine with Teensy 3, but the server examples just lock up for me.

jimmayhugh
11-24-2013, 09:30 PM
Here's a screenshot of the webpage of my Teensy 3.0/CC3000 board monitoring/ controlling a combination of up to 12 DS18B20/DS2406+ digital thermometers/switches:
1067
The UDP server is working pretty well.

Well, I guess I spoke too soon. I can't keep a reliable connection, it seems to just give up randomly, plus the range isn't that great with either the on-board ceramic antenna or an external antenna. I'm going back to investigating the TL-WR703N as an alternative until the CC3000 matures a bit.

t3andy
11-25-2013, 02:38 PM
I'm going back to investigating the TL-WR703N as an alternative until the CC3000 matures a bit.

Spark Core is using the CC3000, with no problems, and they will be shipping any day from now.:cool:

Headroom
11-25-2013, 04:15 PM
How do you know that they are using it without a problem without holding a unit in hands and having run code ?
I mean aside from marketing promises ;-)

t3andy
11-25-2013, 04:23 PM
Check Kickstarter Spark Core update #16 and see for yourself. :D
http://www.kickstarter.com/projects/sparkdevices/spark-core-wi-fi-for-everything-arduino-compatible/posts

better yet ... just download their code and see for yourself firsthand.

PaulStoffregen
11-25-2013, 04:37 PM
I backed the Spark project, for only the simple $39 board (no extra stuff). Until is arrives, I'm personally still considering the project vapor.

PaulStoffregen
11-25-2013, 05:31 PM
Just got an update, they claim 50% are built and today they're starting to ship. Still, they've previously published several updates that were overly optimistic, so I'll believe it when I see it.

But they do have over 5500 orders to ship. When we did the Teensy3 kickstarter, at our peak we were shipping about 250 to 300 per day. So their estimate that it'll take a couple weeks to ship is actually pretty reasonable.

Had I know Adafruit would ship a CC3000 breakout long before Spark, I would not have backed their project. Oh well....

jimmayhugh
11-25-2013, 07:01 PM
Spark Core is using the CC3000, with no problems, and they will be shipping any day from now.:cool:

I helped fund that project, and am waiting for the product to ship, so we'll see...

stevech
11-26-2013, 01:39 AM
For best range
- force mode to lowest modulation order, e.g., "1DSSS". Receiver sensitivity is best and TX power is highest, vs. higher rates.
- The on PCB chip antennas are rather directional and have negative gain in dBi. Size matters. Some modules have a U.FL connector to permit you to use other kinds of antennas.

802.11 will always have poorer range than, say, 802.12.15.4, becuase '15.4 is a 2MHz/250KHz raw bit rate system whereas 802.11 is 20MHz or more.

pkourany
11-27-2013, 03:18 PM
I have the Adafruit CC3000 breakout connected to a teensy 3 and everything works well EXCEPT the SendTweet sketch. The first ip lookup (cc3000.getHostbyName) for the time server works without any problems. But then the second ip lookup for "api.twitter.com" returns the same ip as the time lookup. In fact any subsequent ip lookups return the same ip value. I wrote a simple test program that does three sequential lookups/open connection/close connection with a 5 second delay between each and only the FIRST lookup works and all subsequent lookups return the initial lookup ip value!!!

I also tested the sendtweet and test sketches on an arduino pro mini using IDE 1.54 and it does the exact same thing.

Has anyone tried the SendTweet sketch or multiple (different) ip lookups?

:(

PaulStoffregen
11-27-2013, 03:50 PM
Ouch. Sounds like a bug in the CC3000 library or the CC3000 firmware.

Have you reported this on Adafruit's forum? Kevin is very good with that library and might be able to investigate. It really needs to go through Adafruit for that to happen.

pkourany
11-27-2013, 04:01 PM
Good idea... doing that now.

eberkund
01-16-2014, 12:16 AM
Hi, I was reading that the CC3000 required more power than the Teensy 3.x can provide but the pictures Paul a few pages back seemed to show the CC3000 connected directly to the Teensy. Am I wrong or doesn't this mean that the CC3000 should be connected to the power supply separately?

mortonkopf
01-16-2014, 05:51 AM
The cc3000 can take its +ve from the teensy Vin pin when you are connected by USB.

A quick check was done regarding this: http://forum.pjrc.com/threads/24568-Teensy-3-and-Adafruit-CC3000-breakout


I connected Teensy3's VIN pin, which has 5V from the USB, to the power input on Adafruit's CC3000 breakout. Their breakout board has a 3.3V regulator, so the CC3000 runs on 3.3V even when powered from 5V. It outputs 3.3V signals. The breakout board has a buffer chip that can accept 5V or 3.3V signals on the inputs (MOSI, SCK, CS).

In terms of mA, I have not put a meter on it, but Manitou read that it could need up to 300mA. For the basic setup and tests, I have not encountered any power issues with this format so far.

stevech
01-16-2014, 06:05 AM
Be mindful that the USB spec requires 500mA, but experience says many products do not provide more than 100mA or less. Esp. hubs and laptops.

ARMbasic
01-16-2014, 02:36 PM
Most PCs follow the USB spec and provide 100mA but will negotiate to provide up to 500mA. When you take more than that a lot of PCs will shut down that portion of the USB, often requiring a reboot to re-enable it. That's why some early external hard disks used dual USB plug cables.

Most hubs with external supplies don't bother limiting power and provide whatever they can from their supply. I've been able to melt down a couple :)

Some USB chargers I have will supply up to 2.1A.

Another limit you have to watch for is the cable itself, those are some pretty small wires and you will get a substantial voltage drop on the cable.

stevech
01-16-2014, 06:28 PM
I had one USB cable that had too-small wire gauge. Caused odd symptoms.
Took me a long time to realize this - hindsight was that the cable was too thin/flimsy vs. others.
trashed it.

drewlsvern
01-24-2014, 03:27 AM
Anyone have any luck with the (new) server functionality in the Adafruit library? All the client stuff works fine with Teensy 3, but the server examples just lock up for me.

I am having the same issue. Anyone possibly have a fix for this? The server examples I tested run fine on a nano 3.0, but it doesn't have close to the specs I need for my current project.