Problem with Slave Select(SSN) of SPI

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

cross mob
Anonymous
Not applicable

I have been working with SPI to configure registers ina ADC. On analyzing the SPI transfer in LOgical Analyser I found that the SSN is not being asserted. When I replaced SSn with GPIO transfer was success.xasdas

My SPI Configuration is:

   

    spiConfig.isLsbFirst = CyFalse;
    spiConfig.cpol       = CyTrue;
    spiConfig.ssnPol     = CyFalse;
    spiConfig.cpha       = CyTrue;
    spiConfig.leadTime   = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;
    spiConfig.lagTime    = CY_U3P_SPI_SSN_LAG_LEAD_HALF_CLK;
    spiConfig.ssnCtrl    = CY_U3P_SPI_SSN_CTRL_FW;
    spiConfig.clock      = 500000;
    spiConfig.wordLen    = 8;

   

    status = CyU3PSpiSetConfig (&spiConfig, NULL);

   

And I used the API CyU3PSpiSetSsnLine () to toggle the SSN. But the SSN line was seen to be pulled high through the transaction. The code at the SPI transfer is shown below:

   

           CyU3PSpiSetSsnLine (CyFalse);
            CyU3PGpioSetValue (SSNPIN, CyFalse);
            status = CyU3PSpiTransmitWords (location, 2);
            if (status != CY_U3P_SUCCESS)
           {
                CyU3PDebugPrint (2, "SPI READ command failed\r\n");
                CyU3PGpioSetValue (LED_GPIO, CyFalse);
                CyU3PSpiSetSsnLine (CyTrue);
                CyU3PGpioSetValue (SSNPIN, CyTrue);
                return status;
            }
            CyU3PSpiSetSsnLine (CyTrue);
            CyU3PGpioSetValue (SSNPIN, CyTrue);

   

Why doesn't the SSN line toggle, while clock MOSI all seems fine? Is there any other configuration I have to do?  

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

Do you face the same issue with our example firmwares for SPI? If so, please check your the connection of your SSN line if it is broken.

   

Regards,

   

- Madhu Sudhan

0 Likes