3 Replies Latest reply on Oct 9, 2013 5:23 AM by user_1377889

    Problem with SPIM, I can't receive anything

    user_37207811

      Sorry, I just solved my problem while gathering the data to get support but the solution creates another question for me, why does what I explain below happen when I use a buffer superior to 4 bytes? I know the SPIM have a 4byte hardware buffer but why it doesn't work when using software buffer? I had the SPIM configured for 28 bytes.

         

       

         

      Thank you.

         

       

         

      My post:

         

      Hi,

         

      I'm interfacing the PSOC 4 with an ADS1298. I'm trying to get some that out of the ADS1298 so I only have to provide clock to it to receive some of the data.

         

      I do that correctly and it sends data since I can see it in the scope. The problem is that I can't read any data with the SPIM.

         

      This is the loop where I keep receiving data.

         

       

         

      SPIM_1_Start();

         

          for(;;)

         

          {

         

              if(DRDY_Read()==0){

         

      for(i=0; i<27;i++){

         

      SPIM_1_WriteByte(0);

         

      while(!(SPIM_1_ReadTxStatus() & SPIM_1_STS_SPI_DONE));

         

      // CyDelayUs(10);

         

      while(!(SPIM_1_ReadRxStatus() & SPIM_1_STS_RX_FIFO_NOT_EMPTY));

         

      if(SPIM_1_GetRxBufferSize()>0)

         

      payload[i] = SPIM_1_ReadRxData(); 

         

      //UART_UartPutChar(payload[i] );

         

      }

         

      }

         

      }

         

       

         

      If tried commeting the first while and the second or adding the delay with no luck.  If I don't comment the if(SPIM_1_GetRxBufferSize()>0)  it gets stuck there because it is not reading anything but it is receiving data since I can see it with my scope.

         

       

         

      The solution was to change the RX buffer size to 4.