Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

SD card & ATmega16

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
gregor001

Bascom Member



Joined: 01 Mar 2007
Posts: 5

slovenia.gif
PostPosted: Mon Dec 15, 2008 4:38 pm    Post subject: SD card & ATmega16 Reply with quote

hi:)

does anyone have a working example for
-Bascom AVR/8051
-ATmega 16 or some in this price range (atmega128 is cca.16eur in our country-expensive for me)

.. to write and read something on SD card

IMPORTANT: without BASCOM-DOS commands, only AVR or 8051

is it possible?

thnx
Gregor

_________________
Gregor
Back to top
View user's profile
thiagorod

Bascom Member



Joined: 13 Nov 2008
Posts: 109

brazil.gif
PostPosted: Mon Dec 15, 2008 7:08 pm    Post subject: Reply with quote

I think you should take a look at

http://www.dosonchip.com/

I am gonna use this chip on my next project. You send UART commands to the chip and it handles all the FAT32 read/write on SD cards.

Thiago
Back to top
View user's profile
kubic

Bascom Member



Joined: 03 Nov 2008
Posts: 42

denmark.gif
PostPosted: Mon Dec 15, 2008 7:29 pm    Post subject: Reply with quote

try google for : Phils FAT Library for ATA & MMC/SC Cards (BASCOM)
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2477
Location: Queensland

australia.gif
PostPosted: Mon Dec 15, 2008 10:19 pm    Post subject: Reply with quote

You can read and write to the card using Bascom commands DriveReadSector and DriveWriteSector in 512 byte chunks, without AVR-DOS. Since you dont need the file buffers that AVR-DOS uses, it should work fine with an AtMega16, as long as you have 512 bytes of RAM spare. But you cannot read the result with a PC, at least not with the standard FAT filesystem.

I would query your pricing though, we buy Atmega64 for essentially the same price as Atmega16 here in Aus, about AU$6, would be around 3 euro.

I saw the dosonship bare chips on Sparkfun for US$12.95

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
thiagorod

Bascom Member



Joined: 13 Nov 2008
Posts: 109

brazil.gif
PostPosted: Tue Dec 16, 2008 12:53 am    Post subject: Reply with quote

It is mandatory on my project to write data on FAT32, to be read under Windows. I didnīt know this solution from Phils, sounds nice. Although I couldnīt find hardware schematics on how to connect the SD to AVR and didnīt find good examples writing/reading SD.... I am using ATMega8515.
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2477
Location: Queensland

australia.gif
PostPosted: Tue Dec 16, 2008 1:11 am    Post subject: Reply with quote

I dont know that library, but I doubt it takes any less RAM than the AVR-DOS of Franz Vogel. At the very least, you need a buffer of 512 bytes, because that is what a card sector is. You can use one buffer for both data and directory, but it costs you a lot of swapping and hence speed. As well you need some global variables for the filesystem, plus the FAT table.

If you run the processor at 3.3 volts - same supply as the card, you just direct connect the hardware SPI lines to the card, else you should use a voltage conversion buffer - lots of info on the AVR-DOS forum about the connections needed.

(edit)
I just had a very quick look at that library, and it uses at least two 512 byte buffers, plus the usual collection of global variables, so you need at least 1 Kb + of space, the same as the AVR-DOS library.

Processors are cheap, use an AtMega64.

_________________
Adrian Jansen
Computer language is a framework for creativity


Last edited by AdrianJ on Tue Dec 16, 2008 1:24 am; edited 1 time in total
Back to top
View user's profile Visit poster's website
thiagorod

Bascom Member



Joined: 13 Nov 2008
Posts: 109

brazil.gif
PostPosted: Tue Dec 16, 2008 1:16 am    Post subject: Reply with quote

So you recommend to go with DOSonChip anyway? All the processing is off-loaded from AVR.
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2477
Location: Queensland

australia.gif
PostPosted: Tue Dec 16, 2008 1:26 am    Post subject: Reply with quote

No, I would recommend you use an AtMega64. Why add another unknown and special expensive chip when you can do it all with well tried and proven parts and software.
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
thiagorod

Bascom Member



Joined: 13 Nov 2008
Posts: 109

brazil.gif
PostPosted: Tue Dec 16, 2008 1:48 am    Post subject: Reply with quote

Actually I use a platform based on ATMega8515. Doesnīt it have enough horsepower to run AVR-DOS ? I just need to write a few bytes of code in text-format file on a SD card.
Back to top
View user's profile
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2477
Location: Queensland

australia.gif
PostPosted: Tue Dec 16, 2008 1:58 am    Post subject: Reply with quote

Unless your platform also contains some external SRAM, you are out of luck.

There are some work-arounds which would allow you to do this, they involve preparing SD cards with a file from a PC, locating the actual hardware sector the file is at, and writing to that address using the Bascom SectorWrite command. It is possible, but I would not say its easy.

Can we take this discussion over to the AVR-DOS forum ? There are more people over there who know about this stuff.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Tue Dec 16, 2008 9:35 am    Post subject: Vinculum VDIP-1 module Reply with quote

My two cents:

Have you considered using the Vinculum VDIP-1 module. You can connect a standard USB memory stick to your microcontroller and read and write it with RS232-commands.

Check http://benshobbycorner.nl

There was an article about it in november issue of Elektor.




Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
ex4

Bascom Member



Joined: 13 Jan 2006
Posts: 1064
Location: indonesia

indonesia.gif
PostPosted: Tue Dec 16, 2008 10:47 am    Post subject: Reply with quote

hello Mr Ben,
always nice to have you posted your work here Very Happy
by the way,where is the tutorial that you usually write?been visiting your website
http://benshobbycorner.nl/
but got none there Shocked
also trying to open your website at
http://members.home.nl/bzijlstra
but cannot open it? Mad
Back to top
View user's profile Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum