DSBOX-NX2 IIO Interface Tutorial - Forecr.io

DSBOX-NX2 IIO Interface Tutorial

Jetson Xavier NX

20 February 2021
ENVIRONMENT

Hardware: DSBOX-NX2 (Rev. 1.1)

OS:  Jetpack 4.5 (L4T-32.5)

Language: C++

In this blog post, we will test the IIO(Industrial Input Output) interface of DSBOX-NX2.


Attention: If your DSBOX-NX2's carrier board's revision is 1.1, please follow this guide.


The pinout of I/O connector  


First, let's look over the IO connector. On the connector, there are 4 isolated outputs, 2 isolated inputs and 1 isolated ground. Also, you can get 2 more isolated input pins with simple hardware rework. When using IIO always double check which ground pin you are using. You must use isolated ground for IIO applications.


Example of an input application 


Digital input side accepts signals between 12-24V (rated for 2.25mA). In our application, we used Heschen M12 Inductive Proximity Sensor (PNP & Normally Open(NO)) with 24V voltage source.



After proper hardware connection, we can continue on the software side. First, find sysfs equivalent of the connected input pin from the table below. For this setup it is gpio-232.



Connect to your DSBOX-NX2 with ssh. For this, you can use the ethernet interface or recovery USB connector. If you use recovery USB like us, IP address is 192.168.55.1.



Note: If you have monitor access to the DSBOX-NX2, you can simply open a new terminal window and jump the next step.


Then set gpio232(DIGITAL_IN0) as input and read sensor value. To do this, you could use the commands below.

• sudo echo 232 > /sys/class/gpio/export

• sudo echo in > /sys/class/gpio/gpio232/direction

• sudo cat /sys/class/gpio/gpio232/value


 Example of an output application


Digital output side can drive loads up to 24V and has a current limit of 1A. They work as low side switches, open-close between them and GND_ISO. So, you should have a circuitry as in the schematic below. In our application, we used GASHER 24V Indicator Light with 24V voltage source. 



After proper hardware connection, we can continue on the software side. First, find sysfs equivalent of the connected output pin from the table below. For this setup it is gpio-236.



Connect to your DSBOX-NX2 with ssh. For this, you can use the ethernet interface or recovery USB connector. If you use recovery USB like us, IP address is 192.168.55.1. 



Note: If you have monitor access to the DSBOX-NX2, you can simply open a new terminal window and jump the next step.


Then set gpio236(DIGITAL_OUT0) as output and control light state. To do this, you could use the commands below.

• sudo echo 236 > /sys/class/gpio/export

• sudo echo out > /sys/class/gpio/gpio236/direction

To short Output (Led ON)

• sudo echo 1 > /sys/class/gpio/gpio236/value

To open Output (Led OFF)

• sudo echo 0 > /sys/class/gpio/gpio236/value


Thank you for reading our blog post.