SPIM Send 7 Bits Data

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

   

I am using CY8C24894 to develop a serial port comminication with IC. The communication require PSoC to send a 7 bit data only to IC. I implement it using SPIM UM, but i got a problem with the SPIM to send a 7 bits data to my IC.

   

My method is to use SPIM to send 1 byte data, and AND the SPIM sclk 8 pulse signals with a counter which has a duty cyle of 7/8, in the way 1 pulse will be masked and only the rest 7 sclk pulse can be sent out.

   

my problem is how can I make sure the counter can mask exactly the 1st pulse of sclk or the last pulse of sclk, in order to pass the desired 7 data bits? I have attached the diagram to illustrate the desired situations.

   

 

   

I have try the following method to solve it, but none of them works so far:

   

1) programming in main.c to start counter and send data by SPIM.

   

"while( ! (SPIM_bReadStatus() & SPIM_SPIM_TX_BUFFER_EMPTY ) );

   

Counter_Start();

   

SPIM_SendTxData(databyte);"

   

The starting time of counter is not constant, thus position of the masked sclk pulse is random every time.

   

2) use SPIM ISR to start counter. the SPIM interrupt mode is TXRegEmpty. the counter starting time is constant now, but it will delay a few cycle of sclk. Thus the first 4 sclk pulses will all be masked as showed in attached file.

   

 

   

Right now i am stucked here, could anyone give me some suggestion on sending only 7 bits data by SPIM?

   

 

   

Thanks,

   

CC

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

Create a software SPI implementation ?

   

 

   

    

   

          https://www.silabs.com/Support%20Documents/TechnicalDocs/an128.pdf

   

 

   

Regards, Dana.

View solution in original post

0 Likes
8 Replies
Anonymous
Not applicable

 Or is there other PSoC1 UM that I can use to send 7 bits data to IC? any advice please?

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

Create a software SPI implementation ?

   

 

   

    

   

          https://www.silabs.com/Support%20Documents/TechnicalDocs/an128.pdf

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Hi,

   

I think I know the implementation of SPI. But my target is to send 7 bits data from PSoC to IC. When I use SPIM to implement it, there are some issue that I cannot solve. I don't know if it possible to use SPIM to send 7bits data? or anyother UM I can use  for the 7bits transmission?

   

Thanks,

   

CC

0 Likes
Anonymous
Not applicable

Dana's suggestion is to write your own software SPI. The silabs app note is a good start to do it.

Anonymous
Not applicable

If you want to use the SPI component. may be use a hardware counter and a gate to supress the last clk. you may need to wait for the tx buffer empty, then reset the hardware counter so it alwasy gate the last clk pulse.

Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When I went through the specs of SPI I couldn't find a hint that there was a transfer-width allowed for not a multiple of a byte.

   

Are you connecting the PSoC to an existing device or what else are your reasons to have a 7-bit transmission?

   

 

   

Bob

Anonymous
Not applicable

 Thanks H L and Dana, I got it. I will try on inplementing a custom data transfer function.

0 Likes
Anonymous
Not applicable

 Hi Bob, I connect the PSoC to a device which requires 7b data transfer. I just need to implement a 7b transfer fxn in PSoC, and now I am trying to modify the SPI UM to do this.

0 Likes