Go Down

Topic: SD/MMC From the ground up (Read 30 times) previous topic - next topic

sirmorris

@johanzebin: I don't know about this. The information would be great to add to the article though, so please let us kn ow how you get on. I think your best approach is to stick a frequency meter or oscilloscope on the PWM pin and look at what happens when you run the SPI code. You could write a little loop which writes or reads from the card and display the timings with and without tweaking the PWM rate. Experiment, have fun :)

@jluciani: thanks! I looked into putting this up in the playground, but  I don't have the time to learn wikispeak right now :( Any volunteers?? ;)

westfw

It seems to me that one ought to be able to write a MUCH smaller implementation for FAT16 on SD/MMC if all you want is read-only, AND you're willing to take into account the fact that accessing the flash card is relatively fast (compared to a floppy, say) so you won't need to cache quite as much info.

Does anyone know of such an implementation?

waxweb

and in very simple mode, here....
I would like to read text [no writing] from a txt file on an SDcard, and send it to an LCD using serial.print... I have looked high and low through all the examples, but being um noob, I am having a heck of time figuring out how to do that. Could someone hold my hand, e.g. a code example? I use a 4x20 display, and of course there are control characters. I imagine I have to format the text for half the screen then the other half, each new section on a new line in the text file, padding each line to proper length [since I can't figure out how to parse/split text]... I am also having some um conceptual problems on how to go from bytes -> ascii, but I guess that will just be obvious in the code example, for which I certainly and hopefully do thank you in advance! I hope.

thanks,
David

sirmorris

I haven't got the time to play ATM, but you need to do the inverse of devicePrint.

Code: [Select]
initialise()
{
 bytesInBuffer = 0;
}

char getCharFromBuffer()
{
 if (bytesInBuffer == 0)
 {
    readSectors(sector, buffer, 1);
    ++sector;
    bytesInBuffer = 512;
 }

 --bytesInBuffer;
 return buffer[bytesInBuffer];
}


A byte is an 8-bit wide data type. So is a char. The distinction is _usually_ whether the value is treated as signed or not. The ansi character set only uses 127 values because logically it's unsigned.

Do you really need SD for characters for an LCD display? Just how much text are you wanting to display??? Wouldn't it be better to store the strings in PROGMEM?

C

pakrat

Am I getting this right, if I set up an arduino board, using the SPI pins connected to an SD card socket, with proper resistances;etc, I can log(save) data on an SD card?  Then after saving data on the card, I can remove the card from the card socket, bring the card to a PC, and enter the data directly to the PC via one of the computer's ports, such as one of the USB ports? Can I do this by using the uFAT library?

Or do I have the wrong idea?

I've already downloaded uFAT2, uFAT EXAMPLE, DEVICE PRINT, DEVICE PRINT LIBRARY, DEVICE PRINT DEMO.  Are the uFAT2 & DEVICE PRINT libraries for different purposes?

I've uploaded uFAT example and DevicePrint demo to my arduino board and, as soon as I connect the card socket to the SPI pins I'm ready to give it a try.  Is there anything else I should do? Is there anything that should be done with the SD card first?  Does it need to be pre-programmed for FAT operation?

Thanks in advance
PWO


Go Up