2 SD cards in parallel

Is it possible to write to 2 SD card simultaneously? So using the same SS pin for both? Same type cards, fresh formatted, ...

I strongly expect there will be conflicts with the (sector) administration or so.

are you looking for redundancy? why do you need 2 cards in parallel with the slave select going to both at once? just want two copies of the same data really fast?

i would never design this way, too many things can go wrong

does formatting erase all the bits? if not, then you are obviously asking for trouble when reading the card

having two cards in parallel means two pins driving the same signal, even the slightest differences in signal timing will cause a conflict

I suggest simply having two SS pins and performing the same operation twice

just want two copies of the same data really fast?

That was the basic idea, no intention to build a RAID 5 storage

does formatting erase all the bits?

It should clean up all relevant bits,

having two cards in parallel means two pins driving the same signal, even the slightest differences in signal timing will cause a conflict

yes at some time you would need to read a directory or a FAT etc and that's asking for interference ==> trouble.

I suggest simply having two SS pins and performing the same operation twice

That is my original design but I just wondered if it could be done in parallel, would free some CPU cycles and footprint.

SD cards can't be run in parallel. They are very complex, more complex than the Arduino.

When you send a command to a card it goes busy by pulling MISO high until it is ready to send status. If you had two cards enabled they would interfere with each other.

There are many other reasons this won't work.

You could write a driver that mirrored blocks during write but this is the easy part of the problem. The cards are bound to get out of sync due to crashes or unexpected power downs.

You would need a program to resolve inconsistencies in file systems. This is a hard problem.

It should clean up all relevant bits,

All relevant bits? If it's not literally all bits, then you're going to have problems.

yes at some time you would need to read a directory or a FAT etc and that's asking for interference ==> trouble.

That's not what I meant, I even if both cards tried to send 0x55, you might still get timing differences on the picosecond scale.

If you are desperate for speed, try a multi-processor system, where one processor is dedicated to writing to two cards

Then again, if you need speed, SD cards are not the right solution in the first place.

All relevant bits? If it's not literally all bits, then you're going to have problems.

A fast format only cleans the FAT table but not the filedata on disk, but that should be enough. that is what I meant

That's not what I meant, I even if both cards tried to send 0x55, you might still get timing differences on the picosecond scale.

thanks for explaining, I'll stick with the original and proven "write twice" strategy.

robtillaart:
A fast format only cleans the FAT table but not the filedata on disk, but that should be enough. that is what I meant

Ah, but that is not enough. Imagine you read one card and it outputs a bit 1, while the other card reads a bit 0. What happens on the MISO pin? One will be driven high while the other is driven low. That's like short circuiting the positive terminal of a battery with the negative terminal, you'll end up getting a surge of current between the two pins, quite possibly causing damage.

Forget it. Cards don't just start sending data when you read. A card holds MISO high until it is ready and then sends a start of block token followed by data.

The idea of parallel cards won't work!

An SD card is not a simple passive device!! They do things when they want to.

You should give it a try. Just remember to leave MISO unconnected from one of the two cards so they don't conflict on reads.

johnwasser:
You should give it a try. Just remember to leave MISO unconnected from one of the two cards so they don't conflict on reads.

All the code I've used to access SD cards has a little bit that requires the card to be ready before performing any write action, without MISO, this is impossible to detect. If you add delays, then you pretty much forfeit the advantage of having the two cards in parallel, which is speed. Also, no reading means no writing unless you are writing in 512 byte blocks only, due to the way flash memory works (erase by blocks, so you need to read in what was there before if you only write a partial block)

frank26080115:

johnwasser:
You should give it a try. Just remember to leave MISO unconnected from one of the two cards so they don't conflict on reads.

All the code I've used to access SD cards has a little bit that requires the card to be ready before performing any write action, without MISO, this is impossible to detect. If you add delays, then you pretty much forfeit the advantage of having the two cards in parallel, which is speed. Also, no reading means no writing unless you are writing in 512 byte blocks only, due to the way flash memory works (erase by blocks, so you need to read in what was there before if you only write a partial block)

I said "leave MISO unconnected from ONE of the two cards". If it's going to work at all it will work by having the two cards sufficiently similar that the timing that works for the one that is connected to MISO will also work for the one that is NOT connected to MISO. I'm not saying that it WILL work, only that there is little reason not to try.

johnwasser:

frank26080115:

johnwasser:
You should give it a try. Just remember to leave MISO unconnected from one of the two cards so they don't conflict on reads.

All the code I've used to access SD cards has a little bit that requires the card to be ready before performing any write action, without MISO, this is impossible to detect. If you add delays, then you pretty much forfeit the advantage of having the two cards in parallel, which is speed. Also, no reading means no writing unless you are writing in 512 byte blocks only, due to the way flash memory works (erase by blocks, so you need to read in what was there before if you only write a partial block)

I said "leave MISO unconnected from ONE of the two cards". If it's going to work at all it will work by having the two cards sufficiently similar that the timing that works for the one that is connected to MISO will also work for the one that is NOT connected to MISO. I'm not saying that it WILL work, only that there is little reason not to try.

oops sorry, must have read "or" instead

This will never work!

Two identical cards will not have the same timing because no two cards are identical. Flash has bad spots that are remapped.

The delays happen due to the flash controller in the cards doing wear leveling, flash erase of large blocks, remap of bad spots, and other operations.

The timing of two cards will never allow parallel operations because no two cards behave the same.

fat16lib:
This will never work!

Would it not be possible to produce a circuit that detects when both cards are ready before signaling ready?

My understanding is that the SD card holds the MISO/DO line high while it's busy after a command. It seems to me that it would not be that hard to detect this signal (and differentiate it from data on the MISO/DO line) so that the MISO/DO line could be held high if either SD card was busy. Would that not allow the command to successfully complete on both cards?

I suggest you read the SD protocol spec. Your ideas are not even close to possible.

Good luck detecting the difference between data, commands, and status.

How do you handle command status? Both cards send status after a command. Which status do you send on the SPI bus to the Arduino?

SD cards rarely fail. Most lost data is due to software bugs, unexpected reboots, or power down during a write.

Parallel cards won't help much.

You could write your precious data to two cards. SdFat supports multiple cards on the SPI bus. You could have a file open on each card and write your data to both files. It is likely one card will survive a reboot or power down.

You would need to use a Mega since each card requires a 512 byte cache. Only very small apps can support two cards on a 328.

No chance on SPI, you just have to control each separately with a unique CS line. In native mode they can be paralleled because they have an addressing scheme which enables commands to be targeted at a single card only, but the only command that works truly in parallel is the ALL_SEND_CIS one which reads the addresses in a manner similar to the OneWire bus's SEARCH ROM command.

Not only is an SD card more complex than the Arduino, they're probably more powerful than early PCs!

Hello,

Sorry to reignite such an old topic, but I'm curious about how something like this works:

Maybe I misunderstood the original topic, but isn't this adaptor basically running two micro SD cards in parallel? So it seems it can be done. Would it be plausible if one wasn't trying to write the same thing to both cards at the same time. For instance, you have two 64GB cards, and they are put together to act as one 128GB card.

Or is it the case that an adaptor such as that is running the cards in series? Is there a difference? I'm interested in running two 128GB cards as one 256GB card in an iPod.

isn't this adaptor basically running two micro SD cards in parallel?

The original question was about wiring two SD cards in parallel to get redundancy/mirroring. This device appears to adapt between the MemoryStick Pro DUO interface and two MicroSD cards of 8GB or less.

I'm interested in running two 128GB cards as one 256GB card in an iPod.

I was not aware of any iPod that accepted memory cards (MemoryStick or SD). What model did you want to do this to?

No this adapter does not write the SD cards in parallel. It make two SD cards appear like a twice as large memory stick.

Read the SD spec - it is impossible to access two SD cards in parallel on one SPI bus. Cards are not synchronous devices. They go ready at random times and return status at random times.

I was not aware of any iPod that accepted memory cards (MemoryStick or SD). What model did you want to do this to?

There are adaptors which will go from an SD card to a ZIF plug. That's the way to do it. I found this thread because I was wondering if there was a way to make one of those adaptors use two cards simultaneously. Kind of like the link I posted, except two full size SD cards (maybe one on top of the other or next to each other. Depends on space requirements).

With all that said, and I'll open a new topic if it's suggested, but is it possible to make an adaptor like the one I linked to which will serve the purpose I'm looking for? One which accepts two regular size SDXC cards as one big card. I apologize for my lack of knowledge of SD cards.