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 1001397] I2C driver for Kinetis microcontrollers
Date: Wed, 17 Apr 2013 17:43:00 -0000	[thread overview]
Message-ID: <bug-1001397-13-QKISlXO4Ul@http.bugs.ecos.sourceware.org/> (raw)
In-Reply-To: <bug-1001397-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=1001397

--- Comment #52 from Ilija Kocho <ilijak@siva.com.mk> ---
Created attachment 2185
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2185&action=edit
Best fit aggressive clocking (incremantal).

(In reply to comment #51)
> I tested the patches at different frequencies using code like this:
> 
> 
>     cyg_i2c_device device = {                        \
>             .i2c_bus        = &cyg_i2c0_bus,		 \
>             .i2c_address    = 0x0C,               	\
>             .i2c_flags      = 0,                     \
>             .i2c_delay      = i2c_bus_time           \
>         };
> 
> It works at 100/400Khz properly. The there is more error in the frequency
> than some end users will want.  It seems to run about 10% too slow.

The frequency divider calculator is conservative, if exact frequency is not
available, it will pick the previous (lower) frequency. Since there are more
such combinations, in the CDL you can select up to which FIT to look, (takes
more time). It will still be lower or equal, but may be closer. If it is
permissible, here is a (non tested) incremental patch with somewhat aggressive
approach, it will pick the closest frequency even if it overclocks. We can give
user a chance to (dis)allow aggressive clocking by means of CDL.

Please advise.

> 
> In the CDL "SMB register options" is misspelled. register is missing an r.
> 
Thanks, I'll fix.


> I don't have means at the moment to test SMB options. I suggest this is
> tested after releasing this code. When the STM32 I2C is in a similar state
> to this code, I can build hardware that supports built in ALERTB processing
> for both processors and test the SMB support. The current patches seem
> adequate for I2C and work fine with my large application.

I agree, then I would remove SMB CDL from current release since it may be
misleading.

> 
> I would like to test default clock speed, meaning the frequency in the CDL.
> How do I write code that uses the default rather than .i2c_delay. Yes, I am
> being lazy and not digging into the code.

I don't think that there's such option, I guess the idea is that every device
on the bus has it's own clocking requirement. Frankly I don't know what is it
for.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From ecos-bugs-return-10212-listarch-ecos-bugs=sources.redhat.com@sourceware.org Thu Apr 18 17:33:46 2013
Return-Path: <ecos-bugs-return-10212-listarch-ecos-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-ecos-bugs@sources.redhat.com
Received: (qmail 17669 invoked by alias); 18 Apr 2013 17:33:46 -0000
Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <ecos-bugs.sourceware.org>
List-Subscribe: <mailto:ecos-bugs-subscribe@sourceware.org>
List-Post: <mailto:ecos-bugs@sourceware.org>
List-Help: <mailto:ecos-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: ecos-bugs-owner@sourceware.org
Delivered-To: mailing list ecos-bugs@sourceware.org
Received: (qmail 17657 invoked by uid 89); 18 Apr 2013 17:33:46 -0000
X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=ham version=3.3.1
Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197)
    by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Apr 2013 17:33:44 +0000
Received: by mail.ecoscentric.com (Postfix, from userid 48)
	id 5AAD44680007; Thu, 18 Apr 2013 18:33:42 +0100 (BST)
X-Original-To: unassigned@bugs.ecos.sourceware.org
Delivered-To: unassigned@bugs.ecos.sourceware.org
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: unassigned@bugs.ecos.sourceware.org
Subject: [Bug 1001764] Enhancement of MMC/SD over SPI driver
Date: Thu, 18 Apr 2013 17:33:00 -0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: eCos
X-Bugzilla-Component: Disk
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: mjones@linear.com
X-Bugzilla-Status: NEEDINFO
X-Bugzilla-Priority: low
X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-1001764-777-x22C1zUMBn@http.bugs.ecos.sourceware.org/>
In-Reply-To: <bug-1001764-777@http.bugs.ecos.sourceware.org/>
References: <bug-1001764-777@http.bugs.ecos.sourceware.org/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://bugs.ecos.sourceware.org/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013/txt/msg00243.txt.bz2
Content-length: 4327

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id\x1001764

--- 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 the assignee for the bug.


  parent reply	other threads:[~2013-04-17 17:43 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 13:44 [Bug 1001397] New: I2C driver for Kinetic microcontrollers bugzilla-daemon
2011-12-01 15:24 ` [Bug 1001397] " bugzilla-daemon
2011-12-01 15:48 ` bugzilla-daemon
2011-12-01 15:52 ` bugzilla-daemon
2011-12-01 15:58 ` bugzilla-daemon
2011-12-13 15:13 ` bugzilla-daemon
2011-12-23 10:40 ` bugzilla-daemon
2011-12-23 13:28 ` bugzilla-daemon
2011-12-23 14:14 ` bugzilla-daemon
2011-12-23 14:15 ` bugzilla-daemon
2011-12-24  9:22 ` bugzilla-daemon
2011-12-24 11:59 ` bugzilla-daemon
2011-12-26  7:32 ` bugzilla-daemon
2012-01-01 21:29 ` bugzilla-daemon
2012-01-10 15:40 ` bugzilla-daemon
2012-01-11 20:33 ` bugzilla-daemon
2012-01-16 14:31 ` bugzilla-daemon
2012-02-07 20:38 ` bugzilla-daemon
2012-02-08  9:12 ` bugzilla-daemon
2012-02-08  9:55 ` bugzilla-daemon
2012-02-11  0:16 ` bugzilla-daemon
2012-02-11 10:14 ` bugzilla-daemon
2012-02-12 19:11 ` bugzilla-daemon
2012-02-12 19:11 ` bugzilla-daemon
2012-02-23 16:11 ` bugzilla-daemon
2012-03-20 15:17 ` bugzilla-daemon
2012-03-31 17:17 ` bugzilla-daemon
2012-05-04 18:32 ` bugzilla-daemon
2012-12-21 20:46 ` bugzilla-daemon
2012-12-24  9:52 ` bugzilla-daemon
2012-12-24 16:53 ` bugzilla-daemon
2012-12-24 16:54 ` bugzilla-daemon
2012-12-24 16:56 ` bugzilla-daemon
2012-12-24 16:56 ` bugzilla-daemon
2012-12-24 17:14 ` bugzilla-daemon
2012-12-24 17:38 ` bugzilla-daemon
2012-12-25 21:32 ` bugzilla-daemon
2012-12-25 21:33 ` bugzilla-daemon
2012-12-25 23:38 ` bugzilla-daemon
2012-12-26 15:06 ` bugzilla-daemon
2012-12-29 14:23 ` bugzilla-daemon
2013-01-02  3:48 ` bugzilla-daemon
2013-01-02  7:07 ` bugzilla-daemon
2013-01-03  9:09 ` bugzilla-daemon
2013-01-03  9:12 ` bugzilla-daemon
2013-01-03 16:27 ` bugzilla-daemon
2013-01-06  5:47 ` bugzilla-daemon
2013-03-02 18:08 ` bugzilla-daemon
2013-03-02 18:09 ` bugzilla-daemon
2013-04-10 20:34 ` bugzilla-daemon
2013-04-10 20:54 ` bugzilla-daemon
2013-04-10 21:14 ` bugzilla-daemon
2013-04-10 21:15 ` bugzilla-daemon
2013-04-10 21:16 ` bugzilla-daemon
2013-04-10 21:17 ` [Bug 1001397] I2C driver for Kinetis microcontrollers bugzilla-daemon
2013-04-11  1:20 ` bugzilla-daemon
2013-04-11  1:25 ` bugzilla-daemon
2013-04-11  1:49 ` bugzilla-daemon
2013-04-13 23:21 ` bugzilla-daemon
2013-04-13 23:22 ` bugzilla-daemon
2013-04-15 16:34 ` bugzilla-daemon
2013-04-17 16:28 ` bugzilla-daemon
2013-04-17 17:43 ` bugzilla-daemon [this message]
2013-04-19 16:39 ` bugzilla-daemon
2013-04-20 20:09 ` bugzilla-daemon
2013-04-21  7:47 ` bugzilla-daemon
2013-04-21 14:09 ` bugzilla-daemon
2013-04-23  4:47 ` bugzilla-daemon
2013-04-23  7:01 ` bugzilla-daemon
2013-04-24  9:08 ` bugzilla-daemon
2013-04-24 17:20 ` bugzilla-daemon
2013-04-24 18:46 ` bugzilla-daemon
2013-04-25 17:06 ` bugzilla-daemon
2013-04-26 12:54 ` bugzilla-daemon
2013-04-26 13:39 ` bugzilla-daemon
2013-04-26 17:13 ` bugzilla-daemon
2013-04-26 17:17 ` bugzilla-daemon
2013-04-30 11:40 ` bugzilla-daemon
2013-04-30 11:40 ` bugzilla-daemon
2013-04-30 19:03 ` bugzilla-daemon
2013-08-29 17:58 ` bugzilla-daemon
2013-08-29 18:00 ` bugzilla-daemon
2013-08-30  7:15 ` 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-1001397-13-QKISlXO4Ul@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: link
Be 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).