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: SD card initialisation problem
PostPosted: Mon Sep 19, 2011 2:42 pm 
Offline

Joined: Wed May 17, 2006 10:13 am
Posts: 5
Hello everybody,

I have a project that consist of a bootloader and the real application and run on a SAM9M10. Both, the bootloader (boot.bin) and the application are stored on the SD card connected to HSMCI0.

When I power up the board the ROM bootloader loads the bootloader from the SDcard and start the bootloader. The bootloader initialize the external DDR2 RAM and load de application in it. When the checksums are verified it jumps to the program in the DDR2 ram. So far so good, but, when the application want to initialize the SD card an error occur.

At this moment both, the bootloader and the application, use the FATFS file system and drivers from the example project. Because of the successful load of the application it seems no hardware problem. When I disconnect the SD card and connecting it again every thing seems to work fine.

In my application I first check if the SD card is connected MEDSdcard_Detect(&medias[ID_DRV], MCI_ID) after that I call MEDSdcard_Initialize(&medias[ID_DRV], MCI_ID), this function fails. Inside that function SD_Init(sdDrv, (SdDriver *)mciDrv) is called, this is the source of the error.

The ROM bootloader also use the HSMCI for loading the bootloader. After that the functions above seems to work fine. Does anyone have a suggestion how to force the SD card again in such an condition that it is able to initialize again?

Lukas


Top
 Profile  
 
 Post subject: Re: SD card initialisation problem
PostPosted: Fri Oct 28, 2011 1:19 am 
Offline

Joined: Thu May 12, 2011 11:34 pm
Posts: 6
If I understand correctly, you are initializing the SD card twice, once in the bootloader and once in DDR. Do you need to do this? If you still have access to the Media/SDcard objects you can just use them as normal without initialization. If you dont have access to those objects you could copy them to a static memory location when you are copying your application to DDR.

-Ben


Top
 Profile  
 
 Post subject: Re: SD card initialisation problem
PostPosted: Fri Oct 28, 2011 8:21 am 
Offline

Joined: Wed May 17, 2006 10:13 am
Posts: 5
Thank you Ben,

More precise, the SD card is initialized three times. Once by the ROM bootloader, once by my own bootloader and in my application.

I have now some code that seems to work, I added an additional CMD0 (reset) command in the deinitalisation code inside the bootloader. It seems to be a problem for the card to execute a CMD0 command when the media card interface is reset.

Your solutions also shoud work, but I had some problem with that. My bootloader use as little as possible resources (read only, no LFN, single file, …). That’s a bit to limited for my final application. Result is that the structures don’t match.

Regards, Lukas


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 7 guests


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: