PSOC 5LP SPI Read and Write operation without DMA

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

cross mob
KaGa_3938861
Level 3
Level 3
10 likes given 5 likes given First like received

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

0 Likes
4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Karthik,

Is the ADC conversion is happening properly ? Kindly check the following application note. https://www.cypress.com/documentation/application-notes/an61102-psoc-3-and-psoc-5lp-adc-data-bufferi... .

Best Regards,
Vasanth R S

0 Likes
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi KaGa_3938861​,

Looks like your previous response is deleted. Could you please post your last response again?

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hi Bragadeesh,

I am trying to remove delete the post from the community, i got the solution i was looking for and the post is not relevant some what, i couldnt do it, if you know how to remove entire post, please let me know,

Thanks,

Karthik

0 Likes

Hi KaGa_3938861​,

We are glad that your issue is resolved. We will move the status of the thread to locked.

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes