5 Replies Latest reply on Oct 2, 2015 2:48 AM by user_1377889

    spi bus between two psoc5

    elmaddin.guliyev

      Dear all,

         

       

         

      I have a issue with spi bus between two PSOC5LP (cyc85888lti-lp097 and cy85c868axi-lp035).

         

       

         

      I would like to send 20 byte of command from master spi and read it in slave one and respond based of command.

         

      Seems slave not responds and its second week trying to solve it.

         

       

         

      On attached file you will see psoc project for master and slave spi.

         

       

         

      Thanks in advance for your advice!

        • 1. Re: spi bus between two psoc5
          user_1377889

          Your view of how SPI works is not quite correct:

             

          For every bit (byte) the master sends a bit (byte) is immediately returned by the slave. So it is not a bad idea to make them both > 20.

             

          You clobber your sram by initializing your buffer[10] from 10 to 20 since that does not exist.

             

          You defined an interrupt handler, but in the SPI component no interrupt is enabled.

             

          Your programs are very difficult to read, your indentation does not follow the program structure and I can see only very few comments. When you improve that it can be much easier for you to find bugs.

             

           

             

          Happy coding

             

          Bob

          • 2. Re: spi bus between two psoc5
            elmaddin.guliyev

            Hi Bob,

               

            Thanks for your valuable advice.

               

            I succeeded to make it work and now two psoc  talk through spi.

               

            I have another issue: How to manage master spi talk with two slave.

               

            Could you please, look the screen capture of block diagram slave and master let me know that I doing it in right.

               

            SS_A and SS_B digital pins set resistive pul up and initial state high (1).

               

            Thanks in advance for your advice!

               

             

               

             

               

             

               

               

            • 3. Re: spi bus between two psoc5
              user_1377889

              To multiplex two signals you need only one bit of the control register, not two. In SPI datasheet section I/O connections, ss pin are two examples on how to manage more than one ss-line.

                 

               

                 

              Bob

              • 4. Re: spi bus between two psoc5
                elmaddin.guliyev

                Thanks for giving your time.

                   

                I fixed it. For slave SPI used multislave macro where miso_oe connected to miso pin and ss for input digital pin.

                   

                On master side I connected two digital input pin and write 0 and 1 to choose slave when need to read.

                   

                 

                   

                Thanks in advance for giving your time!

                • 5. Re: spi bus between two psoc5
                  user_1377889

                  Congratulations!

                     

                   

                     

                  Bob