this simple SD library

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi guys,
I came across this as I have been looking for a much more slimmed down version of sd card functionality and a) I wondered whether anyone had tried it, and b) whether there was a write to SD card function - or anyone could show me how.

Also, if I were to put this into a computer, how would I view the data?
https://www.avrfreaks.net/index.p...

Or in terms of that last point - if I wanted to view the data on a pc, how would I do it for this functionality:
http://www.avrprojects.info/avr-...
Thanks

EDIT:
I know everyone recommends using Fatfs/petitFS but I have wrestled with them both now and would just like a simple few functions to deal with the problem of logging data on a mega328p - and I dont think its worth all of petitFS..
The above post, I understand (reading-and-writing-sd-card-using-atmega16/) but what I dont get is how you know what sector you are writing/reading to on the sd card, and therefore how to retreive specific information later?
Any advice would be greatly appreciated.
Alex

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could format it on a pc then write a big file full of zeros. I betcha Cliff could tell us where the first file's data starts. I think the cards below 4G use a byte off set to start reading and writing. I guess you multiply the sector number by 512. The big cars use the sector number.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The library you link to is read only (in FAT reading is trivial, you could probably train chimps to do it, it's the writing that's far more complex).

I just don't understand your comment about Petit. It's incredible that it can read and write in under 4K of code and only using a handful of bytes in RAM. I think you'd have to go a very long way to find a better implementation and if you can't make it work it may just be that your programming skills haven't got to the right place yet.

Any kind of library code is all very well when it "just works" but if it doesn't you have to be ready to wade in, find out why it's not working and fix the problem. With FAT and SD there are so many variables outside the control of the programmer that teething troubles are very likely.