1 Reply Latest reply on Jan 2, 2017 12:01 PM by Madhu Lakshmipathy

    Problem with Slave Select(SSN) of SPI

    jasmin.mj_1975926

      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?