You are here

SPI register vs dma read transfer | Cypress Semiconductor

SPI register vs dma read transfer

Summary: 1 Reply, Latest post by Madhu Sudhan on 28 Jan 2016 01:33 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
nia_1534961's picture
20 posts


I want to read 32 bits at a time using SPI.  I'm using a GPIO pin (simple configuration) as the interrupt signal to indicate when the data is ready to be read.  And using SPI register mode to read (based on the UsbSpiRegMode example).  There is about a 800 micro-second delay between the GPIO interrupt end edge and the SPI SSN signal start edge.  This delay is too long; it needs to be about 5 micro-seconds.  Is this long delay because I'm using a register read instead of dma read?  The actual read (SSN signal width) is ok -- about 3 micro-seconds.  Does register read have some setup lag?

    // Configure GPIO 34 as input INT_n
    // interrupt line activated when profile sensor data is ready, triggered by Start_n
    gpioConfig.outValue = CyTrue;
    gpioConfig.inputEn = CyTrue;
    gpioConfig.driveLowEn = CyFalse;
    gpioConfig.driveHighEn = CyFalse;
    gpioConfig.intrMode = CY_U3P_GPIO_INTR_NEG_EDGE;
    status = CyU3PGpioSetSimpleConfig(GPIO_INT_N, &gpioConfig);


mady's picture
Cypress Employee
955 posts


To reduce the delay in assertion of SPI Line, you can assert the SSN by direct register control instead of calling CyU3PSpiSetSsnLine API.

Add the header in your code:

#include "spi_regs.h"

and instead of CyU3PSpiSetSsnLine (CyTrue), you can use direct register control as: 

    SPI->lpp_spi_config |= CY_U3P_LPP_SPI_SSN_BIT;

To de-assert the SSN, you can use 

        SPI->lpp_spi_config &= ~CY_U3P_LPP_SPI_SSN_BIT;

Also, please try to avoid unnecessary code overhead.



- Madhu Sudhan



Log in to post new comments.