New Toy

The ARM-Cortex SoC Microcontroller from Cypress.

To be precise, I got a prototyping board with that µC. It’s almost weird to call it a microcontroller. But that’s what Cypress calls it, so, whatever.

Big thanks to a good friend of mine who sent it to me.

That’s the thing:

PSoC 4200M-Series Prototyping Kit

That’s the Page: CLICK ME, I’M A HYPERLINK

It’s really a nice little device. Besides the usual µC stuff, it has a couple of PGA cells in there. I haven’t done anything with PGAs before, so I’m currently just goofing around with it. No real use to me so far. But! There’s more! 12bit ADC @ 1MS/s. Direct LCD drive. And four 8bit DACs!!! Plural! I love when µCs bring a DAC, let alone four. The main reason for those is to drive the capacitive sensor module, though.

I just had to check out those DACs.

A quick test of a DAC was cobbled together in an hour (including setting everything up). The waveform looks a bit crooked, though. Don’t know what went wrong there, but as I said, just a quick and dirty test.

The ARM core is also pretty cool: 32 bits, 48MHz, comes with 128k Flash and 16k RAM. Their (Cypress) “PSoC Creator” comes with a decent compiler. Setting up the peripherals in the µC is neat. It’s done by drag-and-drop. Most of the configuration is done via GUI. The IDE generates a pretty usable API for each module. You still have to dig through the header files, but it’s all very self-explanatory. So it’s good fun developing software for that thing.

Since I have no immediate use for it, I decided to implement a simple litte project.

The Project

Once in a while I need a quick way to get a few GPIO lines toggled from a PC. In a simple way. It’s easy to get 8bit PIOs with USB that bring a library to use it via C/C++. While this not a huge problem for me, it’s not what I’d call “quick” or “simple”. The main problem however, is that sometimes 8bits is just not enough. Getting a decent 16bit PIO for USB is a lot harder. Especially with those words “quick” and “simple” lurking behind the corner.

Therefore, I’m going to use a 48MHz 32bit “computer” to be a RS232 to 16bit GPIO device.

Overkill? Of course!   … because I can …

16bit GPIO Testbed

Since the main controller has no USB module, I just use one of the UARTs for RS232 and a standard RS232-to-USB converter.

The firmware implements a simple (fast) protocol to control the IO signals. The commands are just sent one after another without any separator or terminator.

The last line shows how the protocol works.

‘!’ – acknowledge for the command *X01 to enable echoing (no echo by default)
‘*D0000’ – set all lines output
‘!’ – acknowledge for *D
‘*.’ – a mistake I made. I accidentally typed the ‘*’ so I cancelled the input with ‘.’
‘#’ – acknowledge for the cancellation.
‘wffff’ – all outputs high
‘laa’ – low byte 0xAA
‘h55’ – high byte 0x55

Non-config commands aren’t acknowledged, so no ‘!’ after ‘w’, ‘l’ and ‘h’.

There are a few features I have in mind that aren’t implemented yet – according to the motto of this blog: Everything unfinish..

Leave a Reply

Your email address will not be published. Required fields are marked *