- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a software SPI implementation ?
https://www.silabs.com/Support%20Documents/TechnicalDocs/an128.pdf
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or is there other PSoC1 UM that I can use to send 7 bits data to IC? any advice please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a software SPI implementation ?
https://www.silabs.com/Support%20Documents/TechnicalDocs/an128.pdf
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dana's suggestion is to write your own software SPI. The silabs app note is a good start to do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks H L and Dana, I got it. I will try on inplementing a custom data transfer function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.