How to interface an SD/MMC card to a Mega128 question.

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

I'm interesting in using a SD/MMC card with my Mega128. But I have'nt found any information by searching the forums and academy.

Maybe someone has some informations for me.
How do I have to treat the logical voltage levels to or from the SD/MMC card since they are different than the Mega128 ones ? Do I have to convert them and how ?

What about the supply voltage of max 3.6 Volts for the card ?

something like a schematic or picture would be nice.

Thanks in advace.

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

searching against this forum (for "sd/mmc") lists a number of threads including this one;

https://www.avrfreaks.net/modules.php?op=modload&name=PNphpBB2&file=viewtopic&t=19105&highlight=

The same search on google included this;
http://www.captain.at/electronic-atmega-mmc.php

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

@dapriuk

Thanks for the information. This will help me for sure.
Next time I will make sure to clean my glasses before I search the forums again. ;)

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

Example using MMC and FAT-16 filesystem :
http://www.metsys.fi/ana/mega32-...

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

many thanks ari.naukkarinen

that might be a good start although I'm having some problems reading the finish language. ;)
But I can figure out what the software does.

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

Comments in program code tells almost same as texts in finnish..

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

There is a project on sourceforge, who's name I don't remember anymore, that is an AVR MMC lib supporting FAT over MMC on AVRs with at least 1K of RAM. This code is part of the Yamp MP3 player, and Jesper (and friends?) have cut the code and turned it into a lib.
I have taken the MMC part of the lib and adapt it to work on a Tiny26 (128 bytes of ram). In my application I just wanted to log some data; I don't use a FAT filesystem (it wouldn't fit the Tiny's, tiny ram). I make 1 big file (card's size) with a special mark at the beggining, and save it to the card; then the AVR will look for the mark and start logging from that sector forward.
This code fits the small memory of the Tiny because it uses no 'big' 512 byte buffers. It takes advantage of the way the SPI/MMC work; instead of collecting the data of a sector in a buffer and then write the entire sector, it writes the sector "on the fly" to the card. When the sector gets filled, then it flushes the sector, while using a small ram buffer to hold any data that may come up while the card is busy flushing the previous sector.
Unfortunately, for my data log rate, the Tiny's ram size is not enough, taking in consideration the time that the card takes to flush a sector. The data logging is not constant but, in the peak, it can loose data.
Anyway, here goes the entire project. It's a primitive logic analyser, intended to be used as an OBD sniffer :), although it is rather flexible; you can, for example, use the inputs to sample analog data because the pins can be used by the Tiny's ADC.
Although it is not complete in terms of some documentation, you will find some interesting files inside, like the worklog I did during this project. There is a file with time spent in this project and progress. I have spent 70 hours on it over several weeks. You will also find some pictures and some files with component values and other dimensioning calculations. You will also find a file a friend of mine gave me with the project's "desired feature list". I always wanted to try an MMC and when my friend started to tell me about this OBD stuff I just jumped in. I had no idea about what would be the card's "performance", but needed some goal to try it out.
Cheers!

Attachment(s): 

Embedded Dreams
One day, knowledge will replace money.

Last Edited: Sat. Jan 28, 2006 - 03:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Unfortunately, for my data log rate, the Tiny's ram size is not enough, ...

There is a current thread asking "What kind of freak are you" poll. In this case, my first thought on selecting the Tiny26 for this project is --why? In qty. 100, the Tiny26 and Mega48 cost US$1.50, and the Mega48 has many more resources. In particular, the 1k of SRAM in the Mega8/88/168 (adding US$0.50 more) makes projects like this much easier, I would think.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Well, tiny26 because:
- First of all, it is a hobby, so I wouldn't buy not even 1 hundred of them
- I have a few Tiny26 around
- I have to buy outside my country and this adds shipping costs and time
- The shop where I buy (abroad) has a limited number of models
I have to work with what I have and with what I can buy. I have 1 ATmega8,
but it is a little bit bigger and costed me 2-3 times the price of the Tiny, so
I want to save it for something "bigger". This project was an experience,
it didn't work out, too bad. Next time I'll have the knowlege to do better
choices.

Embedded Dreams
One day, knowledge will replace money.