public inbox for ecos-bugs@sourceware.org help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-bugs@ecos.sourceware.org Subject: [Bug 1001764] Enhancement of MMC/SD over SPI driver Date: Thu, 18 Apr 2013 17:33:00 -0000 [thread overview] Message-ID: <bug-1001764-13-Q5L90RMXKu@http.bugs.ecos.sourceware.org/> (raw) In-Reply-To: <bug-1001764-13@http.bugs.ecos.sourceware.org/> Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001764 --- Comment #13 from Mike Jones <mjones@linear.com> --- I had new troubles with an SD Card so I spent some debug time. My hardware is a standard K60 Tower with 2GB SD Card from SanDisk. The SPI is rewired so the lines are connected properly. The card cannot be recognized, on hardware that has worked before, with a card that has worked before using this patch. The differences now are up to date code base with FX patches, I2C, etc. Everything seems to work but this. So I put my Beagle on the bus so I can see what is going on. So the details are as follows. - First, the clocking to clear the bus occurs. - Second, there is an init command 40 00 00 00 95 which responds with an 01 - Third, there is a command to do a voltage check: 48 00 00 01 AA 87 This means CMD8, voltage 01 (2.7V - 3.3V), test pattern AA The card returns: 01 00 00 01 AA FF This means it echo's back the proper values. This is an R7 response. In the spec https://www.sdcard.org/downloads/pls/simplified_specs/part1_410.pdf On page 82 of the spec it describes this R7 response, and the 01 should be at bit 16, pattern at bits 8:15 followed by crc and end bit. Based on table 4-39 this seems malformed. I don't see the CMD8 at bits 40:45. What is there is a 01. CRC also seems wrong unless FF is the real calculated value. I have not tried to compute it. The 01 and AA seem to be in the correct location. Now in the code in mmc_spi.c: cyg_spi_transaction_transfer(dev, cyg_mmc_spi_polled, R7_RESPONSE_LENGTH, mmc_spi_ff_data, response, 0); DEBUG2("%s(): R7: %02x %02x %02x %02x %02x.\n", __FUNCTION__, response[0], response[1], response[2], response[3], response[4]); if (0 == (MMC_SPI_VHS & response[2])) { DEBUG1("%s(): card doesn't accept voltage %02x\n", __FUNCTION__, MMC_SPI_VHS); mmc_spi_end_command(disk); return -ENOTSUP; } It turns out the 01 is in response[3] and AA is in response[4]. If the transfer with R7_RESPONSE_LENGTH does not include CRC, this positioning makes sense. However, response[0] is 0. So it does not match the Beagle. The code then returns an error because it is verifying the voltage with response[2] rather than response[3]. So I then thought, well, let's change to response[3] and see if it works. Now the code proceeds and sends command: 77 00 00 00 00 00 This is 0x37 or CMD55, which is used because the code thinks this is a version 2 card. I have a SD card, so I think it is version 1, but I am new at this. The code says it is V2 because it understands CMD8. So I guess it is V2. Anyway, the code thinks the CMD55 App Command is ok and proceeds and sends 69 40 00 00 00 FF This is a 0x29 or CMD41, which is an initialization command. 40 means SDHC or SDXC supported. However, this is an SD card. So perhaps the CMD8 should have failed so that this would be a V1 card. Except, the CMD8 check for V1 occurs before the voltage check and the code believes it worked. if (MMC_REPLY_ILLEGAL_COMMAND & reply) { // V1 cards do not understand CMD8 disk->sd_version = 1; disk->sd_capacity = STANDARD_CAPACITY; mmc_spi_end_command(disk); return ENOERR; } This code does not detect an illegal command. And the Beagle produced a reply. Back to things, the code proceeds to: if ( 1 == disk->sd_csd_version) { // There is information available about the file format, e.g. // partitioned vs. simple FAT. With the current version of the // generic disk code this needs to be known statically, via // the mbr field of the disk channel structure. If the card // is inappropriately formatted, reject the mount request. if ((0 != MMC_CSD_REGISTER_FILE_FORMAT_GROUP(&csd)) || (0 != MMC_CSD_REGISTER_FILE_FORMAT(&csd))) { return -ENOTDIR; } } // Accord and we fail the mount request. So I reformat the drive... And the result is the same. Now that I have a setup, perhaps I can take a look my working microSD stuff which is on a custom board and look at a card that works and the failing Samsung card, etc. I also have an SDHC card I can check on this Tower hardware. All for now. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2013-04-18 17:33 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-18 20:24 [Bug 1001764] New: " bugzilla-daemon 2013-03-14 14:24 ` [Bug 1001764] " bugzilla-daemon 2013-03-15 0:47 ` bugzilla-daemon 2013-03-15 7:52 ` bugzilla-daemon 2013-03-15 14:04 ` bugzilla-daemon 2013-03-18 9:52 ` bugzilla-daemon 2013-03-19 13:36 ` bugzilla-daemon 2013-03-20 7:29 ` bugzilla-daemon 2013-03-23 16:00 ` bugzilla-daemon 2013-04-15 22:41 ` bugzilla-daemon 2013-04-16 14:41 ` bugzilla-daemon 2013-04-18 17:33 ` bugzilla-daemon [this message] 2013-04-18 18:35 ` bugzilla-daemon 2013-04-18 19:10 ` bugzilla-daemon 2013-04-18 21:16 ` bugzilla-daemon 2013-04-19 16:17 ` bugzilla-daemon 2013-04-22 15:03 ` bugzilla-daemon 2013-05-01 15:10 ` bugzilla-daemon 2013-05-05 16:09 ` bugzilla-daemon 2013-06-19 11:04 ` bugzilla-daemon 2013-06-30 13:59 ` bugzilla-daemon 2013-07-01 17:36 ` bugzilla-daemon 2013-07-01 20:27 ` bugzilla-daemon 2013-07-02 16:28 ` bugzilla-daemon 2013-02-18 20:24 [Bug 1001764] New: " bugzilla-daemon 2013-03-14 14:25 ` [Bug 1001764] " bugzilla-daemon 2013-03-15 0:47 ` bugzilla-daemon 2013-03-15 7:52 ` bugzilla-daemon 2013-03-15 14:04 ` bugzilla-daemon 2013-03-18 9:52 ` bugzilla-daemon 2013-03-19 13:36 ` bugzilla-daemon 2013-03-20 7:29 ` bugzilla-daemon 2013-03-23 16:00 ` bugzilla-daemon 2013-04-15 22:41 ` bugzilla-daemon 2013-04-16 14:41 ` bugzilla-daemon 2013-04-18 18:35 ` bugzilla-daemon 2013-04-18 19:10 ` bugzilla-daemon 2013-04-22 15:03 ` bugzilla-daemon 2013-05-01 15:10 ` bugzilla-daemon 2013-05-05 16:09 ` bugzilla-daemon 2013-06-19 11:04 ` bugzilla-daemon 2013-06-30 13:59 ` bugzilla-daemon 2013-07-01 17:36 ` bugzilla-daemon 2013-07-01 20:27 ` bugzilla-daemon 2013-07-02 16:28 ` bugzilla-daemon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-1001764-13-Q5L90RMXKu@http.bugs.ecos.sourceware.org/ \ --to=bugzilla-daemon@bugs.ecos.sourceware.org \ --cc=ecos-bugs@ecos.sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).