Wave Pin Conflicts

by bglsmith on Tue Jan 29, 2013 11:32 pm

I have an AdaFruit Wave Shield that I need to use w/ a WiFi shield that uses pins 11, 12, & 13 also. What are my options to resolve this?
bglsmith
 
Posts: 10
Joined: Wed Jan 16, 2013 12:01 am

Re: Wave Pin Conflicts

by adafruit_support_bill on Wed Jan 30, 2013 6:52 am

That depends on what the WiFi shield uses those pins for. If it is for SPI, you should be able to share as long as the CS pin is different. The WaveShield uses pint 10 for CS by default.
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Pin Conflicts

by bglsmith on Wed Jan 30, 2013 10:35 am

Thanks for you help. This is my first experience w/ Arduino and my electronics knowledge is limited; although I am learning a lot!

Wave | | Wifi
----------------------------
| 0 |
| 1 |
LCS | 2 | Interrupt (2 or 8) configurable
CLK | 3 |
DI | 4 |
LAT | 5 |
| 6 |
| 7 |
| 8 | Interrupt (2 or 8) configurable
| 9 | LED ("Can be removed")
CS | 10 | SS
SD | 11 | MOSI
SD | 12 | MISO
SD | 13 | Clock (SCK)

My understanding is that 2 and 10 conflict, so I need to move them.

Pin 2 -> I can move the Wave to 1 or the WiFi to 8
Pin 10 -> I can move the Wave to 7

Pins 11/12/13 are not configurable on either shield.

Thanks again!
bglsmith
 
Posts: 10
Joined: Wed Jan 16, 2013 12:01 am

Re: Wave Pin Conflicts

by adafruit_support_bill on Wed Jan 30, 2013 11:25 am

Pin 2 -> I can move the Wave to 1 or the WiFi to 8

You want to avoid pin 1. That is also used for serial communication which is valuable for debugging things.
Pin 10 -> I can move the Wave to 7

Yes. You just have to make the change in the code to reflect that.
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Pin Conflicts

by bglsmith on Thu Jan 31, 2013 4:09 pm

I've moved the Wave Shield pins so they look like

|Wave|WiFi
0| |
1| |
2| | Interrupt
3|LCS |
4|CLK |
5|DI |
6|LAT |
7| |
8| | Disabled
9|CCS | Disabled
10| |SS
11|MOSI|MOSI
12|MISO|MISO
13|SCK|SCK

In setup I call
pinMode(SS, OUTPUT);
to setup pin 9.

The Wave board works when plugged directly into the uno3, but when stacked on top of the WiFi shield it shows the error

Error: Card init. failed!
SD I/O error: 1, 8

I'm not sure what to try next so these shields work together. Any ideas?
bglsmith
 
Posts: 10
Joined: Wed Jan 16, 2013 12:01 am

Re: Wave Pin Conflicts

by bglsmith on Thu Jan 31, 2013 7:56 pm

The WiFi shield is a LinkSprite CuHead.
http://linksprite.com/wiki/index.php5?t ... duino_V2.0

If I upload a sketch to exercise the WiFi it works with the Wave Shield stacked on it.
If I declare an SdReader in the WiFi's sketch then it fails to execute correctly.

I don't think they're sharing pins 11, 12, & 13 correctly, which points to a software bug (I think).

Will you point me to any good resources to help me understand how to share these pins correctly?
(Please remember that I'm just beginning.) Thanks!
bglsmith
 
Posts: 10
Joined: Wed Jan 16, 2013 12:01 am

Re: Wave Pin Conflicts

by adafruit_support_bill on Fri Feb 01, 2013 5:59 am

It could be that the two libraries are using different implementations of the SPI protocol that are not compatible.

The first two links cover the SPI library and give some background on how it works. The third link describes some of the common problems encountered with Arduinos and multiple SPI devices.
http://arduino.cc/en/Reference/SPI
http://tronixstuff.wordpress.com/2011/0 ... e-spi-bus/
http://www.circuitsathome.com/mcu/runni ... no-spi-bus
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am

Re: Wave Pin Conflicts

by bglsmith on Fri Feb 01, 2013 1:08 pm

These are excellent articles, and I'm still digesting all of the information in them. My understanding of the SPI is (SET SPI LOW, USE (MOSI, MISO, SCK), SET SPI HIGH).

I decided to see what state the WiFi and WaveHC were leaving the SPI in after initialization.

The WiFi leaves the SPI in HIGH.
The WaveHC leaves the SPI in LOW.

To verify this I put some print statements in the SdReader.cpp of the WaveHC library in the spi Low and spi High functions. Then in the daphc example I put a while(1); at the end of setup to identify the last command. It appears that the WaveHC's last command is leaving the SPI in LOW.

I'm using the latest version of the WaveHC library (wavehc20110919.zip). Before I start fixing it ...

1. Is there a better library I should be using instead?
2. Does adafruit maintain WaveHC?
3. If so, is there a way to submit my fixes to the WaveHC library to help others trying to use it?
bglsmith
 
Posts: 10
Joined: Wed Jan 16, 2013 12:01 am

Re: Wave Pin Conflicts

by adafruit_support_bill on Sat Feb 02, 2013 6:17 am

The most up-to-date WaveHC library can be found here. http://code.google.com/p/wavehc/
As well as contact information for Bill Greiman the maintainer of this library.
User avatar
adafruit_support_bill
 
Posts: 25556
Joined: Sat Feb 07, 2009 9:11 am