Go Down

Topic: max6675+ethernet+sd card (Read 7955 times) previous topic - next topic

jmaxado

No luck this time
With the max wires connected I get

Starting SD..fail
Starting w5100..

And it just hangs like that

José

SurferTim

#31
Nov 06, 2012, 08:00 am Last Edit: Nov 06, 2012, 08:08 am by SurferTim Reason: 1
There must be a wiring problem or IC fail. Check:
Pin 7 (SO) to digital pin 50
Pin 6 (CS) to digital pin 49
Pin 5 (SCK) to digital pin 52
Pin 4 Vcc = 5v
Pin 1 GND is connected to ground on the Arduino.

Try the test sketch with the above connected, except leave SO (Pin 7 to digital pin 50) disconnected for a test. Do the SD and w5100 start ok then? SO should be a tri-state output on the max6675, but that may not be working correctly.

edit: If that works ok, then connect pin 7 to digital pin 50 and connect pin 6 (CS) to +5v. Try the test again.

jmaxado

Without pin 6 I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete

With pin 6 to 5v I get

Starting SD..ok
Starting w5100..

And it hangs there.

Jose

SurferTim

Quote
Without pin 6 I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete

You did mean without pin 7 connected to the Arduino, correct? If that is correct, then the max6675 is malfunctioning. The SO pin on that IC is not tri-state, and trashing up the SPI bus. On that, I don't have a solution except try replacing it.


jmaxado

Sorry I meant pin 7 the one on the pin 50 of mega.

José

SurferTim

#35
Nov 06, 2012, 12:17 pm Last Edit: Nov 06, 2012, 03:19 pm by SurferTim Reason: 1
I contacted Maxim tech support about the max6675 SO pin, and if it is in fact a tri-state output. I should hear from them soon.

edit: Maxim is on the west coast, so it may be a while. If you want to experiment a little while you wait, remove the ethernet shield and run this code with the max6675 connected.
Code: [Select]
#include <SPI.h>

void setup() {
 Serial.begin(9600);

 pinMode(53,OUTPUT);
 SPI.begin();

 // disable max6675 SPI and start the first A/D conversion
 pinMode(49,OUTPUT);
 digitalWrite(49,HIGH);
 
 Serial.println("Setup complete");
}

void loop() {
 delay(1000);

 // thisTemp gets temp in 1/4 degrees C
 int thisTemp = readMax();
 
 Serial.print(thisTemp/4,DEC);
 Serial.print(".");
 Serial.println((thisTemp%4) * 25,DEC);
}

int  readMax() {
 int maxLow;
 int maxData;
 
 //  enable max SPI
 digitalWrite(49,LOW);

 // do the 16 bit read  
 maxData = SPI.transfer(0x00);
 maxLow = SPI.transfer(0x00);
 
 // disable max SPI and start next conversion
 digitalWrite(49,HIGH);

 // convert to an integer from the two bytes
 maxData = maxData << 8;
 maxData = maxData | (maxLow & 0xff);

 // shift temp reading into position
 maxData = maxData >> 3;
 
 // return 1/4 degrees Celsius
 return maxData;
}

Does it display the correct temperature on the serial monitor?

I forgot to set pin 53 to OUTPUT in the setup() function. I corrected that.

SurferTim

This is from Maxim tech support:
Quote
Tim,
Yes, the MAX6675 SO pin should be high-impedance when CS\ is high, as well as during the D0 bit output (see Figure 1a).

Send us a scope shot of a read to another chip, showing our CS\, SCLK, & SDO.

MAX6675 is not recommended for new designs; use MAX31855KASA+.
http://www.maximintegrated.com/datasheet/index.mvp/id/3149/t/or

Mixed Signal Apps

I will presume the output section of your device has failed. It may output the correct data when connected by itself, but not go to high impedance when the CS line is HIGH.

jmaxado

Hello
Surfer Tim I will do that test later tonight. I am at work now and I cannot remove the Ethernet shield.
Meanwhile I was doing some searching regarding the version of the Ethernet shield and I found this site

http://shieldlist.org/arduino/ethernet-v5

This is my board.
Here it says that this version of the Ethernet shield uses analog 0 and 1.
Currently I am using this port as analogs inputs.
Could this be the problem ?

José

SurferTim

My opinion? Disconnect everything from your Mega. Try just the max6675 on the standard SPI bus. Then try it with just the ethernet shield. Then add one thing at a time until it fails, then back up one step.  :)

jmaxado

Hello
I would prefer not to do that because I have lots of stuff connected and between testing I keep my old version running and getting data for all the other sensors.
So can we keep testing with all plugged ?

Thanks

José

SurferTim

Sure! Upload the code in reply #18. What does the serial monitor show?

PaulS

Quote
Could this be the problem ?

Clearly a problem. Not necessarily THE problem.

jmaxado

I shell correct this as soon as I get home.
And do the testing Surfer Tim suggested.
thanks for all the help guys.

jmaxado

Hello
I am back to the testing
With the code from post #18 and the wire of the max connect to pin 50 I get
Starting SD..fail
Starting w5100..
If I disconect the wire of pin 50 it runs
I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete
0.-25
0.-25
0.-25
0.-25
0.-25


José




jmaxado

The same happens with the code from post #14.

José

Go Up