0

2.2" TFT LCD + CC3000 WiFi Breakout
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

2.2" TFT LCD + CC3000 WiFi Breakout

by katupiry on Fri Nov 22, 2013 7:42 pm

Hello,

So, here I am, new to the SPI Bus with my two brand new boards, the CC3000 WiFi breakout board and the 2.2" TFT lcd (neat stuff really).

My goal is to get info from the internet and display it on the TFT, easier done than said.
My main doubt is how do I wire both the boards to my arduino at the same time? is it possible to do that and still use hardware SPI on the TFT (which requires the same pins as the wireless shield)? I know there is a CS pin (chip select) on each of the boards, so, theoretically I'm thinking one could just share the bus pins on the boards and switch one default CS pin on, let's say, the LCD to some other pin on the arduino. But how do I implement that on code? is there a method I can call to communicate specifically to one board or the other by switching their CS pins on or off, one at a time? (for instance, tft.begin our tft.end etc...)

Or should I just give up and use software SPI on the LCD and save my hardware SPI pins for my WiFi breakout, or perhaps, vice versa?
katupiry
 
Posts: 1
Joined: Fri Nov 22, 2013 7:34 pm

Re: 2.2" TFT LCD + CC3000 WiFi Breakout

by adafruit_support_mike on Sat Nov 23, 2013 12:58 am

In theory multiple devices can share the same SPI bus, each selected by pulling its CS pin LOW. The code for that is fairly simple.. set the CS pin you want LOW, call `SPI.transfer()` with the data, then set the CS pin HIGH again when you're done.

In practice, the CC3000 has a quirk: it doesn't release the MISO line when the CS pin is HIGH. On the CC3000 Shield, we added a buffer chip that isolates the data lines correctly. The breakout doesn't have a buffer, but you can add one externally.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 55341
Joined: Thu Feb 11, 2010 2:51 pm

Re: 2.2" TFT LCD + CC3000 WiFi Breakout

by ridastock on Sun Nov 24, 2013 5:58 pm

That's helpful information. Could you describe the method for adding an external buffer to the CC3000 breakout board so that it can share the SPI bus with the TFT (if it's not too difficult)?

Much appreciated.
ridastock
 
Posts: 3
Joined: Mon Nov 11, 2013 2:42 am

Re: 2.2" TFT LCD + CC3000 WiFi Breakout

by adafruit_support_mike on Thu Nov 28, 2013 6:38 am

Basically you put the buffer chip between the microcontroller and the CC3000. Buffers like the 74LVC245 have a pin called 'output enable' that controls whether the output pins do anything at all.

The circuit that drives the pin sits between a pair of transistors, one going to the VCC rail and the other going to GND. When those transistors are ON (allowing current to flow), their reistance is so low they might as well not be there. When they're OFF, their resistance is so high it's like the pin isn't connected to either supply rail.

When that happens, the pin's output isn't HIGH or LOW, it's just 'not even there'. Since there are generally two choices in digital circuits, and this technique chooses a third, we say pins disconnected in that way are 'tristated'.

Output enable pins usually turn the transistor ON when they're LOW, so basically you'd connect the CS signal to both the appropriate pin on the buffer and the Output Enable pin. When !CS is HIGH, the buffer's pins are tristated and there's no chance of signals from the CC3000 interfering with another SPI device. When !CS is LOW, the buffer acts like a transparent connection between the microcontroller and the CC3000.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 55341
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.