Changeset fea392a in rtems


Ignore:
Timestamp:
Aug 10, 2016, 8:32:39 AM (3 years ago)
Author:
Alexander Krutwig <alexander.krutwig@…>
Branches:
master
Children:
36fad91
Parents:
5d1fc66
git-author:
Alexander Krutwig <alexander.krutwig@…> (08/10/16 08:32:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/18/16 06:56:45)
Message:

bsp/atsam: Add timeout to QSPI send command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/atsam/libraries/libchip/source/qspi.c

    r5d1fc66 rfea392a  
    591591        QspiMemCmd_t  pCommand = pQspid->qspiCommand;
    592592        QspidStatus_t Status = QSPI_UNKNOWN_ERROR;
     593        uint32_t timeout = 15000;
    593594
    594595        if (pFrame->InstFrame.bm.bAddrEn)
     
    601602        memory_sync();
    602603
    603         while (!(pQspid->pQspiHw->QSPI_SR & QSPI_SR_INSTRE));
     604        /*
     605         * FIXME: Timeout has been introduced due to a problem that was detected
     606         * when QSPI_SR_INSTRE was not detected and the function is stuck in an
     607         * endless loop. This is still an open issue.
     608         * peripheral clock: 50Mhz -> 20 ns period time.
     609         * timeout: set to 15000 loop cycles => 300000 ns.
     610         * with loop instructions, the delay increases to 1ms altogether.
     611         */
     612        while (!(pQspid->pQspiHw->QSPI_SR & QSPI_SR_INSTRE) && timeout > 0) {
     613                --timeout;
     614        }
     615
     616        if (timeout == 0) {
     617                Status = QSPI_WRITE_ERROR;
     618        }
    604619
    605620        // poll CR reg to know status if instruction has end
Note: See TracChangeset for help on using the changeset viewer.