Ardino as AVR Programmer -> ATtiny85 -> SD Library Pin help??


I have an ATtiny85 which I can successfully program with my Arduino, however, I wish to connect an SD Shield to my ATtiny85 to read and write data, there are enough pins but I am unsure on how to re-map them to the ATtiny85 pins.

Can anybody help me out?


The ATtiny85 has too little SRAM to write an SD with a file system.

An SD block is 512 bytes and the entire block must be written. File systems require a block to be read, updated, and rewritten.

What about an ATtiny84?

ATtiny84 also has only 512 bytes of SRAM, too little to write an SD with a file system.

Petit Fat claims that it can be used with RAM sizes less than sector size

The Energia library for the TI launchpad use it, and AFAIK the chip used also only has 512bytes of RAM

Petit Fat is extremely limited for file write.

The write function has some restrictions listed below:

Cannot create file. Only existing file can be written.
Cannot expand file size.
Write operation must start/stop on the sector boundary.

File write operation must be done in following sequence.

pf_lseek(ofs); read/write pointer must be moved to sector boundary prior to initiate write operation or it will be rounded-down to the sector boundary.

pf_write(buff, btw, &bw); Initiate write operation. Write first data to the file.

pf_write(buff, btw, &bw); Write next data. Any other file function cannot be used while a write operation is in progress.

pf_write(0, 0, &bw); Finalize the write operation. If read/write pointer is not on the sector boundary, left bytes in the sector will be filled with zero.

The read/write pointer in the file system object increases in number of bytes written. After the function succeeded, *BytesWritten should be checked to detect end of file. In case of *BytesWritten < ByteToWrite, it means the read/write pointer reached end of file during the write operation. Once a write operation is initiated, it must be finalized or the written data can be lost.

Thanks fat16lib,

I just found this, using an ATtiny84 - I haven't tryed it out

Update: It actually worked reading a file. I use ATtiny84 running @8MHz, and 3,3V, so no level converter needed

Read is not a problem.

Write always has severe restrictions for small memory since you can't create or extend files without a 512 byte buffer.

You can rewrite selected portions of an existing file assuming each write starts on a 512 byte boundary and the write record will be filled to the next 512 byte boundary, usually with zeros.

Write always has severe restrictions for small memory

Thanks for the information

I was looking at the Petit Fat documentation for writing files. As far as I can see it is not easy to do as you also point out

Anyway, I think it's impressive to see my little ATtiny85 sit and read a big file. I am sure that a read only solution can be useful in various projects with tiny's