From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22954 invoked by alias); 9 Jul 2013 17:54:02 -0000 Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org Received: (qmail 22939 invoked by uid 89); 9 Jul 2013 17:54:01 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_NO,RP_MATCHES_RCVD,SPF_PASS 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; Tue, 09 Jul 2013 17:54:00 +0000 Received: by mail.ecoscentric.com (Postfix, from userid 48) id 4D1FB4680006; Tue, 9 Jul 2013 18:53:58 +0100 (BST) From: bugzilla-daemon@bugs.ecos.sourceware.org To: unassigned@bugs.ecos.sourceware.org Subject: [Bug 1001879] New: Kinetis DSPI infinite polling Date: Tue, 09 Jul 2013 17:54:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: SPI X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mjones@linear.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: 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/msg00518.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001879 Bug ID: 1001879 Summary: Kinetis DSPI infinite polling Product: eCos Version: CVS Target: freescale_twr_k70f120m (Freescale Kinetis TWR-K70F120M board) Architecture/Host Cortex-M OS: Status: UNCONFIRMED Severity: normal Priority: low Component: SPI Assignee: unassigned@bugs.ecos.sourceware.org Reporter: mjones@linear.com CC: ecos-bugs@ecos.sourceware.org Created attachment 2322 --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2322&action=edit DSPI Polling Patch I believe I have found the source of all my intermittent MMC/SD problems discussed in bug 10011764. (Note, this does not apply to the 4GB Samsung Card issue) I was fortunate to finally have a persistent failure that I could debug. The problem is related to polling in file api_freescale_spi.c. There is a function called dspi_transaction_end(...) and this function has the following code: DSPI_EOQ_CLEAR(dspi_p); while(!(dspi_p->sr & FREESCALE_DSPI_SR_EOQF_M)); Sometimes execution hangs on the while. I believe the problem is that the clear sometimes clears before the bit is set, and sometimes it clears after. There is a race condition between the code and the peripheral. I believe the code should be: while(!(dspi_p->sr & FREESCALE_DSPI_SR_EOQF_M)); DSPI_EOQ_CLEAR(dspi_p); which clears the bit after the polling is satisfied. As soon as I made this change, all my problems disappeared. I verified that my application can now read/write the SD. My application that logs telemetry to SD will now run for a long time without failure. I retested several SD cards and they are fine. -- You are receiving this mail because: You are the assignee for the bug.