Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Questions about MMC reader design

Status
Not open for further replies.

SPELTER

Junior Member level 2
Joined
Jun 17, 2006
Messages
24
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,507
Hi,
I am building a mmc card reader using the code and circuit provided at http://elm-chan.org/fsw/ff/00index_e.html in the samples section(avr)

I am using a ATmega128L and 3.38 V as power supply for both the mmc card and the atmega128l.
My doubt is that in the circuit given on the site they have used a switching regulator(as far as i can figure it out) to provide the power to mmc,so can i completely eliminate it since i am using 3.38 v for both the card n uC?

Secondly a mmc has 7 pins and the sd card has 9 pins but in the circuit 11 connections are given for the card.What are they for and can the remaining four connections be neglected(as we are using the mmc card)

lastly as we are connecting our board to pc terminal using brays terminal random characters with a regular pattern are displayed as soon as we connect the board.So what could be the possible reason for that

I am attaching the schematic i am using which is same as the one given at the site except that i have used an additional component i.e. max3232 for level conversion
 

atmega128 + sysclk + 115200

You can power card and MMC from same 3.3v supply.

Ignore DAT1 and DAT2 connections as they are not needed for MMC or SD in SPI mode.

WP and INS are write protect and card inserted signals, your card socket may not support them. You can leave them unconnected and modify the code or pull the pins to the correct level so the code thinks that a card is always inserted and not write protected, hot swapping will not be supported.

Most importantly you must get your board talking to your PC, none of the above will help unless your comms are working. Random characters are normally caused by incorrect comms settings, try 115200 baud 8N1.
 

    SPELTER

    Points: 2
    Helpful Answer Positive Rating
how to make a mmc card socket

Hi encrypted ,thanks for your reply

Yes i did try 115200 baud 8N1.But no luck:cry:

One more thing can you put light on -In the original schematic that person has used a
switching regulator(as far as i figured it out ) containing a mosfet and inductor,caps but i eliminated it as i thought it was not necessary as the person might have used it for stepping down power supply to provide voltage to the mmc.Does that circuit has any other implication.?
 

    V

    Points: 2
    Helpful Answer Positive Rating
avr connect two mmc to one mmc reader

Q1 is not a switching regulator but just a switch that turns on the card when the code calls power_on().

But again don't worry about this until you have your comms working, when you power up your board you should see 'FatFs module test monitor' on your terminal, if you don't then debug your comms.

Are you using the same clock, 9.216MHz?
 

mmc to rs232

Anyways even if it is a switch i dont think if i dont use it it would matter as i have connected it directly to Vcc
i have removed the power on function from the code.(do i need to make any other changes in the code as i have not connected it)

And no ,i am using a 8mhz crystal and i have changed that frequency in UART.C in"sysclock" and modified the ocr2 register value to 75 in the function io_init().I dont think it needs any other changes -does it?
 

tff elm-chan

No you don't need the switch.

If you're using an 8MHz clock then your baudrate error is too high, this maybe why you're seeing the random characters.

Try changing your baudrate to 38400 in uart.c and see if that helps.

Code:
#define	SYSCLK		8000000
#define	BAUD		  38400

Let me know if it works.
 

atmega128 + mmc

Hi,
changed the` bit rate.
ya one more thing i forgot to connect the resistor at pin RX(pin no2) OF THE MEGA128.After i connected the resistor now random characters are not displayed instead nothing is beig displayed now not even the "fat module test monitor".

is. there any method to check whether the uart module is being connected to the xitoa module (initialised in the starting of main().
 

avr studio mmc project files

Connecting pin 2 should not stop the random characters from being displayed (if they were displayed before connecting pin 2). You should see the start up message even without pin 2 connected.

Compile the original source code with no other changes except the two to set the baud rate in uart.c (as below) and then set your terminal to 38400 8N1. If you don't see the start up message displayed then you have a hardware fault. Check connections from ATmega128 pin 2 and pin 3, check the MAX3232 connections and your serial port connections.

Do you have Proteus?
 

elm-chan.org ata

You misunderstood me,i had connected pin no 2 but forgot to connect the 1.5 k resistor between max3232 and second pin of atmega128.Ya i have checked all the connections and i think max3232 is working all right as i am getting 3.3 v at the rxd and txd p ins of the atmega.

Yes i have just downloaded proteus ,i think it is a simulator can i get some help out of it .

Regarding the code ,when i compiled the code (after making the changes you pointed out ),there were errors in diskio.c.
for example in the diskio.c file there are switch cases to select the memory device.in the disk initialize function it calls the mmc_disk_initialize() but this function is not defined anywhere in the program. have removed many irrevelant files like
ata.c
cfc.c
cfmm.c
diskio.c
main2.c
tff.c
tff.h
After removing these files , I get a code with no errors .
And i was a little unsure about the fuse bit setting , can you can tell which fuse bits to set, are there anything important setting in fuse bits which I have missed.
 

max3232 atmega

Don't remove any files, just make the modification for SYSCLK and BAUD. Rename Makefile_mmc to Makefile and then make clean, make all. Should compile without errors (maybe a few warnings about signedness but ignore these).

Proteus will allow you to simulate the ATmega128, MMC and RS232 terminal running your code.

Have you tried the hex that I sent you?
 

gcc atmega128 mmc

do we have to include those tiny fat files also ?

and we are using avr studio , so just dont know how to use makefile .
and what bout those fuse bits settings ?
 

tff.h avr

There is no need to delete any files. I don't use AVR Studio but I checked it out for you and this is what you need to do to build the project.

Start AVR Studio.
Project -> New Project
Click AVR GCC
Project Name: avr_mmc
Untick 'Create Initial File'
Location: Browse to the location of your files.
Click Finish

Project->Configuration Options
Tick 'Use External Makefile' and browse to the Makefile_mmc

Build->Clean
Build->Rebuild all

Should compile without errors 'Build succeeded with 42 Warnings...' don't worry about the warnings.



For the clock fuses (CKSEL3..0) I think you need to set them all to 1.
 

switching mmc from avr to card reader

Atleast it is displaying "fat fs module test monitor" now
but there seems problem with the reading writing..have to debug it.
Anyways thanks a lot for yor help encrypted.Actually the only problem was that in linking all the files ,when i run the program in avrstudio it did not properly link all the files but using the makefile solved the problem.
 

chan fat xitoa

you can visit some links. May be good!


**broken link removed**
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top