FreeRTOS (runs on Cypress PSoC 5LP)

Matt Watts

FreeRTOS (runs on Cypress PSoC 5LP)
« on May 17th, 2017, 05:59 PM »
Did a bunch of playing with the free real-time operating system FreeRTOS this past couple of days.  I found this OpenSource code to function with the ARM Cortex M3 that the Cypress PSoC 5LP uses.  Semaphores, mutexs, queues, interrupt service routines, everything one should need to do real-time embedded control and processing.  There is code examples already ported to the PSoC Creator IDE.  It's a little old but the project will update and compile without issue.  Or you can just start with the attached project I worked on, that has all the FreeRTOS code already included instead of external.

I'll be doing some more work on this to port it over to the CY8CKIT-059 which is still selling for just ten dollars.  That's a lot of power at your fingertips for ten dollars and with a real-time operating system onboard, you can easily develop a 3D printer controller, advanced waveform generator or something even more complex.  Did I say ten dollars?

My goal is to build a USB serial interface that you can plug into your PC and connect with a terminal emulator, then launch actual tasks via the command line, all running on the RTOS.  All this with the powerful programmable hardware of the Cypress PSoC?   What's not to like.   Cheap too.

Use your resources.

Do great things.

haxar

Re: FreeRTOS (runs on Cypress PSoC 5LP)
« Reply #1, on May 17th, 2017, 07:35 PM »
I counted 46 GPIO.

A mutex, queue and an interrupt on a clock signal is what I need. If it has mutexes, can it do multi-threading? Could I still write in C (GCC compiler)?

I can add this to my pending Mouser order.


Matt Watts

Re: FreeRTOS (runs on Cypress PSoC 5LP)
« Reply #3, on May 17th, 2017, 09:44 PM »Last edited on May 17th, 2017, 09:58 PM
Quote from haxar on May 17th, 2017, 07:35 PM
I counted 46 GPIO.
That particular chip yes.  They have other chips with more IOs if you get real serious.  There's also dedicated analog and comm pins too.

Do keep in mind on the 59 kit, it actually has two PSoC 5LPs.  One of them is used as the KitProg programmer/debugger.  The board breaks away and you can program it individually if you want to.  The KitProg board doesn't have a lot of IOs exposed, but it can certainly do a lot of work.
Quote from haxar on May 17th, 2017, 07:35 PM
A mutex, queue and an interrupt on a clock signal is what I need. If it has mutexes, can it do multi-threading? Could I still write in C (GCC compiler)?

I can add this to my pending Mouser order.
Yeap, that's the whole purpose.  In FreeRTOS they call "threads" "tasks", but it carries the same meaning.

If you can code in C, you're all set Hax.

Up 'til now, I've always written my own "main loop" and added interrupts for command processing, but with FreeRTOS running on there, I see a lot more capability possible allowing the OS to schedule and do inter-process communication.  Now it's possible to build a template project that does all the basic stuff, then just add tasks as needed for specialized projects.  For a lot of things, a full-blown Linux is too much baggage.  FreeRTOS fills the void perfectly.  With the development work Cypress is doing on the new PSoC 6, a lot of people are talking about Bluetooth comms and such.  FreeRTOS came up in the discussions and quite a few people (like myself) went back to the PSoC 5LP to see what we were missing.  Turns out, quite a bit.
Quote from haxar on May 17th, 2017, 08:41 PM
Is there a known throughput speed on a single GPIO line?
I've run 50 MHz out of these pins with strong drive.  Signal looks okay on my 50 MHz scope, I'll have to check it again on my 200 MHz scope when it gets here.


Do take a look at the FreeRTOS documents.  They really spell out what is possible and why one would want such an OS on their embedded micro-controller.

I should mention, it's really easy to solder high-speed and low-speed crystals onto the 59 kit, which gives you PPM frequency accuracy if you need it.  I have the 32.768 kHz crystal and a 10 MHz crystal on one my 59 kits that I use routinely for experimenting with.  This allows me to use a watchdog timer as a heartbeat and low speed timing functions as well as juicing the 10 MHz clock up to 74 MHz via the internal PLL.  The clocking capability in the PSoC 5LP is really well done in my opinion.  Very flexible and accurate.  The only trouble I run into occasionally is some of my hardware logic can't quite run at full bus speed, which I think is mostly my lack of experience with the intricacies of logic timing, edge vs. level triggering and such.  Most anything I've wanted to design, I can make work.  Just takes a little patience and some reading.

haxar

Re: FreeRTOS (runs on Cypress PSoC 5LP)
« Reply #4, on May 17th, 2017, 10:24 PM »Last edited on May 18th, 2017, 12:46 AM
Quote from Matt Watts on May 17th, 2017, 09:44 PM
I've run 50 MHz out of these pins with strong drive.  Signal looks okay on my 50 MHz scope, I'll have to check it again on my 200 MHz scope when it gets here.
This would blow the Pi and ODROID series' GPIO speed out of the water.

I plan (maybe) to tap a 24-bit pixel video data bus at 640x480 resolution from a GPU requiring that speed. A Conexant CX25870. The clock maxes out at 53.333 MHz.

I could use an FPGA, but I have not seen a non-Xilinx open-source toolchain for Linux. That had me discouraged.