4 Replies Latest reply on Sep 5, 2016 4:37 AM by info_1585471

    PSoC 4 SPI receive problem

    info_1585471

      Hello,

         

      i am trying to read an external Flash over SPI.

         

      On oszilloscope looks data well, but my variable a and b is wrong.

         

      Code:

         

      SPIM_SpiUartWriteTxData(0x03); // Readcomand
      dummy = SPIM_SpiUartReadRxData(); 
      SPIM_SpiUartWriteTxData(A_high);   // Adress
      dummy = SPIM_SpiUartReadRxData();
      SPIM_SpiUartWriteTxData(A_mid);   // Adress
      dummy  = SPIM_SpiUartReadRxData();
      SPIM_SpiUartWriteTxData(A_low);   // Adress
      dummy  = SPIM_SpiUartReadRxData();

         

      SPIM_SpiUartWriteTxData(0x00);   // Dummy
      a = SPIM_SpiUartReadRxData();
      SPIM_SpiUartWriteTxData(0x00);   // Dummy
      b = SPIM_SpiUartReadRxData();

         

       

         

      I use SS Pin automatic. And a read 16 bit value (2 times dummy 0x00 at mosi pin)

         

      My problem is, a und b is wrong.

         

      Somebody know, was can the problem be? Component "SPIM" has default settings. Master Mode, CPOL 0

         

       

         

      Thanks

         

      Best regards

         

      Alex