Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: FatFs, AT91 MCI and SD power consumption
PostPosted: Fri Mar 30, 2012 11:39 pm 
Offline

Joined: Fri Dec 23, 2011 2:38 pm
Posts: 10
Hi,

I'm using an SD card with MCI/SDIO interface with FatFs.
Everything works fine, I can read files, write files and so on.
Most of this work has been done by Chan (FatFs) and Atmel, so thanks to you guys! :)

There's just one problem:
I want to write to a file every now and then (f_open, then successive f_write's), but inbetween writes the SD card (actually microSDHC) should sleep automatically to cut power consumption.
But it doesn't, because after one f_write it stays in "data state" (last disk action of f_write is a disk_read), for auto sleep it has to be in "tran state".
I can get it into "tran state" with CMD12, but here comes the problem: I don't know how to get it back into "data state". If I just continue with f_write after CMD12, I get a disk error.

So how can I get f_write to work again from "tran state" / sleep?

Pleeeease help!

Thanks,
IBE


Top
 Profile  
 
 Post subject: Re: FatFs, AT91 MCI and SD power consumption
PostPosted: Sat Mar 31, 2012 11:32 am 
Offline

Joined: Fri Mar 09, 2012 1:34 pm
Posts: 68
Hi!
The simplest, brute force solution is to reinitialize the card from scratch. That is what I did when wanted a quick solution.

_________________
Best regards
Przemyslaw Baranski


Top
 Profile  
 
 Post subject: Re: FatFs, AT91 MCI and SD power consumption
PostPosted: Mon Apr 02, 2012 10:23 am 
Offline

Joined: Fri Dec 23, 2011 2:38 pm
Posts: 10
Thanks, I found the solution. :)

In the Atmel example (which I used for a great part), the function MovetoTranState (or so) sends the stop command (CMD12) to stop continuous transfers and sets the card to "tran" state, but it doesn't reset the Sd-drivers state (pSd->state) variable back to "ready" from read or write. So I just needed to update this function and call it whenever I think the SD should enter auto-sleep. Waking up is done with the next command automatically.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to: