Go Down

Topic: Ardino as AVR Programmer -> ATtiny85 -> SD Library Pin help?? (Read 2 times) previous topic - next topic

Bioshox

Hello.

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?

Bioshox.

fat16lib

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.


fat16lib

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

Erni

#4
May 01, 2013, 12:20 am Last Edit: May 01, 2013, 12:30 am by Erni Reason: 1
Petit Fat claims that it can be used with RAM sizes less than sector size

http://elm-chan.org/fsw/ff/00index_p.html

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

fat16lib

Petit Fat is extremely limited for file write.

Quote

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.


Erni

#6
May 01, 2013, 11:07 am Last Edit: May 01, 2013, 01:56 pm by Erni Reason: 1
Thanks fat16lib,

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

http://harizanov.com/2012/05/toying-with-attiny84-and-sd-card-in-arduino-ide/

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

fat16lib

#7
May 01, 2013, 06:05 pm Last Edit: May 01, 2013, 07:10 pm by fat16lib Reason: 1
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.

Erni

Quote
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

Go Up