Making the CC3000 breakout a well-behaved SPI device

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jouster
 
Posts: 62
Joined: Fri Dec 23, 2011 12:46 pm

Making the CC3000 breakout a well-behaved SPI device

Post by jouster »

On http://learn.adafruit.com/adafruit-cc30 ... onnections
it says
"On the breakout, be aware that the MISO (data out from module) pin does not go 'high impedance' when CS is driven low. Check the shield for how we use a 74AHC125 to manually tri-state this pin..."

Which is a typo. It should say "when the CS is driven high".
(further conversation at http://forums.adafruit.com/viewtopic.ph ... 51#p251551)

I bought the breakout because it was defined as an SPI device, but it really isn't if other SPI devices can't be used with it.

This raises a few questions:
- Will Adafruit fix the breakout in the future? There are quite a few other SPI devices out there (including Adafruit devices) and WiFi based projects that use them would benefit.
- How do I fix this myself with a 74AHC125? I'm not an EE, so it would be great to have tutorial-like instructions.

I've seen other SPI issues with the CC3000 shield as well, I suspect they are timing issues with the library, but I need to use the breakout for a project that has a 8875 (SPI) display driver and the CC3000 breakout is useless.
Last edited by jouster on Mon Feb 17, 2014 5:47 pm, edited 1 time in total.

User avatar
pocketmoon
 
Posts: 78
Joined: Fri Dec 27, 2013 8:21 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by pocketmoon »

That got me as well :/ I guess it comes down to cost/benefit although I'm sure a lot of purchasers will want to use another SPI device alongside the CC3000 breakout. It's a bit of a waste of a 14 pin IC just to manage one data line so there may be a simpler way of doing this but I'm no EE either :)

I had a spare 'tri state' logic chip sat in a draw (a 74HC573N latch) which is a bit of a hack but does a similar thing the way I have it wired;

Wire up the chip (Ground and Vcc). The 74AHC125 Buffer (and the 573N) has a pretty wide voltage range. I have mine powered off the 5v out from the Uno since the MISO signal is heading back to the Uno which is happy with 5v logic.

Connect MISO from the CC3000 to one one of the inputs on the HC125 buffer.

Take the matching output to the 'data in' on the Uno.

Take a branch off the Chip Select that's going into the CC3000 and connect this to the 'Output Enable' pin. e.g. 1OE

That way when 1OE is Low (CC3000 enabled) the MISO will be passed through (high or low) and then released to 'play nice' when CS is high. In the pic below I have one more connection because I'm using a latch chip I hold the pin high that makes the latch transparent.

Cheers,

Rob
Attachments
tri.jpg
tri.jpg (149.4 KiB) Viewed 1055 times

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

Re: Making the CC3000 breakout a well-behaved SPI device

Post by adafruit_support_mike »

Jouster wrote:Will Adafruit fix the breakout in the future? There are quite a few other SPI devices out there (including Adafruit devices) and WiFi based projects that use them would benefit.
We don't have any control over that issue.. it's a property of the chips as they come to us from TI.

We could add a level shifter to the breakout, but that gets into questions of size, cost, and the number of people who need the breakout form factor and multiple SPI devices.
Jouster wrote:How do I fix this myself with a 74AHC125? I'm not an EE, so it would be great to have tutorial-like instructions.
In general, level shifting presents two problems: shifting the 5v device's output down to a level the 3.3v device can use, and shifting the 3.3v device's output up to a level the 5v system can use. The Arduino solves one of those problems automatically, because it accepts 3.3v as a HIGH input value. That means you don't have to worry about shifting 0v-3.3v signals up to the 0v-5v range. You only need to worry about shifting 0v-5v signals down to the 0v.3.3v range.

The 74AHC125 isn't really the best down-shifter you can choose. We use the 74HC4050 because it was specifically designed for high-to-low level translation, can accept input voltages up to 16v, and is simple. You power the '4050 from the 3.3v rail, connect your 5v SDA, SCK, MOSI, and CS signals to input pins, and you get 3.3v signals at the appropriate output pins. You don't connect MISO to the '4050 at all because the Arduino doesn't generate any signals on MISO, it just listens.

As I said earlier, the Arduino can already read 0v-3.3v signals, so you just hook MISO straight back to the Arduino.

The CC3000's bad behavior presents a new challenge: how to release the MISO line so some other device can use it. For that, we use the 74AHC1G125. That's the single-IO version of the 74AHC125. Aside from VCC and GND, it has an input pin, an output pin, and an 'enable' pin.

The connections for the 74AHC1G125 are:

- VCC connects to the 3.3v rail
- GND connects to GND
- IN connects to the CC3000's MISO pin
- OUT connects to the Arduino's MISO pin
- /OE connects to the 3.3v CS signal.

The slash in '/OE' means that pin is 'active-low': The CC3000 has control of the 3.3v MISO line that goes to the Arduino if and only if the 74AHC1G125's /OE pin is LOW.

If the /OE pin is HIGH, the 741AHC1G125 'tristates' its output pin.

Any logic gate has a 'pull up network' that provides a low-resistance path to VCC and a 'pull-down network' that provides a low-resistance path to GND. The rules of logic chips say that only one of those networks can be low-resistance at any given time. The simplest pull-up network is a P-mosfet, and the simplest pull-down network is an N-mosfet. When you turn either one of them ON, you get a low-resistance path. If you turn them OFF, you get a very high resistance path.

An output-enable circuit wraps two more transistors around the logic gate.. another P-mosfet going to VCC and another N-mosfet going to GND. These two operate by slightly different rules than the logic gate though: either they're both ON at the same time, or they're both OFF at the same time. When they're both ON, you have low-resistance paths between the logic gate and VCC/GND, so the gate behaves normally. When they're both OFF, you have very high impedance paths to both VCC and GND, so the logic gate's output is basically disconnected from the rest of the circuit.

You have to pull CS LOW to start an SPI connection with the CC3000, so tying CS to the 74AHC1G125's /OE pin gives the CC3000 control of MISO when it's active, and cuts it off when it's inactive.

User avatar
pocketmoon
 
Posts: 78
Joined: Fri Dec 27, 2013 8:21 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by pocketmoon »

Hi,

It is indeed the CC3000 misbehaving with it's MISO but it would be a big win if a 74AHC1G125 could be added to the breakout board. The CC3000 breakout is an excellent product at a great price but it would be better with the MISO workaround built in. The HC1G125 is a surface mount device so the only practicle option for us breadboarders/prototypers have is using a DIP chip which is only going to have one of it's input/outputs used.

Cheers,

Rob

User avatar
jouster
 
Posts: 62
Joined: Fri Dec 23, 2011 12:46 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by jouster »

Thanks for the excellent information!

I agree with Rob that it would definitely be a big win to fix the CC3000 misbehavior on the breakout. Look at all the interest with the Spark project and people working to attach displays to it... There's an example of market demand!

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

Re: Making the CC3000 breakout a well-behaved SPI device

Post by adafruit_support_mike »

I'll pass the information along, but we also have strong demand for, "I don't need multiple SPI devices, just give me the smallest footprint and lowest price."

User avatar
jouster
 
Posts: 62
Joined: Fri Dec 23, 2011 12:46 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by jouster »

adafruit_support_mike wrote:I'll pass the information along, but we also have strong demand for, "I don't need multiple SPI devices, just give me the smallest footprint and lowest price."
C'mon. You Adafruit wizards can add a single 13 cent component which measures~ 3.25 x 3.25 mm in your sleep! ;)

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

Re: Making the CC3000 breakout a well-behaved SPI device

Post by adafruit »

thanks for the suggestion and feedback - the SPI MISO bug is fixed in the current adafruit versions of the CC3000 breakout!

User avatar
jouster
 
Posts: 62
Joined: Fri Dec 23, 2011 12:46 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by jouster »

adafruit wrote:thanks for the suggestion and feedback - the SPI MISO bug is fixed in the current adafruit versions of the CC3000 breakout!
Good to hear. I bought one on 3/14. Is that the fixed version? Is there anyway of identifying the version on the board (more specifically, from the back (non-component side), as I have installed it that way).

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

Re: Making the CC3000 breakout a well-behaved SPI device

Post by adafruit »

Jouster wrote:Good to hear. I bought one on 3/14. Is that the fixed version? Is there anyway of identifying the version on the board (more specifically, from the back (non-component side), as I have installed it that way).
it was updated on 3/20, it's in the product description-
New! As of 3/20/2014 we are shipping v1.1 which adds a tri-state buffer to the MISO pin so that you can use the CC3000 with other SPI devices on the same bus.

User avatar
jouster
 
Posts: 62
Joined: Fri Dec 23, 2011 12:46 pm

Re: Making the CC3000 breakout a well-behaved SPI device

Post by jouster »

adafruit wrote:
Jouster wrote:Good to hear. I bought one on 3/14. Is that the fixed version? Is there anyway of identifying the version on the board (more specifically, from the back (non-component side), as I have installed it that way).
it was updated on 3/20, it's in the product description-
New! As of 3/20/2014 we are shipping v1.1 which adds a tri-state buffer to the MISO pin so that you can use the CC3000 with other SPI devices on the same bus.
well, at least 3/14 is less than 30 days in the past ;)

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

Return to “Other Products from Adafruit”