0

I'm trying to connect 2 SD cards to an Arduino Uno board.

  1. My first question is: Is it possible to connect two SD cards to one Arduino simultaneously?
  2. The second question is: If it is possible to connect 2 SD cards, How can I copy card 1 data to card 2

My project goal is to copy data from one peripheral memory to another peripheral memory when an external interrupt occurs.
Can anyone help me please ?

asked Jul 6, 2020 at 20:32
6
  • 1
    Yes, SD cards use the SPI bus so you can connect more than one. They will each need their own chip select line. To copy just read from one and write what you read to the other. Super simple. If none of this makes sense then do some study on dealing with a single SD card. Once you got the basics hooking up two will be trivial. Commented Jul 6, 2020 at 21:04
  • 4
    Just watch out cause some cheap SD modules don’t release the line when you deselect them. They won’t let anything else on the SPI bus work without some minor modifications. Buy good quality stuff and it shouldn’t be a problem but if you go for the cheapest thing you can find then you’ll need to study this issue as well. Commented Jul 6, 2020 at 21:05
  • Thanks for your help & good answer :). Actually this is not a real project and I should simulate it using Proteus simulator. Do you have any good tutorial for how to deal with SD cards in Arduino? @Delta_G Commented Jul 6, 2020 at 21:28
  • @user67463 have you tried googling for a tutorial? There are tons of them Commented Jul 6, 2020 at 22:10
  • There are literally hundreds of those tutorials all over the internet. Finding one will be far easier than writing this code. If you open the Arduino software and check the examples there are examples of how to use an SD card. Start there. Or just google "Arduino SD" and start reading. Commented Jul 6, 2020 at 22:30

1 Answer 1

1

You can't do it with your Arduino-Uno (and usual SD libraries).

SD cards are organized in 512 byte "sectors". You need at least one sector for the file system itself and one sector for the data. If you try to have two files open simultaneously, all your 2048 bytes RAM are required for the SD buffers and you can't return from the file open() call any more.

answered Jul 7, 2020 at 11:12
2
  • You could do a block-by-block copy of the SD card, instead of actually reading the file system. Downside is that the SD to copy to has to be as large, or bigger as the original card. And that copying always takes the same (long) amount of time, no matter "full" the card is Commented Jul 7, 2020 at 13:58
  • @Gerben: correct. (That's my "usual SD libraries" restriction) If you have old 64 MB SD cards, you might do that full copy. But the sentence "when an external interrupt occurs" makes me think user67463 tries to ride a dead horse. Commented Jul 7, 2020 at 16:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.