CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

MMC on pic18f4550 problems, Dataout always high?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dex2k



Joined: 26 May 2006
Posts: 6

View user's profile Send private message

MMC on pic18f4550 problems, Dataout always high?
PostPosted: Fri May 26, 2006 2:55 pm     Reply with quote

i have a project with a pic18f4550 and an mmc card but im having problems with getting it to work.
i have tried serveral different codeexamples and they all give med the same answer(spi not responding, card not ready).

one of the codes is this one: http://www.ccsinfo.com/forum/viewtopic.php?t=24909&highlight=mmc

i can see all the signals from the pic on the socket of the mmc card, cs, clk, datain are as they should be, but on my dualvoltage card the dataout is always high and on my old 3.3 volt card the dataout is always low.

got any pointers for me?

i have wired it up like this http://beerheaven.dk/pic18f4550.jpg

the pic is working with all my other code, printing on the serial port and such so it is running and with the right clock.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri May 26, 2006 6:07 pm     Reply with quote

I don't get it, why are there so many people trying to run a PIC at 5V using a clumsy interface to 3.3V peripherals and are surprised it isn't working.
Why don't you all use a PIC18LF4550 and run it at 3,3V so that the interface becomes much easier?

Most likely your current setup fails because of your bad designed 'power supply'. According to the datasheets the 1N4004 has a forward voltage of 1,1Volt so 4 of these diodes in series leaves only 0,6V instead of the required 3,3V. When you are meassuring 3,3V in your setup this is coincidence because the voltage depends on forward current. When the MMC starts operating the current rises, the voltage drops, the MMC resets and your circuit just does not work as expected.

Sorry, but there are just too many errors in your schematic (no pull-up resistors, no decoupling capacitors, wrong voltage levels). I suggest you use Google to have a look at some other schematics and upgrade your circuit. After that I'm happy to help you debug again.
Guest








PostPosted: Sat May 27, 2006 5:39 am     Reply with quote

i cant use the LF model because i have other components that has to run on 5 volts.
i have decouplings connected, just forgot to draw them on this simplified circuit.

what pullups are you talking about?
on the datain/dataout?

youre right about the power suply for the 3,3 volts, but i have tried some other methods, like using a 7817 but that was to instable.
how would you construct it?

are there any other errors?
dex2k



Joined: 26 May 2006
Posts: 6

View user's profile Send private message

PostPosted: Sat May 27, 2006 5:40 am     Reply with quote

gah, forgot to log in :/
dex2k



Joined: 26 May 2006
Posts: 6

View user's profile Send private message

PostPosted: Sat May 27, 2006 6:24 am     Reply with quote

as far as i can see on circuits like this:
http://www.captain.at/electronics/pic-mmc/mmc.png
the only difference is the power suply for the card.

and the same on this site.
http://www.cc5x.de/MMC/

this site also states the same:
http://www.tobik.de/fliegen/schaltung.pdf

do you have any schematic for me to see?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat May 27, 2006 6:06 pm     Reply with quote

I've seen these circuits several times here on the CCS forum and it seems like the idea is working for hobby projects. For a professional project however I would make some changes:
- Add a proper level shifter. This will enhance the edges of clock and data pulses at higher speeds. Also the voltage level from MMC to PIC is now out of spec for the Schmitt Trigger input and a level shifter will solve that.
- According to the MMC specs you should place a 100nF capacitor as close as possible to the MMC card.
- According to the MMC specs. you need pull-up resistors at the data lines. This because the MMC doesn't start in spi-mode and has open collector outputs until you give the command to switch to spi-mode.
- The pull down-resitor on the CS line now activates the MMC card at each PIC reset

A more detailed discussion of the above mentioned items can be found in http://www.ccsinfo.com/forum/viewtopic.php?t=23183
dex2k



Joined: 26 May 2006
Posts: 6

View user's profile Send private message

PostPosted: Sun May 28, 2006 12:54 pm     Reply with quote

partial success!
i modified the circuit for running the mmc card on 3 volts on an external psu.
and then i followed the drawing on this page http://www.cc5x.de/MMC/ with a pic16f877, and used the code on this page
http://www.ccsinfo.com/forum/viewtopic.php?t=23183&postdays=0&postorder=asc&start=15

then i looked in the datasheet for the pic18f452 and reconfigured the sspcon, sspstat, sspbuf, and portc addresses and made the code work on that one.

the sfr addresses should be the same for the pic18f452 and pic18f4550, the only thing to change should be the tris because the sdi/sdi/sck pins are on different ports on the two pics.

but i cant make it work on the pic18f4550.
what have i forgot? it works on the other pics i have tried, all i get is read error.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
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


Powered by phpBB © 2001, 2005 phpBB Group