View previous topic :: View next topic |
Author |
Message |
gregor001
Joined: 01 Mar 2007 Posts: 5
|
Posted: Mon Dec 15, 2008 4:38 pm Post subject: SD card & ATmega16 |
|
|
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 |
|
|
thiagorod
Joined: 13 Nov 2008 Posts: 109
|
Posted: Mon Dec 15, 2008 7:08 pm Post subject: |
|
|
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 |
|
|
kubic
Joined: 03 Nov 2008 Posts: 42
|
Posted: Mon Dec 15, 2008 7:29 pm Post subject: |
|
|
try google for : Phils FAT Library for ATA & MMC/SC Cards (BASCOM) |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Mon Dec 15, 2008 10:19 pm Post subject: |
|
|
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 |
|
|
thiagorod
Joined: 13 Nov 2008 Posts: 109
|
Posted: Tue Dec 16, 2008 12:53 am Post subject: |
|
|
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 |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Dec 16, 2008 1:11 am Post subject: |
|
|
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 |
|
|
thiagorod
Joined: 13 Nov 2008 Posts: 109
|
Posted: Tue Dec 16, 2008 1:16 am Post subject: |
|
|
So you recommend to go with DOSonChip anyway? All the processing is off-loaded from AVR. |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Dec 16, 2008 1:26 am Post subject: |
|
|
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 |
|
|
thiagorod
Joined: 13 Nov 2008 Posts: 109
|
Posted: Tue Dec 16, 2008 1:48 am Post subject: |
|
|
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 |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Dec 16, 2008 1:58 am Post subject: |
|
|
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 |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Tue Dec 16, 2008 9:35 am Post subject: Vinculum VDIP-1 module |
|
|
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 |
|
|
ex4
Joined: 13 Jan 2006 Posts: 1062 Location: indonesia
|
Posted: Tue Dec 16, 2008 10:47 am Post subject: |
|
|
hello Mr Ben,
always nice to have you posted your work here
by the way,where is the tutorial that you usually write?been visiting your website
http://benshobbycorner.nl/
but got none there
also trying to open your website at
http://members.home.nl/bzijlstra
but cannot open it? |
|
Back to top |
|
|
|