SPI register vs dma read transfer

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   

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);

   

Thanks.

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

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.

   

 

   

Regards,

   

- Madhu Sudhan

0 Likes