Go Down

Topic: Mega with wiznet shield (wire hack)+thingspeak+sd problem (Read 5 times) previous topic - next topic

SurferTim

Quote
Are these correct?

No. Once all the SPI slave selects are set HIGH in setup, they no longer need to be manipulated. The libraries do that.

Code: [Select]
// in setup()
pinmode(8,OUTPUT);
pinmode(10,OUTPUT);
pinmode(3,OUTPUT);
digitalwrite(10,HIGH);
digitalwrite(8,HIGH);
digitalwrite(3,HIGH);

//in loop() for example. Only the w5100 SPI will be selected.
// all other slave selects are HIGH (disabled)

if(!getPage(server,pageAdd)) Serial.print("Fail ");
    else Serial.print("Pass ");


vespapierre

Tim,
is that working for older types of Ethernet shields without the ICSP connection too?

SurferTim


Tim,
is that working for older types of Ethernet shields without the ICSP connection too?

The SPI works like that with all shields, but the SD is a different pin than the new cards. On the new shields, the SD slave select is D4.

The ICSP connector in the new shields handle only SCLK, MISO, and MOSI lines. The slave selects for those devices remain on D10 and D4.

vespapierre

my last idea was, maybe SD and Ethernet tried to communicate at the same time...tha's why I thought they should be switched enabled and disabled...:(

SurferTim

That is not it. The ethernet and SD libraries use the same type code. Both use something like this to transfer:
Code: [Select]
digitalWrite(SS,LOW);
SPI.transfer(0x00);
SPI.transfer(0x00);
digitalWrite(SS,HIGH);

Both leave the slave select HIGH (disabled).

It is adding the OneWire.h file that causes the crash, correct?

Go Up