SPI clock pause and restart in Cypress FX3

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

cross mob
lock attach
Attachments are accessible only for community members.
RiBe_4514336
Level 1
Level 1
5 replies posted First reply posted First question asked

Hello,

I have a problem programming the Superspeed Explorer Kit.

I want to send 4 buffer of 200 Byte using spi. Sometimes happen that the clock 'pause' itself for ~20us and then restart whit the correct data.

I tried different frequencies, I disabled the CyU3PDebugPrint() function and I tried to build the project in Release mode but nothing changes.

I attach the code and also an oscilloscope screenshot whit the error.

CyFxSpiInit();

CyU3PSpiSetSsnLine(CyFalse);

CyU3PSpiTransmitWords(spi_cmd,1);

CyU3PSpiSetSsnLine(CyTrue);

CyU3PBusyWait(200);

CyU3PSpiSetSsnLine(CyFalse);

CyU3PSpiTransmitWords(mosi_buff_1,200);

CyU3PSpiSetSsnLine(CyTrue);

CyU3PBusyWait(200);

CyU3PSpiSetSsnLine(CyFalse);

CyU3PSpiTransmitWords(mosi_buff_2,200);

CyU3PSpiSetSsnLine(CyTrue);

CyU3PBusyWait(200);

CyU3PSpiSetSsnLine(CyFalse);

CyU3PSpiTransmitWords(mosi_buff_3,200);

CyU3PSpiSetSsnLine(CyTrue);

CyU3PBusyWait(200);

CyU3PSpiSetSsnLine(CyFalse);

CyU3PSpiTransmitWords(mosi_buff_4,200);

CyU3PSpiSetSsnLine(CyTrue);

Here the CyFxSpiInit() function:

CyU3PReturnStatus_t

CyFxSpiInit (void)

{

   CyU3PSpiConfig_t spiConfig;

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    /* Start the SPI module and configure the master. */

    status = CyU3PSpiInit();

    if (status != CY_U3P_SUCCESS)

    {

        return status;

    }

   CyU3PMemSet ((uint8_t *)&spiConfig, 0, sizeof(spiConfig));

    spiConfig.isLsbFirst = CyFalse;

    spiConfig.cpol       = CyFalse;//CyTrue;

    spiConfig.cpha       = CyFalse;//CyTrue;

    spiConfig.ssnPol     = CyFalse;

    spiConfig.leadTime   = CY_U3P_SPI_SSN_LAG_LEAD_ONE_HALF_CLK;

    spiConfig.lagTime    = CY_U3P_SPI_SSN_LAG_LEAD_ONE_HALF_CLK;

    spiConfig.ssnCtrl    = CY_U3P_SPI_SSN_CTRL_FW;

    spiConfig.clock      = 8000000 ;

    spiConfig.wordLen    = 8;

    status = CyU3PSpiSetConfig (&spiConfig, NULL);

    return status;

}

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello,

Please try using the attached library and let me know if you face the issue again. Please note that the SCK may still go to idle state, but the data loss should be avoided.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
13 Replies