INDU-RS

From Yantrr Wiki
Revision as of 06:29, 16 March 2017 by Vaibhav (Talk | contribs) (Execution)

Jump to: navigation, search

Overview

Yantrr INDU-RS series of capes provide the capability of interfacing with sensors and instruments using RS232/422/485. These capes are designed to industrial grade I/O interface standards assuring reliable operation and protection in extreme operating environments. The electronics on the capes has been tested to be in compliance with strict EU standards for radiated and conducted emissions.

Utilizing Modbus protocol, these capes can be used to transform VIBE/VIBE2 IoT platform into powerful SCADA & process control systems. INDU-RS capes are also fully compatible with BeagleBone CPU platform.

Quick Start Guide

Following sections gives details of board connectors, pin configuration and various jumpers on INDU-RS3HD, INDU-RS3HD-DC15W boards.

Board Connectors Layout

INDU-RS3HD INDU-RS3HD-DC15W
INDU-RS-layout2.png
INDU-RS-layout.png


Pin Connections

Note: INDU-RS485 Headers P6 & P7 correspond to Beaglebone Black [BB] Header P8 & P9 respectively.

INDU-RS-PinLayout.png

Jumper Details

INDU-RS-Jumpers.jpg
Jumper P8 details.png


All Jumpers Jumper P8
INDU-RS-JumperTable.png
Table : Jumpers Details

Getting Started

Setting up the system

  1. Mount the INDU-RS cape on Beaglebone Black or Yantrr's VIBE/VIBE2 platform carefully.
  2. Ensure all the jumpers are in place according to your application use.
  3. Now power up the full setup
Note: Before powering up ensure correct software image is loaded in Beaglebone black or VIBE/VIBE2
For INDU-RS3HD
You have to supply 5V DC power supply to Beaglebone Black or VIBE/VIBE2.
INDU-RS BBB 1.jpg
INDU-RS VIBE2 1.jpg
Using Beaglebone Black Using VIBE/VIBE2
For INDU-RS3HD-DC15W 
You have two option for supplying power:
  • 9V-36V DC power through terminal headers supplied to INDU-RS cape
INDU-RS BBB 2.jpg
INDU-RS VIBE2 2.jpg
Using Beaglebone Black Using VIBE/VIBE2
  • 5V DC power through normal adapter supplied to Beaglebone Black or VIBE/VIBE2
    Note : For this option, before powering up remove the jumper J1
INDU-RS BBB 3.jpg
INDU-RS VIBE2 3.jpg
Using Beaglebone Black Using VIBE/VIBE2

Software Setup Guide

In general the RE/DE input requires high level while transmitting data and low level while receiving data, whereas the standard RTS signal of UART remain low while transmitting data and high while receiving a data.With INDU-RS3HD and INDU-RS3HD-DC15W capes, respective UART of RS485-Port can be put in RS485 mode which will automatically handles RE/DE signal using its RTS pin.

For use of INDU-RS3HD and INDU-RS3HD-DC15W, basic software setup is required for loading correct 8250 driver and assigning correct RTS pins to UART ports at the runtime using Device Tree Overlays.

Software Images

The INDU-RS series capes are tested with latest-release image from beagleboard.org which has inbuilt support for OMAP internal UART (8250 based driver).
Currently INDU-RS485 cape is tested with beaglebone black kernel version 4.4.40-ti-r80.
For Beaglebone Black, we recommend to use latest Debian image from http://beagleboard.org/latest-images/ as it comes with all the necessary support for OMAP internal UART (8250 based driver).

Device Tree Overlays

For particular RS485 port two dtbo files are there

  1. BB-UART*-00A0.dtbo
  2. BB-UART*-RTSCTS-00A0.dtbo

Note : * represents the particular port no. of UART used in respective RS485 port. For example, for RS485-Port1 it will be UART4.

The BB-UART*-00A0.dtbo file defines the TX and RX pin configuration of particular UART port. While BB-UART*-RTSCTS-00A0.dtbo file defines the RTS and CTS pin configuration of UART port.

For sending data from any RS485 port, both dtbo files(BB-UART & BB-UART-RTSCTS) of associated UART port should be exported to slots before actual sending of data.

For reading data from any RS485 port, only BB-UART dtbo file is sufficient to get data from associated UART port.

The device tree overlays are compiled as per instructions listed in link https://github.com/RobertCNelson/bb.org-overlays.

Steps

  • Clone the repo
cd /root/
git clone https://github.com/beagleboard/bb.org-overlays
cd ./bb.org-overlays
  • Verify the dtc version should be latest one
dtc --version
Version: DTC 1.4.1-gXYZXYZXYZ
  • Upgrade the dtc
./dtc-overlay.sh
wget -c http://www.yantrr.com/w/images/1/15/INDU-RS-Test.tar.gz
cd INDU-RS-Test/Device_Tree/dts/
cp * /root/bb.org-overlays/src/arm/
  • Install *.dtbo
cd /root/bb.org-overlays
./install.sh

Note: This will copies all the dtbo files after compilation automatically in directory /lib/firmware/

  • capemgr: enable/disable capes on kernel cmdline:
    Comma delimited list of PART-NUMBER[:REV] of [enabled/disabled] capes
    bone_capemgr.enable_partno=
    bone_capemgr.disable_partno=
  • capemgr: enable/disable capes with slots:
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
  • Add Device :
root@beaglebone:~# sh -c "echo 'BB-UART4' > /sys/devices/platform/bone_capemgr/slots"
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART4
  • Remove Device:
root@beaglebone:~# sh -c "echo '-4' > /sys/devices/platform/bone_capemgr/slots"
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1

Testing

Initial Setup

  • Export dtbo files of UART1,UART4 and UART5 to slots
sh -c "echo 'BB-UART1' > /sys/devices/platform/bone_capemgr/slots"
sh -c "echo 'BB-UART1-RTSCTS' > /sys/devices/platform/bone_capemgr/slots"
sh -c "echo 'BB-UART4' > /sys/devices/platform/bone_capemgr/slots"
sh -c "echo 'BB-UART4-RTSCTS' > /sys/devices/platform/bone_capemgr/slots"
sh -c "echo 'BB-UART5' > /sys/devices/platform/bone_capemgr/slots"
sh -c "echo 'BB-UART5-RTSCTS' > /sys/devices/platform/bone_capemgr/slots"
  • Check slots
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
 0: PF----  -1
 1: PF----  -1
 2: PF----  -1
 3: PF----  -1
 4: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART1
 5: P-O-L-   1 Override Board Name,00A0,Override Manuf,BB-UART1-RTSCTS
 6: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART4
 7: P-O-L-   1 Override Board Name,00A0,Override Manuf,BB-UART4-RTSCTS
 8: P-O-L-   0 Override Board Name,00A0,Override Manuf,BB-UART5
 9: P-O-L-   1 Override Board Name,00A0,Override Manuf,BB-UART5-RTSCTS

Execution

INDU-RS-Test.tar.gz

  • Compile the code
cd /root/INDU-RS-Test/src/
gcc -o read-write read-write.c
  • Connect A and B lines of RS485-PORT1 to RS485-Port2 and RS485-Port3.
Note : All connection are limited to single INDU-RS cape
  • Start execution
cd /root/INDU-RS-Test/src/
./auto.sh read-write 1

Note : Here the read-write is executable file name which is used while compilation and 1 is loop count, you can increase it to run the test for multiple times.

Result

Now after performing the execution as explained above, the final result will be printed at last on terminal

root@Yantrr:~/INDU-RS-Test/src# ./auto.sh read-write 1
Port is : /dev/ttyS4
Port is : /dev/ttyS1
Port is : /dev/ttyS5
/dev/ttyS4 : RS485 Mode Enabled
/dev/ttyS1 : RS485 Mode Enabled
/dev/ttyS5 : RS485 Mode Enabled
////////////////////////////////////////////////////////
LOOP COUNT=1
////////////////////////////////////////////////////////
Message sent on port /dev/ttyS1=MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE

Message received on port /dev/ttyS5:  

Message received on port /dev/ttyS4: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE

Message received on port /dev/ttyS5: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE
Message sent on port /dev/ttyS4=MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE


Message received on port /dev/ttyS5: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE
Message received on port /dev/ttyS1: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE
Message sent on port /dev/ttyS5=MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE


Message received on port /dev/ttyS4: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE
Message received on port /dev/ttyS1: MESSAGE_ABCDEFGHIJKLMNOPQRSTUVWXYZ_MESSAGE
////////////////////////////////////////////////////////
RESULTS OF DATA TRANSFER
////////////////////////////////////////////////////////

Total data sent on /dev/ttyS1= 1

Total data received on /dev/ttyS1= 2

Correct data received on /dev/ttyS1= 2

Total data sent on /dev/ttyS4= 1

Total data received on /dev/ttyS4= 2

Correct data received on /dev/ttyS4= 2

Total data sent on /dev/ttyS5= 1

Total data received on /dev/ttyS5= 3

Correct data received on /dev/ttyS5= 2
////////////////////////////////////////////////////////
Exit

Note : The result may vary a little with respect to noise in physical line.