View previous topic :: View next topic |
Author |
Message |
alturasu
Joined: 16 Oct 2004 Posts: 8 Location: Ankara / TURKEY
|
Posted: Sat Feb 19, 2005 11:09 pm Post subject: AVR-DOS & MMC CARD |
|
|
Hi
Has anybody tried to connect mmc card to mega32 ?
i saw avr-dos and there's a lib for mmc card
Can i use this library for mega32 ? and brand of the mmc card is importnant?
Thanks Altug
|
|
Back to top |
|
|
philm
Joined: 14 Jul 2004 Posts: 138 Location: Australia
|
Posted: Sun Feb 20, 2005 2:25 am Post subject: |
|
|
Yes it works, but I tried it on a Mega128 and a SD card.
The MMC / SD cards are 3.3V, so if your AVR runs at 5V, you will have to convert the outgoing signals to 3.3V & supply 3.3V. I done this with a simple voltage divider (1k series & 2.2k pararel). The avr will read the 3.3V outgoing signal OK @ 5V.
From memory the test routine takes up a lot of flash on the m128, so it may not fit in a m32.
The brand should not be important, but??
Phil |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Sun Feb 20, 2005 9:07 am Post subject: |
|
|
Hi,
AVR-DOS works with all AVR which have at least 2 KB SRAM. If you use the minimal Configuration with 1 file handle and FAT and Directory handling in one buffer, you need appr. 1200 Bytes of SRAM. The next step in SRAM size is 2KB, which give you appr. 500 - 600 Bytes for your application, depending of the sizes of the Stacks: Frame, Softstack and HW-Stack.
You can use driver for MMC/SD card from http://members.aon.at/voegel to work with MMC-Card. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
alturasu
Joined: 16 Oct 2004 Posts: 8 Location: Ankara / TURKEY
|
Posted: Sun Feb 20, 2005 3:28 pm Post subject: MMC |
|
|
Hi
I tried to compile this sample code for m32 but compiler says "OUT OF RAM SPACE"
when i compiled this code for mega128 everythings ok and rom size nearly %25 of mega128 = 32 KB
i think i must use mega128 or mega103 mcu for more code space
Thanks Josef Franz Vögel
regfile = "M32def.dat"
$crystal = 16000000
' Adjust HW Stack, Soft-Stack and Frame size to 128 minimum each!!!
'HW = 128
'SW = 128
'FRAME SIZE = 128
Open "Com1:" As Binary As #1 ' use #1 for fs_interpreter
Config Clock = Soft
Enable Interrupts
Config Date = Mdy , Separator = .
Dim Btemp1 As Byte
'Print #1 , "Wait for Drive"
' Include here you driver for Compactflash/HardDisk or other
$Include "Config_MMC.bas"
$Include "Config_AVR-DOS.BAS"
$Include "FS_Interpreter.bas"
'$Include "Config_CompactFlash_M128.bas"
'$Include "Config_HardDisk_M128.bas"
If Gbdriveerror = 0 Then
' Include AVR-DOS Configuration and library
Print #1 , "Init File System ... ";
Btemp1 = Initfilesystem(1) ' Partition 1
' use 0 for drive without Master boot record
If Btemp1 <> 0 Then
Print #1 , "Error: " ; Btemp1 ; " at Init file system"
Else
Print #1 , " OK"
Print #1 , "Filesystem: " ; Gbfilesystem
Print #1 , "FAT Start Sector: " ; Glfatfirstsector
Print #1 , "Root Start Sector: " ; Glrootfirstsector
Print #1 , "Data First Sector: " ; Gldatafirstsector
Print #1 , "Max. Cluster Nummber: " ; Gwmaxclusternumber
Print #1 , "Sectors per Cluster: " ; Gbsectorspercluster
Print #1 , "Root Entries: " ; Gwrootentries
Print #1 , "Sectors per FAT: " ; Gwsectorsperfat
Print #1 , "Number of FATs: " ; Gbnumberoffats
End If
Else
Print #1 , "Error during Drive Init: " ; Gbdriveerror
End If
' If you want to test with File-System Interpreter uncomment next line |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Mon Feb 21, 2005 8:47 am Post subject: |
|
|
Hi,
if you want to test AVR-DOS with my Test program, you have to use a Mega128 or Mega103. This test-program gives you the possibilty to test nearly all functions of AVR-DOS in an interactiv way over an RS232 connection to a PC with a terminal program. There is a command interpreter inplemented in the test program.
If you write an application with a minimal configuration of AVR-DOS, you can use it on a chip with 2KB SRAM. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
moreau
Joined: 27 Jan 2005 Posts: 46
|
Posted: Mon Feb 21, 2005 3:50 pm Post subject: Test of proposed code |
|
|
$regfile "m128def.dat"
This program will crash the compiler !
OOPS ? |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Tue Feb 22, 2005 10:55 am Post subject: |
|
|
Hi moreau,
This is a forum for AVR-DOS, so please post compiler problems in the BASCOM-AVR forum.
I tried your single line program (if I understand your post right)
$regfile "M128def.dat"
with Version 1.11.7.7 and no crash happened. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
moreau
Joined: 27 Jan 2005 Posts: 46
|
Posted: Tue Mar 01, 2005 1:18 pm Post subject: mmc |
|
|
This line will replace regfile "m32def.dat" for test in the program listed bellow in AVR-DOS program... So this message is in right place !
Is FS_interpreter needed for using mmc card ? |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Tue Mar 01, 2005 2:26 pm Post subject: |
|
|
Hi,
No, you don't need FS_Interpreter to use AVR-DOS (File-System Functions).
FS_Interpreter is a tool which gives you the possibility to test the card and nearly all AVR-DOS functions, without writing any line of code (except the adaption to your hardware-settings like Crystal, Baud rate, Ports ...)
For example, you can quickly test the Card with the sector read and sector write commands, read and write files and so on. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
|