SPI DATA WIDTH

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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!

0 Likes
1 Solution
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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.

View solution in original post

0 Likes
7 Replies
Anonymous
Not applicable
        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?   
0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

@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...

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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.

0 Likes
Anonymous
Not applicable

 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.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

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?

0 Likes