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  [ 8 posts ] 
Author Message
 Post subject: SD Card on AT91SAM9261EK
PostPosted: Tue Oct 16, 2007 10:52 am 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi,

Need advise on how can I access the SD card (in SD slot) on AT91SAM9261EK board.

I am using 2.6.21 kernel with "AT91 SD/MMC card interface support" and "MMC block device driver" enabled in kernel configuration.

I did not observe any SD/MMC related messages on the kernel startup (or SD card inserted) console output.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 11:58 am 
Offline

Joined: Thu Aug 09, 2007 10:48 am
Posts: 106
Location: Artec Design LLC, Tallinn, Estonia
Is your SPI disabled?
Currently, SPI and MCI are exclusive as one SPI channel shares pins with MCI. Actually, one SPI channel could still be used, but this needs to be patched in manually.
See line 416 in arch/arm/mach-at91/board-sam9261ek.c
http://git.kernel.org/?p=linux/kernel/g ... ec8c7accd1


Top
 Profile  
 
 Post subject: SD Card on AT1SAM9261EK
PostPosted: Thu Oct 18, 2007 12:12 pm 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi AntiSullin,

From the code, it appears that the SD/MMC card cannot be used when SPI is enabled.

Similarly, the touchscreen and other devices on SPI0 will not be available if SD/MMC card is used, am I correct ?

Thanks and Best Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 12:37 pm 
Offline

Joined: Thu Aug 09, 2007 10:48 am
Posts: 106
Location: Artec Design LLC, Tallinn, Estonia
As I said, this can be overrided if you know what you are doing. The reason for the restriction is that SPI channel 0 and MCI use same pins. If you are using only SPI channel 1, then remove the restriction.
The EK has most of the spi devices on on SPI0, so you have to rewire them if you want to use them and the MCI at the same time.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 1:28 pm 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi,

Based on the EK board, SD/MMC card is using NPCS3 on SPI0, DataFlash on NPCS0 and Touchscreen on NPCS2.

In terms of CS lines, they are not conflicting. However, if AT91 MCI interface is used, DataFlash and Touchscreen needs to be re-wired, am I correct ?

Questions:
1) Assume only AT91 MCI is used and the rest is not enabled, what would I expect to see on the console output during kernel startup (if the AT91 MCI is build into the kernel -- not as a module) ?

2) Another option for all 3 devices to work at the same time is to use mmc_spi.c (access SD/MMC as SPI interface), am I correct ?

Are there any known problems with the SD/MMC using either AT91_MCI or MMC_SPI with 2.6.23 kernel code ?

Thanks and Best Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 11:12 am 
Offline

Joined: Thu Aug 09, 2007 10:48 am
Posts: 106
Location: Artec Design LLC, Tallinn, Estonia
The problem is that the SPI controller and MMC controller are two different blocks. The I/O pins can be muxed to one or another. As they are not synchronized, this can lead to having one device activated on both of them.
Also, you probably want to run MCI in 4-wire mode if you are using SD-cards. SAM9261 is capable of that, but the driver needs to be patched (/drivers/mmc/host/at91_mci.c , look near lines 371 and 845 - the 9261is somehow left out). In 4-wire mode I'm getting SD read speeds around 4MB/sec and and write speeds about 1,8MB/sec on sam9261.

I haven't tried using the SD in SPI mode.

The dataflash can not be connected to SPI1, bootable is only SPI0. But you can boot from dataflash and then stop using it (still, you must be sure that your dataflash CS is left inactive!). ie, have your root filesystem in nand. The bootloader and kernel can be in dataflash as they are not needed after kernel is loaded by u-boot. Or just have a single NOR chip as we do.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 12:02 pm 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi AntiSullin,

Really appreciate the info provided. I have another board with NOR Flash storing the Uboot and Kernel.

For the at91_mmc.c file, I have noted that at91sam9261ek is being left out. I actually tried including at91sam9261ek into the code.

However, I am NOT able to get the SD card to work in either 1-wire or 4-wire mode with SPI totally disabled and using only MCI mode (I have posted in another message with the debug console output in the forum earlier) .

Hope you can help to advise on how can I debug the issue.

Thanks in advance.


Top
 Profile  
 
 Post subject: Problem considered solved
PostPosted: Sun Oct 21, 2007 2:04 pm 
Offline

Joined: Wed Jul 04, 2007 8:01 am
Posts: 37
Hi,

Problem on AT91_MMC modules is considered solved.

Replacing MMC_BUSMODE_OPENDRAIN with MMC_BUSMODE_PUSHPULL solved the problem.


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 4 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: