3 Replies Latest reply on Nov 15, 2017 12:06 AM by bob.marlowe

    SPI Slave problem

    m.jucevicius_2864716

      Hello everyone : )

       

      I have a problem with SPI slave in psoc creator, related to my inexperience. In my main() program, I have calculated array of 0's and 1's, and I need to SPI it out     (communication controlled by external clock bursts LGC-clk).

      I believe must change my array to a binary data word, for this to work?

       

      The main question is: Can I simply write my data word to SPI module using Code? If so, why is it mandatory to connect MOSI input and what should i connect to it?

       

      Thanks guys

        • 1. Re: SPI Slave problem
          bob.marlowe

          You should ground the MOSI pin to have a defined input.

          I count more than 12 clock cycles on your picture. Sure you do not have 15 bits to transfer?

           

          Bob

          • 2. Re: SPI Slave problem
            m.jucevicius_2864716

            Yes, I'm sure. That is the only way this particular master communicates. 1'st is for sync (sadly, I don't know how to make SPI start from the 2'nd), and the other ones are error and parity bits.

             

            I will try grounding MOSI, thank you

            • 3. Re: SPI Slave problem
              bob.marlowe

              So you need to increase the slave's width to 15.

              SPI works as:

              For every bit the SPIS interface gets, one bit is returned immediately. When the very first byte is sent, the interface usually does not "know" yet what to answer, so a dummy byte is returned which should be skipped.

              SPI has no read command, so you must send dummy bytes to retrieve the information wanted.

              There is no sync or parity defined for SPI, you need to handle those in software.

               

              Bob