7 Replies Latest reply on Oct 14, 2013 5:44 AM by user_78878863

    SPI DATA WIDTH

    jian.qin

      Hi,

         

           I'm pretty new in using the PSOC. Now  I'm using CY8C3866AXI to control TLC5922 through SPI. This needs to change the data width of the spi from 8 to 7 or vice versa time to time . but SPIM_DATA_WIDTH is generated automatically in SPIM.h. So,how can change it ? thank you!

        • 1. Re: SPI DATA WIDTH
          junichi.hiraoka
                  You can't change SPIM DATA WITH in time to time.   
          That is a especial requirement, but doable, I think.   
          Use 2 SPIM (7bit, 8bit) in parallely   
          Or switching time to time, by control signal.   
          How's it?   
          • 2. Re: SPI DATA WIDTH
            user_78878863

            Reading the data sheet, I don't see the need for 7 bit transfer. The TLC5922 wants to get either 16 bits (2 bytes) or 112 bits (14 bytes). The first amounts to 1 bit per LED, the second one to 7 bit per LED. But for both you can use a SPI master configured to 8-bit-words.

            • 3. Re: SPI DATA WIDTH
              user_14586677

              Several possibilities -

                 

               

                 

              1) Create your own SPI out of existing module or a LUT + Logic.

                 

              Componet author guide will help. There are also videos on component

                 

              authoring - 

                 

               

                 

              http://www.cypress.com/?rID=49025

                 

               

                 

              http://www.cypress.com/?rID=48413

                 

               

                 

              2) I looked for a register in TRM, I could not find, but look at where

                 

              SPI_DATA_WIDTH is used in project, maybe that will point to register

                 

              that controls width. Then look in Reg TRM for its usage.

                 

               

                 

              3) Using just SPI, control its output with a LUT to alter ?

                 

               

                 

              Regards, Dana.

              • 4. Re: SPI DATA WIDTH
                user_78878863

                @dana see above - there is not even the need for 7bit transfer, since the TLC5922 expects a whole set of values, so one can use 8bit mode always...

                • 5. Re: SPI DATA WIDTH
                  user_78878863

                  One thing to note here: since you need to send more than 4 bytes (the length of the hardware FIFO), you propably  will increase the buffer size of the SPI component. This will then change the implementation to use an internal ISR to fill the hardware buffer.

                     

                  If you then use SPIM component to control the slave select signal, this signal might go high even when the buffer is not empty. This is because if the SPI is too fast, the hardware buffer runbs empty before the ISR was able to re-fill it. Either you reduce the SPI clock frequency, or you control the slave select line manually via a control register.

                  • 6. Re: SPI DATA WIDTH
                    jian.qin

                     Thank you all for your help. but I have 10 TLC5922s to control in a single SPI chain. So I do fill the FIFO in a ISR. but now, it seems doesn't work. I'm trying to find out the preblom.

                    • 7. Re: SPI DATA WIDTH
                      user_78878863

                      Are you able to control at least one TLC5922 properly? What is the SPI clock frequency? How is your SPI master set up?

                         

                      Just stating 'it doesn't work' is not helpful, since my crystal ball is still in repair :(

                         

                      Maybe you upload your project for us to look?