Forums - SPIM for half-duplex access

1 post / 0 new
SPIM for half-duplex access
Join Date: 9 Mar 21
Posts: 1
Posted: Fri, 2021-05-07 03:49

I want to read 256kBytes from a SPI Flash. I need to send a 4-bytes command to the Flash and AFTER that the SPI Flash send back 256kBytes of data.

In order to use qapi_SPIM_Full_Duplex() I need a buffer of 256kBytes PLUS 4 bytes, because the function is full-duplex, so start writing to the receiving buffer at the beginning of transmission.

I know I can allocate just a slightly bigger buffer, but as API is a pain. Imagine an application code that wants to read data from SPI Flash. It doesn't know anything about SPI Flash, full-duplex and length of command (4 bytes). How could the application know to allocate 4 bytes more to the buffer?

I was thinking to keep CS asserted and calls two times qapi_SPIM_Full_Duplex(), but it seems CS goes deasserted as soon as the function returns. Even with QAPI_SPIM_CS_KEEP_ASSERTED_E.

Is it possible to have a function for half-duplex transactions?


  • Up0
  • Down0

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.