cmagagna / ArduinoCC3000

Arduino library for the TI CC3000 WiFi module
65 stars 11 forks source link

Stuck at Initialization #2

Open brianwong3 opened 11 years ago

brianwong3 commented 11 years ago

Chris, I seem to be stuck on the initialization of the CC3000 both using your library and the Adafruit version..

Mine is the Breakout board from Adafruit and I am using the Arduino Nano V3, the one with the Atmega 328p. Any thoughts?

Thanks

cmagagna commented 11 years ago

Hi,

I've used the Adafruit board with the Nano V3 so I know it works. Can you try out my CC3000 test sketch, https://github.com/cmagagna/ArduinoCC3000Test ? If that doesn't work then I would check your wiring, if there's no problems with that then maybe you have a bad board from Adafruit?

Good luck!


From: brianwong3 notifications@github.com To: cmagagna/ArduinoCC3000 ArduinoCC3000@noreply.github.com Sent: Tuesday, September 24, 2013 6:35 AM Subject: [ArduinoCC3000] Stuck at Initialization (#2)

Chris, I seem to be stuck on the initialization of the CC3000 both using your library and the Adafruit version.. Mine is the Breakout board from Adafruit and I am using the Arduino Nano V3, the one with the Atmega 328p. Any thoughts? Thanks — Reply to this email directly or view it on GitHub.

brianwong3 commented 11 years ago

Thanks Chris, had to get to office to use the tools..got a multimeter and did some checking...Seems that the Nano itself can't power the CC3000...I had to connect a 9V power to it and it started working...

brianwong3 commented 11 years ago

Chris, off topic... I am trying to use a PN532 NFC and the CC3000 together...Seems that the SPI settings are conflicting with each other...

If I initialize the CC3000 first, I can't initialize the PN532. If I initialize the PN532 first, I can initialize the CC3000 but the PN532 won't respond to commands...

I am thinking its the SPI settings that is causing this, specifically the setDataMode and the setClockDivider.I tried to re-set the setDataMode and the setClockDivider for the PN532, but does not seem to work..Adafruit seems to point to the SPCR being changed and not being re-set to the earlier value.

Any ideas on how I can do this?

I tried adding the following codes whenever the PN532 sets the SS pin to LOW but its a no go.. pn532_SPI.setDataMode(SPI_MODE0); pn532_SPI.setBitOrder(MSBFIRST); pn532_SPI.setClockDivider(SPI_CLOCK_DIV16);

cmagagna commented 11 years ago

Hey Brian, the Adafruit version of the library has some code to save off the SPI state when it uses the CC3000, so presumably you can use more than one SPI device. They have a board with a CC3000 and a SD card reader and both use SPI, so I think they've tested it. Their code to do this is in ccspi.cpp, near the top. Basically whenever they assert the CC3000 CS they save off SPI state, and when they deassert CC3000 CS they restore it.

brianwong3 commented 11 years ago

Chris, ended up moving the PN532 to I2C instead.. Tried debugging till I got irritated.

brianwong3 commented 11 years ago

Going to try and fight with it tomorrow again...Moving to I2C is getting on my nerves..

I checked the SPCR and seems that the settings are correct and, the assert and deassert should work even if its only called in the CC3000 library. Don't own an oscilloscope so its going to be just whacking it till it works..

cmagagna commented 11 years ago

Hi Brian,

Yes it's incredibly frustrating trying to get the CC3000 to work with multiple devices like this. I am actually thinking about trying a setup where my flash memory chip uses the SPI bus and my CC3000 uses completely different pins and I bit-bang the protocol.

On Sep 26, 2013, at 8:37 AM, brianwong3 notifications@github.com wrote:

Going to try and fight with it tomorrow again...Moving to I2C is getting on my nerves..

I checked the SPCR and seems that the settings are correct and, the assert and deassert should work even if its only called in the CC3000 library. Don't own an oscilloscope so its going to be just whacking it till it works..

— Reply to this email directly or view it on GitHub.

lukeweston commented 10 years ago

http://processors.wiki.ti.com/index.php/CC3000_Serial_Port_Interface_%28SPI%29

The CC3000 does not have a well-behaved tristate MISO output, which could explain why it doesn't play nice with other SPI devices.

"nCS selects a CC3000 device, indicating that a master wants to communicate to the CC3000 device. MISO is not set to Hi-Z when nCS is deasserted."

The Adafruit CC3000 shield, for example, adds a single noninverting tristate buffer (74AHC1G125) to the CC3000's MISO output and controls it from the nCS line to the CC3000, making it go tristate when it's supposed to as an SPI device should.

http://learn.adafruit.com/system/assets/assets/000/010/986/original/adafruit_products_ccshield.png?1379351866

Hopefully that might be the fix for your multi-drop SPI issues.