The SmartEdge IIOT GatewaySmartEdge IIOT Gateway is a Raspberry Pi 3 Compute based industrial Linux box.

It runs Raspbian with some additions. There's a set of industrial hardware extensions. In this blog I revisit the industrial I/O. I try to control the industrial pins just liker traditional ARM GPIOs on, a Pi.

This is a follow up on a discussion started by ergouser: can you talk to the industrial I/O with WiringPi?



In the previous post, I checked how to use the industrial I/Os in the default way: by using the Linux character device interface that's provided by AVNET.

They aren't plain ARM GPIOs. The underlying mechanism is a i2c gpio expander IC that provides 8 I/Os.

You set or read the pins by talking to an 8 bit register on the expander IC.

All of that is abstracted on the Linux level. Each pin is a character device.

A common - and excellent - design.


Jim has a requirement to use them as if they are generic Raspberry PI GPIOs. That is possible, but you need to modify the board.

That's what I'm doing in this post.



Switch from i2c based DIGIO to GPIO Controlled: Board Modifications


You switch by moving a set of resistors on the PCB. These are 0402 (1005 imperial). Tiny but doable.

I am modifying one block. I leave DIGIO A as is, connected to the port expander. The DIGIO B pins will switch to GPIO control.


image source: SmartEdge-iiot-gateway_programmers_reference.pdf (annotated)


The output side resistors are 470R, the input side 4K7.

On the PCBs, these are located just right of the upper right corner of the opto-couplers.

Each time, you have to move the resistor from the upper to lower position.

I used 460° C (yeah) and very little air - 25%. And put a big blob of flux on top so that they stay on the PCB when reworking.

Still R170 flew away. I ordered a set of new ones.

This is the result. Spot the empty location.

This doesn't stop me from proceeding. I have 2 outputs and an input to test. Once the replacement resistors arrived, I'll complete the exercise.


Software Control via GPIO


Jim wants to control the pins from WiringPi. I'm using its GPIO command here as proof of concept.


I'm going to test DIN4 and DOUT4.

DIN4 is connected (now, by moving R176) to GPIO21.

DOUT4 to GPIO26.


I'm using the same test circuit as in the previous post -  except for using 5V instead of 24 V, but that does not matter:


I first did an output test:

avnet@smartedge:~ $ gpio -g mode 26 out
avnet@smartedge:~ $ gpio -g write 26 0
avnet@smartedge:~ $ gpio -g write 26 1
avnet@smartedge:~ $ gpio -g write 26 0


That worked. When I drive pin 26 high, the output is active, pulls the pin down to 0 V.

When I drive it low, the output is pulled to 5 V by the 10K pull-up resistor.




Then the input test:

avnet@smartedge:~ $ gpio -g mode 21 in
avnet@smartedge:~ $ gpio -g read 21
avnet@smartedge:~ $ gpio -g read 21
avnet@smartedge:~ $ gpio -g read 21
avnet@smartedge:~ $




Related Blog
Industrial I/O
Use the Industrial I/O
Control Industrial I/O directly from GPIO Pins
C Program for the Industrial I/O
Control Industrial I/O directly from Node-RED
Display Industrial I/O on Node-RED Dashboard
Use the Isolated CAN
CAN programming in C on Linux: Filter and Mask
2020 Linux Image
The 2020 Linux Image and IoTConnect Scripts
Understand the Custom Scripts and Services (Pt. 1: intro and reset button service)
Understand the Custom Scripts and Services (Pt. 2: led service)
Understand the Custom Scripts and Services (Pt. 3: IoT Connect service)