3 Replies Latest reply on Dec 4, 2019 9:16 AM by BragadeeshV_41

    PSOC 5LP SPI Read and Write operation without DMA

    KaGa_3938861

      I am working on an ADC converter connected to the SPI read and write pins, the ADC line should be selected by sending data to the ADC and then the receiver will receive the response by reading the analog value connected to the channel. I have written code changes and while running I am not getting the error, but the received data is always 0 no matter what value is connected across ADC.

       

      I have included the code I am trying, can anyone help me to rectify what might be wrong here, or if you can provide example code, it will be great,

       

              /* Clear the transmit buffer before next reading (good practice) */

              SPIM_ClearTxBuffer();

              SPIM_ClearRxBuffer();

              SPIM_ClearFIFO();

         

              // set cs bit to low

              CS_ADC_Write(0);

           

               //Config input = 0x8C

              SPIM_WriteTxData(adcInputCofig);

            

              //check RX buffer status

              //while(!(SPIM_ReadRxStatus()));

            

              uint8 receivedDataBuffer = SPIM_ReadRxData();

            

              // set cs bit to high

              CS_ADC_Write(1);