This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1001879] New: Kinetis DSPI infinite polling


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]