This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Spi read problem

Other Parts Discussed in Thread: OMAP3530

Hello everyone,

I'm using SPI in WinCE 6.0  on devkit8000 (omap3530). When I use WriteFile it works fine but when I use ReadFile it doesn't work!

can you explain what's the problem, please? Is it the driver weakness?

  • Hi S.Pouria Mirebrahimi,

    I suggest you to check the configuration of the SPI mode. I suspect that you are using transmit-only mode instead of transmit and receive mode. You can verify the SPI configuration according description in the Technical Reference Manual section 20.5.2.2 Master Transmit-and-Receive Mode (Full Duplex) at the link:

    http://www.ti.com/lit/ug/sprugn4r/sprugn4r.pdf

    Pay attention which channel you are using because the mode configuration is programmable per channel.

    BR

    Tsvetolin Shulev

  • Thanks Cvetolin Shulev-XID, a lot. 

    My configuration was right. I found the problem in section "19.5.2.4 Master Receive-Only Mode (Half Duplex)" of document http://www.ti.com/lit/ug/sprugn4r/sprugn4r.pdf, that you mentioned.

    This line:

    "In the master receive-only mode, software must write dummy data to the MCSPI_TXx register. Only one
    dummy write is enough to receive any number of words from the slave."

    When my friend and I review the SPI driver, found out that it's wrong. In this mode, the driver didn't write any dummy data to MCSPI_TXx.

    I fixed it same as below:

    OUTREG32(&pSPIChannelRegs->MCSPI_TX, 0xFFFF);

    We add this line before reading. 

    It's working, now.