EmbeddedRelated.com
Forums

CompactFlash and Microchip Dspic ready problem

Started by Unknown May 10, 2006
Hi!
I hope somebody can help me with this problem or at least give me som
suggestion how to solve it.
I have a DSPIC CPU conected to at CF to store Data of course. To save
power the CF power is turned off where ever it is possible.

Power on sequense is as follows.
CF_WE=1
CF_OE=1
TRISD=TRISD_CF_ON
TRISG=TRISG_CF_ON
CF_ON=0
nop()
nop()
CF_CS1=1

Next i wait for
CF_READY signal to go high, but in 1 of 100 this doesnt happen. I
remains low and i must reset the whole system to get i working again.
I have also noticed that the longer i wait between the turnon writes
the more frequent the hang is.


Doest anyone have a clue what could be wrong.

Doesn the flash enter som kind of sleepmode by itself afer a certain
time?

mupptupp@hotmail.com wrote:
> > Doesn the flash enter som kind of sleepmode by itself afer a certain > time?
What flash? -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson More details at: <http://cfaj.freeshell.org/google/> Also see <http://www.safalra.com/special/googlegroupsreply/>
mupptupp@hotmail.com wrote:
> Hi! > I hope somebody can help me with this problem or at least give me som > suggestion how to solve it. > I have a DSPIC CPU conected to at CF to store Data of course. To save > power the CF power is turned off where ever it is possible. > > Power on sequense is as follows. > CF_WE=1 > CF_OE=1 > TRISD=TRISD_CF_ON > TRISG=TRISG_CF_ON > CF_ON=0 > nop() > nop() > CF_CS1=1 > > Next i wait for > CF_READY signal to go high, but in 1 of 100 this doesnt happen. I > remains low and i must reset the whole system to get i working again. > I have also noticed that the longer i wait between the turnon writes > the more frequent the hang is. > > > Doest anyone have a clue what could be wrong. >
It isn't at all clear from your code snippet what state you are putting the CF card in. For example does CF_ON=0 turn the power on. Can you give an English description of what you are doing in your code. Also, how long do you wait after applying the power before addressing the card? Andrew
<mupptupp@hotmail.com> wrote in message
news:1147246011.163388.33420@e56g2000cwe.googlegroups.com...
> Hi! > I hope somebody can help me with this problem or at least give me som
Hi there OP, I have some experience in implementing a CF card on a PIC. I'll try to share what little I know.. *Implement RS232 output so you can diagnose exactly what's happening and when *Implement timeout and recovery code to bring the card back up, physically bring high and drop the reset on the thing. *Don't follow the CF spec's implicitly, I tested my code with about 10 different cards and a few didn't behave as per the CF spec, eg. waiting for a high that never came *Try different cards, not all CF cards are alike... *Write test IO routines to run all day to check your methods Failing all of those 'simple' pointers, the other option would be to grab a logic analyser. These runtime things are a total bloody nightmare I must admit. But in answer to your question if I know what's wrong: No. Just that I did alot of my coding by trial and error leaving the IO testing over and over throughout the night on it's own.
Thanx for all your replyes. I did get it to work at least i think by
once a minut give the flash and power it on and wait for its ready
signal. If it doesnt come in a certain time  I hardreboot it and try
again. Have tested it over night and it seams to work at least, hope it
will do the same at our customer, thiz weekend =)