You are here

Custom Serial Protocol | Cypress Semiconductor

Custom Serial Protocol

Summary: 3 Replies, Latest post by Bob Marlowe on 31 Aug 2016 06:21 AM PDT
Verified Answers: 2
Last post
Log in to post new comments.
boz336's picture
User
20 posts

I've been looking into trying to use the PSOC 5LP in an application requiring a customized serial protocol and wonder what the best way to go about it might be.   The basic idea is that I have several sensors that use SPI to communicate.  The PSOC would need to be able to grab data from these sensors, pack it into a "frame",  prepend a synchronization word, add a few other housekeeping words, and then push it out as a set of serial bits at a rate of roughly 5Mb/s.   Does this sound feasible using say the CY8C5888LTI-LP097?   If so, what would be the most likely path to success?  I've been playing with the shift register block, but have been struggling to get it working correctly. 

It seems there are two hurdles to overcome with this:  1) Grabbing the data from each of the separate SPI ports and packing the data into (maybe a ping pong or circular?) buffer.    2) Generating a structure with low enough latency to push out 5Mb/s consistently from one frame to the next.

As a follow up question, I was curious about how many separate SPI ports could be instantiated before the PSOC started complaining .... turns out the number for this device is apparently 8.  If anyone has any insight into talking to more than 3 or 4 SPI slave devices at once, I'd be interested to learn about it.

 

 

user_1377889's picture
User
9820 posts

Each SPI slave needs an ss-line which you can assert programatically. No need to use the ss-line from the SPI component. That way you are limited only to the number of pins available.

You are not "grabbing" the data from the sensors: You are sending dummy bytes and for each byte you get one byte back. So no need for a circular buffer. The problem might be that you seemingly have got more than 8 sensors which you will have to access one after the other. So the collecting of the data is the first bottleneck. Way out could be to use more than only one SPI master, thus reducing the time required.

UART transmission is not a problem. The component can be configured to have a larger buffer from which automatically (and interrupt driven) the data is fetched. Only when the buffer is full, the writing to the UART will block until there is room in the buffer again.

 

Bob

boz336's picture
User
20 posts

If I had say 8 of the same identical sensor, is there a way to send the same clock, ss, and dummy bytes to all devices simultaneously and read back all 8 sets of data at the same time?  Presumably this might require writing some verilog?

user_1377889's picture
User
9820 posts

Presumably this might require writing some verilog Yes!

 

Bob

Log in to post new comments.