Go Down

Topic: CS pin at 1.7 V when inserting SD card [SOLVED] (Read 1 time) previous topic - next topic

JacquesBBB

Jul 22, 2015, 01:41 pm Last Edit: Jul 23, 2015, 01:06 am by JacquesBBB
I am setting up a data logging device based on arduino DUE.

I had already  a   device made on the base of  an self made arduino UNO aund using I2C communication to the barometric captors and SPI to SD cards for recording.

Now I want to put everything on SPI, but I encounter many problems.

IN particular I noticed that when I introduce a SD card on the socket, the CS voltage drops from
3.3V to 1.6-1.7V.
Is this a normal behaviour ?

I am afraid that at this voltage the CS is not considered as HIGH and interference with the SPI bus may occur.  IS it true ?

The sd card is perfectly OK, and I have been using with the same socket on an other logging device.

The socket is just a micro SD card converter on which I have soldered pins with a 0.1uF cap between the GND and VCC. It works perfectly  on the other login devices.
The advantage is that there are no converters or regulator, whihc is no problem as everything is in 3.3V.

Thanks  for any help.

Jacques  

SurferTim

Which pin is CS? If the SPI.begin function has not run yet, that could be the case.

JacquesBBB

Which pin is CS? If the SPI.begin function has not run yet, that could be the case.

The CS pin of the SD card. IN my case, I used PIN 8 on the DUE.
The 1.7 V is measured after the SPI.begin().

If I remove the SD card from the socket, I find 3.3V  at the same CS pin.
If I put the SD card in one of my other logging device based on Atmega328 with  the same SD card socket,
3.3 V  voltage,
I have no problem and the CS pin is at 3.3V.

The main problem on my DUE is that it affects all the measures. Most probably, the SD card is not disabled and
corrupt the SPI bus.
 

SurferTim

Have you tried setting D8 as OUTPUT and HIGH at the start of the setup function?
Code: [Select]
void setup() {
  pinMode(8,OUTPUT);
  digitalWrite(8,HIGH);

// rest of your setup

Does it still show 1.7 volts on D8 with the SD card inserted?

JacquesBBB

#4
Jul 22, 2015, 04:44 pm Last Edit: Jul 22, 2015, 04:47 pm by JacquesBBB
To be sure, I changed the CS number on the SD card.

I hook it now to 10 and 52 (I have two SD cards)

But  The same result persists. With Low voltage at the CS pin of the SD card (1.7V)
as soon as I insert a card in the socket.
Same behaviour on both sockets.

On the SPI bus, I have also 6 sensors,  with CS on pins 22,24,26,28,30,32.

When they are used alone (I.e. all the 6 , but without the SD cards inserted), everything is fine, and the voltage at their CS pin is 3.3V.
When the sd card is inserted (without any attempt of access for the moment)
with the only code

Quote
pinMode(CSD1, OUTPUT);
    digitalWrite(CSD1, HIGH);
    pinMode(CSD2, OUTPUT);
    digitalWrite(CSD2, HIGH);
The reading of the sensors give nonsense. Nevertheless, the CS pins of the sensors is
3.3V (3.26V) as expected. Only the SD card gives problems.


JacquesBBB

Have you tried setting D8 as OUTPUT and HIGH at the start of the setup function?
Code: [Select]
void setup() {
  pinMode(8,OUTPUT);
  digitalWrite(8,HIGH);

// rest of your setup

Does it still show 1.7 volts on D8 with the SD card inserted?

YES.  This is the setting ( see my above post).
And Actually, I have 3.3V when the SD card is not inserted in the socket.

CrossRoads

1.7V does not sound correct - a low from '328P (or 1284 or 2560P) will be <0.9V (5V system) unless the current being sunk is really high - >20mA.
An SD card shouldn't need 20mA to pull its CS pin low.
I strongly suspect something is not wired correctly.
Or, pinMode was not used to declare the pin as an OUTPUT.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

JacquesBBB

1.7V does not sound correct - a low from '328P (or 1284 or 2560P) will be <0.9V (5V system) unless the current being sunk is really high - >20mA.
An SD card shouldn't need 20mA to pull its CS pin low.
I strongly suspect something is not wired correctly.
Or, pinMode was not used to declare the pin as an OUTPUT.
I just did again the experiment. Taking care of all parameters.

I have the data logger with the Arduino DUE and the one with the Atmega328P.
- I took all SPI sensors off from the DUE.

- I measure the CS pin on the SD card of the Atmega328 : 3.3V
- I removed the socket+SD card from the Atmega328 and plug it in the DUE.
- The measure is now 1.7 V
- I removed the sd card from its socket.
- The measure is now 3.3V at the same CS pin.

 

JacquesBBB

In addition to all previous tests, I changed the Arduino DUE with a brand new one, still in ints original wrapping.

My device is a shield, so I just plug it on the new arduino DUE, with exactly the same result :


3.3 V At the CS pin of the socket when there is No  sd card inserted.
1.7 V when the SD card is inserted.


CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

SurferTim

If the SD card is on a shield, how are you changing the CS pin? Which shield are you using? A link to the hardware might help.


JacquesBBB

If the SD card is on a shield, how are you changing the CS pin? Which shield are you using? A link to the hardware might help.


It a  self made shield.
The fact that it is design as a shield allowed me to change the DUE  very easily.

JacquesBBB

Gotta be a wiring problem then.
Of course this is what I suspected first, as I have made all the wiring.
But I have checked all the resistors and they are all  very high.

If it were a wiring problem.  I suppose that it would affect also the socket when the sd card is not present,
which is not the case. When the sd card is not here I  have 3.3V at the CS pin.

But I know that it is sometime difficult to find your own  mistakes.

I wish some one could do the same experience and tell me the outcome.


JacquesBBB

In order to be sure, I decided to force  the CS pin to 3.3V.

I took a comparator, (LT1017) and set up a voltage divider  to put the -IN at 1.1V (VCC : 3.3V).
I shorcuted the socket of the SD card, so that the CS would be directed to the comparator at +IN, and if
above 1.1 V (as for 1.7V) , then the comparator  OUT would be 3.3V.

I tested it first, and then put it on the board.

And the outcome was nearly zero at  the CS pin.

And then I realized that VCC and GND were shorted on the board!!
 I had checked everything but not this one.

After putting it back in order, everything is fine and now I have 3.3V at the CS pin.

I spend nearly two days on this one, but I must say that there were too many new things with this DUE,
so I was not sure where the error came from.

Thanks anyway for the feedback. Its always useful !!

 

Go Up