11 serial ports with PSoC5

A project log for Averaging many GPSes

Average many GPS modules to reduce error

ed0Ed0 05/30/2016 at 07:592 Comments

I'm using the CY8CKIT059 PSoC 5 LP Prototyping Kit. ($9.98 from Digikey).

I first tried the PsoC5 on Friday to make sure I could fit 10 serial ports. My first impression is that Psoc is surprisingly capable but also very unusual. It mixes programmable digital (small FPGA), programmable analog, and an ARM Cortex and integrates them all surprisingly cleanly in the PSoC Creator IDE.

I was able to fit 11 receive and two transmit ports in hardware. The first limit I hit was on the number of clocks, at 8 as I recall, but serial ports can use any external clock source you route to them so I shared one clock for 10 ports since all the GPS modules should use the same settings. Next, I hit the limit of the number of UDB status cells so I made most of the ports receive only. There is also the option for transmitting using software serial so it is possible to transmit on any IO pin.

Originally I wanted to use the USB CDC serial but it uses more UDB status cells than a serial port, so using the programmer part of the CY8CKIT059 is good enough. It also makes it easier to integrate with something expecting a normal gps over serial since the programmer can be broken off leaving tx/rx/gnd/power at the pins on the edge of the PsoC target board.

I had some issues with the documentation about the serial port component and extending the buffer size to avoid overruns when receiving data faster than it ca be processed. The serial port has a 4 byte FIFO by default, but can be set to move data to a larger buffer automatically with interrupts. Since it was built in I expected it to “just work” when I enabled it but you need to connect an ISR to the interrupt of the serial component. Apparently creating them on the top design schematic and connecting it is enough for it to call the correct ISR to handle the data. I might also be wrong and I just needed to call CyGlobalIntEnable; in the start of main() for it to work.

One complaint is that PSoC doesn't support C++ by default although you can add a compiler flag per file to force it. Hopefully Cypress will fix this soon.

I plan to process the data on the PSoC but for now it just aggregates the data and sends it out the serial port to the host. Each packet identifies the source and number of bytes, sending data from whichever port has the most data waiting so latency is minimized when possible. With reasonably sized buffers and the interrupts enabled there was no lost data when receiving on multiple serial ports.

The PSoC board is much smaller than the USB hub and USB-serial converters and should be very portable. 9 GPS modules and the PSOC should fit in a 10x10cm square.


Yamir wrote 08/19/2016 at 15:14 point

Hello Did you make it function, I am Trying to configure two serial ports on the same board and it only one of then is functioning ok

  Are you sure? yes | no

Ed0 wrote 08/20/2016 at 01:35 point

Yes, they all worked fine after calling CyGlobalIntEnable or when
using the small buffer size. The ISR blocks I added to the schematic
don't actually do anything and I should remove them. In the files
section you can download my project and take a look at what I did or
even test it out. I'd be interested to know if it works for you.

  Are you sure? yes | no