I'm building a SCPI device for Linux.
I have the basis working over TCP/IP.
This morning I received a from element14 (thank you!)
This board, with digital inputs, outputs, relays and LEDs can be a nice LAB automation utility.
In this post I check if I can control the PiFace Digital 2 via C.
In this series, I'm focusing on the specifics for TCP/IP communication with a SCPI service.
In the previous posts I made socket server that listens for SCPI commands and parses/handles them.
This is the first post where I talk to hardware. In a later post I'll link the SCPI server and the hardware together.
PiFace Digital 2
This Pi hat is a port expander that gives you 8 digital inputs and 8 outputs, 4 buttons, 2 relays and 8 LEDs that you can control from your Pi.
Communication goes via SPI.
I'm using Ubuntu on my Pi, so I had to install the raspi-config utility first before I could use it to enable SPI.
Control the PiFace Digital 2 with C
That was easy too. Piface has example code on their github.
You need the c and h files from these two repositories:
Both come with a makefile and you can build them right away on your Pi.
I'm developing on a windows computer and cross-compile for Linux, so I've created a project in the ARM DS-5 IDE.
This allows me to interactively debug the program from the windows PC.
As you can see on the photo at the start of the blog post, I was able to control a LED. I've also tested a relay.
Here's an action shot of the debug session:
In the next post I'll try to turn this into some server code that listens to commands and executes any requests.
That's the next step to get a SCPI programmable LAB controller on the Pi.