Teensy 3 - Http server using cc3000 and sd reader on std spi pins

Status
Not open for further replies.

renasis

Active member
Paul,

I am trying to use the Teensy 3, PRJC sd reader and the cc3000 Adafruit breakout board to create a simple http server. I want to use the PRJC sd reader and the cc3000 on the standard Teensy spi pins(CC3000 SS=10, SD SS=4, MOSI=11,MISO=12,SCK=13). I created and attached the simple sketch to test this. This sketch uses the sdfat library(20130269 version) and the newest Adafruit cc3000 library.

In order to get this sketch to work I had to set USE_ARDUINO_SPI_LIBRARY 1 in SdFatConfig.h. Now, the sketch will work every other time you reload it(approximately). The spi communication between the Teensy 3 and cc3000 seems to always work. However, the spi communication between the Teensy 3 and sd reader seems to fail on every other sketch reload(approximately). I believe it might be because the datamode is being changed from 0 for the sd reader and 1 for the cc3000. It could also be due to the interrupt for the cc3000. I have tried using the cc3000 and sd reader at 3.3V and 5V, no change. I have tried changing speeds, the speed in the sketch, SPI_CLOCK_DIV2 seems to the best. I am aware this sd library has additional code specifically made to work with the teensy 3, it works well when the sd reader is in soft spi mode. It also works well when the sd reader is being used alone on the std Teensy 3 spi pins. However, when the cc3000 and the sd reader are both attached to the std Teensy 3 spi pins, it does not work(from my experience). I also tried updating the Adafruit cc3000 library to use the same spi routines as in the sdfat library, but that did not work either. Below I have an example of a success and a failure using the cc30000 and sd reader on the std Teensy 3 spi pins. Do you know how to make this sketch work consistently with the sd reader and cc3000 on the Teensy 3 std spi pins?

Thanks,

-ren

This sketch outputs to serial, if everything works, the server receives the request, opens the file, reads/transmit file and disconnects.
---------
sdinit.
Init CC3000
Started AP/SSID scan
Connecting to YOURSSID...Waiting to connect...Connected
Server Ready
GET / HTTP/1.1
Host: 192.168.0.101
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
File opened
File Size=28317
28288
28259
28230
........
-----------
The failure that I have seen is as follows. The server ,receives request, fails to open file and disconnects.
-------------
sdinit.
Init CC3000
Started AP/SSID scan
Connecting to YOURSSID...Waiting to connect...Connected
Server Ready
GET / HTTP/1.1
Host: 192.168.0.101
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
File not opened
File Size=0
Disconnecting
 

Attachments

  • CC3000_SimpleHttpServerfromSd.ino
    2.6 KB · Views: 205
Last edited:
I believe the issue is with the way the CC3000 breakout is built versus the shield. The big difference is that the shield has a line buffer on the CC3000 MOSI line. It seems the CC3000 does not float the MOSI line when deselected. See this topic and this topic on the Adafruit forum for more information.
 
pkourany,

I have a cc3000 Adafruit shield also. I hooked up the Teensy 3 to the cc3000 Adafruit shield(using sd reader on the shield). Tried the same sketch, works great!

Thanks for the info!

-ren
 
Status
Not open for further replies.
Back
Top