Custom Serial Protocol

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

cross mob
rybo_1140436
Level 2
Level 2
First like given

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.

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
rybo_1140436
Level 2
Level 2
First like given

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?

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

Presumably this might require writing some verilog Yes!

   

 

   

Bob

0 Likes