Is this possible? My project is gathering important data in a way that I won't be able to physically check on the instrument, and it could potentially be subject to various environmental hazards. Is it possible to stack two (or more) shields and record the same data to each with only one set of commands? It seems like that should work, if the shields are identical and connected straight through with stackable headers.
I want redundant data sets in case a card fails, or a shield fails, or whatever.
I want redundant data sets in case a card fails, or a shield fails, or whatever.
And if the Arduino or the PSU fails?
What about the code failing? You should have a second version written by someone else to the same spec running on another Arduino.
If you are going to be that serious you should duplicate the lot.
Re the stacking, as long as the shields never drive a signal it might work.
Ideally, yes, however this is a rather specialized build and I'm the only microcontroller programmer on the research group. So, the code would be a direct copy/paste of existing code. Furthermore, the whole DAU consists of 2 Arduinos, the card reader, a GPS unit, and 3 custom-built sensor interface boards. I'm hoping to deploy soon, and waiting on new parts and building duplicate boards would chew in to time we don't really have. Weight is also an issue. I'm constrained by certain...federal regulations (lol ominous)...to keep this instrument under a certain weight, and with casing, battery, safety features, and the instrument itself, I'm already pushing it.
Looking at the boards and the code, it seems that pin 12 is used to communicate from the card reader to the Arduino. Would that pose a problem in terms of competing signals/phases?
I'm not overly familiar with SD cards but pin 12 is MISO and therefore an output from the card. You can't really connect two of these together because you won't be able to properly verify the write as if it worked on one card and not the other their outputs will differ and you have a problem.
I think I would gate the clock signal and do separate writes, unless you have real timing constraints and need to write to both at once.
Graynomad:
I'm not overly familiar with SD cards but pin 12 is MISO and therefore an output from the card. You can't really connect two of these together because you won't be able to properly verify the write as if it worked on one card and not the other their outputs will differ and you have a problem.
I think I would gate the clock signal and do separate writes, unless you have real timing constraints and need to write to both at once.
Rob
I was hoping to write to both at once, yes. I wanted the second card to mirror the first, identically.
In a real world RAID 1 system, where data is duplicated across multiple drives, there are also multiple controllers doing that. Data is send out once, gets duplicated across controllers, and then written to the disks. If you use a single controller, you'll have to jump back and forth between the two, so one of them will always be a microsecond behind the other. As far as reading goes, typically only one of the disks is used to read back the information. If you're performing a verify, you simply read one disk, and compare with the next.
In your case, with a single MCU on board, I would say write data to one SD card, then duplicate it on the other. Depending on how fast and how often you need to do this, you might be able to get away with writing everything to one first, then duplicate to the other, or you can chunk the data up and write smaller pieces back and forth.
If the SD card shields have a select pin, you can have all of them on the same port, with different CS pins. If they're all using the same CS pin, you're screwed and would have to look for another logic to differentiate between them.
KirAsh4:
In a real world RAID 1 system, where data is duplicated across multiple drives, there are also multiple controllers doing that. Data is send out once, gets duplicated across controllers, and then written to the disks. If you use a single controller, you'll have to jump back and forth between the two, so one of them will always be a microsecond behind the other. As far as reading goes, typically only one of the disks is used to read back the information. If you're performing a verify, you simply read one disk, and compare with the next.
In your case, with a single MCU on board, I would say write data to one SD card, then duplicate it on the other. Depending on how fast and how often you need to do this, you might be able to get away with writing everything to one first, then duplicate to the other, or you can chunk the data up and write smaller pieces back and forth.
If the SD card shields have a select pin, you can have all of them on the same port, with different CS pins. If they're all using the same CS pin, you're screwed and would have to look for another logic to differentiate between them.
This is good advice. Temporal resolution isn't a concern. I have at least a 2.5 second window where the master board is doing nothing. I'll try this route.
Graynomad:
So when I suggested separate writes it was a no go, when KirAsh4 suggested it it's OK
As KirAsh4 says, if the SD shields have a select signal you are OK, if not you will have to gate the clock line so only one gets it at a time.
Rob
I read your solution as writing both shields with the same pinout one after the other, and I read his solution as pinning the second shield to a different digital pin on the Arduino as a second MISO, and then writing in succession. Maybe I missed something?
Same suggestion. We're both suggesting the same thing. Both shields will be on the same SPI port (MOSI, MISO, and CLK), however they each have a different CS pin. This allows you to select which one you're communicating with. You should read up on the SPI interface, specifically the independent slaves part: Serial Peripheral Interface - Wikipedia