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  [ 7 posts ] 
Author Message
 Post subject: SD/MMC in AT91san9261
PostPosted: Tue Oct 11, 2011 1:05 pm 
Offline

Joined: Tue Oct 11, 2011 12:04 pm
Posts: 6
Hi Everyone,
I am trying to make my SD card in my board(with AT91SAM9261). Tested hardware with keil, its working fine, I am working around u-boot-2010.09 version of u-boot. I think the problem is with
initialization of SD card code. when i call mmc_cmd function by following line. its getting hanged
return mmc_cmd(0, 0, NULL, INIT_CMD);

U-Boot> mmc init
Total Arguments = 2 argv[0] = mmc , argv[1] = init
in do_mmc if RAJEEV argv[1] = init
after strcpy argv[1] = init
Passed strcmp if loop
in argc == 2, dev = 1
Trying Bounce
before mmc_legacy_initTrying to Negotiate with MMC Controller verbose = 1
MMC Mode Set to 0x5f
Trying to Reset and Initialize SD CARD
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 0 resp = 0 flags = <NULL>
in mmc_cmd rajeev
in first if
in else if
in do statement
status = 0
MMCI_BIT(CMDRDY) = 1
out of do while
at return
MMC INIT IDLE returns = 0
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 0 resp = 0 flags =


its getting struck here. when i checked SD card code in KIEL INIT_CMD should have the value 0x0700 but when i tested the part of the code i am getting 0x0100.
Can anyone suggest which u-boot version i should use. what would be the problem.
Thanks in ADVANCE
Rajeev.


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Tue Oct 11, 2011 6:42 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Do you have the pins/peripheral set up in AT91BootStrap?
Does the mmcinfo command work?


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Wed Oct 12, 2011 3:59 pm 
Offline

Joined: Tue Oct 11, 2011 12:04 pm
Posts: 6
[quote="CptTitanic"]Do you have the pins/peripheral set up in AT91BootStrap?
Does the mmcinfo command work?[/quote]

No not really, i had gone through bootstrap but i am unable to figure out where to set them,
but i had the registers set in the code include/AT91SAM9261_inc.h. can u suggest me how to make changes
to Bootstrap and in which version i am using version V1.11
*****************************************************************************************************************
As u asked mmc info doesn't work its as followes
U-Boot> mmc info
Total Arguments = 2 argv[0] = mmc , argv[1] = info
in do_mmc if RAJEEV argv[1] = info
after strcpy argv[1] = info
Bounce 4
mmc - MMC sub-system

Usage:
mmc init [dev] - init MMC sub system
mmc device [dev] - show or set current device
U-Boot> mmc_info
Unknown command 'mmc_info' - try 'help'
*****************************************************************************************************************

THIS IS LATEST ONE
Start AT91Bootstrap...


U-Boot 2010.09 (Oct 12 2011 - 15:46:22)

DRAM: 64 MiB
NAND: 256 MiB
MMC:
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Net: dm9000
ERROR: resetting DM9000 -> not responding
dm9000 not found at 0x30000000 id: 0x2b2a2928
Hit any key to stop autoboot: 0
U-Boot> mmc init
Total Arguments = 2 argv[0] = mmc , argv[1] = init
in do_mmc if RAJEEV argv[1] = init
after strcpy argv[1] = init
Passed strcmp if loop
in argc == 2, dev = 1
Trying Bounce
before mmc_legacy_init
Trying to Negotiate with MMC Controller verbose = 1
MMC Mode Set to 0x5f
entering into sd_init_card
Trying to Reset and Initialize SD CARD
value of j=0
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 0 resp = 0
in mmc_cmd rajeev
mmc: CMD0 0x0 (flags 0x0)
in first if
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
MMC INIT IDLE returns = 0
Trying to Probe MMC Command 1 Time
i am in mmc_acmd
value of j=1
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 55 resp = 602401632
in mmc_cmd rajeev
mmc: CMD55 0x0 (flags 0x1040)
in first if
in second if
value of flags = 0X1040
value of MMCI_BFEXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
at return=0
value of j=2
ANALOGICS TECH INDIA LTD
Total Arguments = 1048576 cmd = 41 resp = 602401648
in mmc_cmd rajeev
mmc: CMD41 0x100000 (flags 0x41)
in first if
in second if
value of flags = 0X40
value of MMCI_BFEXT = 1
1value of mmci_writel= 1048576
2value of mmci_writel= 0
in do statement
status = 311525
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5b0000
at return
at return11111111111
mmc_acmd return code = 0 response buf[0] = 16744448 Mask = 0
Trying to Probe MMC Command 2 Time
i am in mmc_acmd
value of j=3
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 55 resp = 602401632
in mmc_cmd rajeev
mmc: CMD55 0x0 (flags 0x1040)
inXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
at return=0
value of j=4
ANALOGICS TECH INDIA LTD
Total Arguments = 1048576 cmd = 41 resp = 602401648
in mmc_cmd rajeev
mmc: CMD41 0x100000 (flags 0x41)
in first if
in second if
value of flags = 0X40
value of MMCI_BFEXT = 1
1value of mmci_writel= 1048576
2value of mmci_writel= 0
in do statement
status = 311525
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5b0000
at return
at return11111111111
mmc_acmd return code = 0 response buf[0] = -2130739200 Mask = -2147483648
value of j=5
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 2 resp = 602401648
in mmc_cmd rajeev
mmc: CMD2 0x0 (flags 0x80)
in first if
in else if
value of MMCI_BFEXT = 2
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
Manufacturer ID: 03
OEM/Application ID: 5344
Product name: SU02G
Product Revision: 8.0
Product Serial Number: 266609551
Manufacturing Date: 11/07
value of j=6
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 3 resp = 602401648
in mmc_cmd rajeev
mmc: CMD3 0x0 (flags 0x1040)
in first if
in second if
value of flags = 0X1040
value of MMCI_BFEXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
SD Card detected (RCA 58916)
SD CARD INIT returns = 0
value of j=7
ANALOGICS TECH INDIA LTD
Total Arguments = 3861118976 cmd = 9 resp = 602401596
in mmc_cmd rajeev
mmc: CMD9 0xe6240000 (flags 0x1080)
in first if
in else if
value of MMCI_BFEXT = 2
1value of mmci_writel= -433848320
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
raw CSD data: 00260032 5f5a83ae fefbcfff 928040df
Read block length: 1024
(Supports partial reads)
Card capacity: 1884 Mbytes
mmc: Using 131072 cycles data timeout (DTOR=0x62)
mmc: blocksize reduced to 1, number of blocks: 1
Card does not support 512 byte reads, aborting.
NO MMC Card found
No MMC card found


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Wed Oct 12, 2011 10:41 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
"mmcinfo" doesn't have a space.

What would be more helpful than screen dumps would be patches made to the source, options used when compiling, and the code enabling the MMC/MCI interface, pins, etc. Doesn't 2010.09 treat the MMC card slot as a dataflash chip interface on the stock AT91SAM9261-EK.

I'm presuming you're targeting a more custom board, what kind of pin interface have you set up in Keil? Are you running that code at 198-200 MHz, is the uBoot code running at the same?

On the 9260/9G20 side I've used the sdmmc_mci code pulled from the at91lib code to access MMC/SD card from Keil. It should be possible to trace into the uBoot from Keil with a SAM-ICE debugger.


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Thu Oct 13, 2011 9:11 am 
Offline

Joined: Tue Oct 11, 2011 12:04 pm
Posts: 6
[quote="CptTitanic"]"mmcinfo" doesn't have a space.

What would be more helpful than screen dumps would be patches made to the source, options used when compiling, and the code enabling the MMC/MCI interface, pins, etc. Doesn't 2010.09 treat the MMC card slot as a dataflash chip interface on the stock AT91SAM9261-EK.

I'm presuming you're targeting a more custom board, what kind of pin interface have you set up in Keil? Are you running that code at 198-200 MHz, is the uBoot code running at the same?

On the 9260/9G20 side I've used the sdmmc_mci code pulled from the at91lib code to access MMC/SD card from Keil. It should be possible to trace into the uBoot from Keil with a SAM-ICE debugger.[/quote]


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Thu Oct 13, 2011 3:44 pm 
Offline

Joined: Tue Oct 11, 2011 12:04 pm
Posts: 6
[quote="rajeevbattu"][quote="CptTitanic"]"mmcinfo" doesn't have a space.

What would be more helpful than screen dumps would be patches made to the source, options used when compiling, and the code enabling the MMC/MCI interface, pins, etc. Doesn't 2010.09 treat the MMC card slot as a dataflash chip interface on the stock AT91SAM9261-EK.

I'm presuming you're targeting a more custom board, what kind of pin interface have you set up in Keil? Are you running that code at 198-200 MHz, is the uBoot code running at the same?

On the 9260/9G20 side I've used the sdmmc_mci code pulled from the at91lib code to access MMC/SD card from Keil. It should be possible to trace into the uBoot from Keil with a SAM-ICE debugger.[/quote][/quote]


Top
 Profile  
 
 Post subject: Re: SD/MMC in AT91san9261
PostPosted: Fri Oct 21, 2011 2:11 pm 
Offline

Joined: Tue Oct 11, 2011 12:04 pm
Posts: 6
This is what i had god when i compiled uboot. Is this sufficient for kernel to get booting correctly. Is there any more to be changed in u-boot. i am calling do_mmc by defining CONFIG_GENERIC_MMC. There is other function do_mmcops and do_mmcinfo. which one i should call.


U-Boot 2010.09 (Oct 19 2011 - 14:45:05)

DRAM: 64 MiB
NAND: 256 MiB
MMC:
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial
Net: dm9000
ERROR: resetting DM9000 -> not responding
dm9000 not found at 0x30000000 id: 0x2b2a2901
Hit any key to stop autoboot: 0
U-Boot> mmc init
Total Arguments = 2 argv[0] = mmc , argv[1] = init
in do_mmc if RAJEEV argv[1] = init
after strcpy argv[1] = init
Passed strcmp if loop
current device dev = 1in argc == 2, dev = 1
Trying Bounce
before mmc_legacy_init
Trying to Negotiate with MMC Controller verbose = 1
in mci_set_mode function
mmc: bus_hz is 99328000, setting clock 15000000 Hz, block size 512
MMC Mode Set to 0x5f
entering into sd_init_card for 1st time
entering into mmc_idle_cards for first time
Trying to Reset and Initialize SD CARD

*********************************
calling mmc_cmd for 1st time
value of j=0
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 0 resp = 0
in mmc_cmd rajeev
mmc: CMD0 0x0 (flags 0x0)
in first if
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
MMC INIT IDLE returns = 0

*********************************
calling mmc_cmd for 2nd time
value of j=1
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 0 resp = 0
in mmc_cmd rajeev
mmc: CMD0 0x0 (flags 0x100)
in first if
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return

*********************************
Trying to Probe MMC Command 1 Time
calling mmc_acmd for 1st time
calling mmc_cmd for 3rd time
value of j=2
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 55 resp = 602401632
in mmc_cmd rajeev
mmc: CMD55 0x0 (flags 0x1040)
in first if
in second if
value of flags = 0X1040
value of MMCI_BFEXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
at return=0


calling mmc_cmd for 4th time
value of j=3
ANALOGICS TECH INDIA LTD
Total Arguments = 1048576 cmd = 41 resp = 602401648
in mmc_cmd rajeev
mmc: CMD41 0x100000 (flags 0x41)
in first if
in second if
value of flags = 0X40
value of MMCI_BFEXT = 1
1value of mmci_writel= 1048576
2value of mmci_writel= 0
in do statement
status = 311525
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5b0000
at return

*********************************
mmc_acmd return code = 0 response buf[0] = 16744448 Mask = 0
Trying to Probe MMC Command 2 Time
calling mmc_acmd for 1st time
calling mmc_cmd for 3rd time
value of j=4
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 55 resp = 602401632
in mmc_cmd rajeev
mmc: CMD55 0x0 (flags 0x1040)
in first if
in second if
value of flags = 0X1040
value of MMCI_BFEXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
at return=0

calling mmc_cmd for 4th time
value of j=5
ANALOGICS TECH INDIA LTD
Total Arguments = 1048576 cmd = 41 resp = 602401648
in mmc_cmd rajeev
mmc: CMD41 0x100000 (flags 0x41)
in first if
in second if
value of flags = 0X40
value of MMCI_BFEXT = 1
1value of mmci_writel= 1048576
2value of mmci_writel= 0
in do statement
status = 311525
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5b0000
at return

*********************************
mmc_acmd return code = 0 response buf[0] = -2130739200 Mask = -2147483648

value of ret in sd_init_card == 0
calling mmc_cmd for 5th time
value of j=6
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 2 resp = 602401648
in mmc_cmd rajeev
mmc: CMD2 0x0 (flags 0x80)
in first if
in else if
value of MMCI_BFEXT = 2
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return

*********************************
ANALOGICS TECH INDIA SD/MMC CARD
Manufacturer ID: 03
OEM/Application ID: 5344
Product name: SU02G
Product Revision: 8.0
Product Serial Number: 266609551
Manufacturing Date: 11/07

calling mmc_cmd for 6th time to get RCA RESPONCE
value of j=7
ANALOGICS TECH INDIA LTD
Total Arguments = 0 cmd = 3 resp = 602401648
in mmc_cmd rajeev
mmc: CMD3 0x0 (flags 0x1040)
in first if
in second if
value of flags = 0X1040
value of MMCI_BFEXT = 1
1value of mmci_writel= 0
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return
SD Card detected (RCA 58916)
SD CARD INIT returns = 0
entering into mmc_cmd for 7st time to get CSD
value of j=8
ANALOGICS TECH INDIA LTD
Total Arguments = 3861118976 cmd = 9 resp = 602401596
in mmc_cmd rajeev
mmc: CMD9 0xe6240000 (flags 0x1080)
in first if
in else if
value of MMCI_BFEXT = 2
1value of mmci_writel= -433848320
2value of mmci_writel= 0
in do statement
status = 49381
MMCI_BIT(CMDRDY) = 1
out of do while Error Flags = 5f0000
at return

*********************************
AFTER CSD DATA ret = 0
raw CSD data: 00260032 5f5a83ae fefbcfff 928040df
Read block length: 1024
(Supports partial reads)
Card capacity: 1884 Mbytes
coming out from mci_set_data_timeout next
mmc: Using 131072 cycles data timeout (DTOR=0x62)
Man 035344 Snr 0fe4238f
in mci_set_mode function
mmc: bus_hz is 99328000, setting clock 5000000 Hz, block size 512
Probing Current Device = 1
mmc1 is available
Last Bounce
uboot>

Regards
Rajeev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 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: