Home/Support/Support Forum/Initialize SD card without losing data?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Initialize SD card without losing data?

0 votes
I am developing some SD card data storage logic in Dynamic C with a Rabbit BL4S200.

How can I initialize the SD card without it resetting everything? Data included? I have found that my device can record data to the SD card just fine, but if the board is powered off or does a hard reset, it has to reinitialize the SD card, deleting all of my data?

Is there a way around this? Say I save some device data, and then want to transfer the card to identical device running identical software without erasing the data?

So far, my code does the following to initialize the SD card on bootup:
dataCache->Dev = &SD[0];
sdspi_initDevice(0, &SD_dev0);

However, I would really like to interface with the SD card without using the default initDevice() function which performs a card reset if I know my SD card has data on it.
asked May 22 in Rabbit Software by zrebstock1 New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
Calling sdspi_initDevice() shouldn't be erasing the card.

If you run the SDFLASH_INSPECT.C sample, can you write to the card and have the changes persist across boots? Try writing to various pages, reading back those pages to confirm that the write completed, and then restarting the program and reading the pages again.

Can you share the code you're using to write and read? Is it possible there's an error in your code and it always overwrites what's on the card?
answered May 26 by TomCollins Veteran of the Digi Community (1,872 points)
...