Post on 15-Aug-2015
transcript
Kalycito Infotech Private Limited
6/2 & 6/3, Pappampatti Pirivu
Trichy Road, Kannampalayam
Coimbatore - 641103, Tamil Nadu, INDIA
www.kalycito.com
SUBMITTED BY:
S Harshavardhana Reddy II Year B.Tech Electrical and Electronics Engineering NITK Surathkal
SUMMER
INTERNSHIP
REPORT
16 June 2015 – 15 July 2015
CONTENTS
S.NO. TOPIC PAGE NO.
1 POWERLINK 3
2 RASPBERRY PI 2 4
3 openPOWERLINK 8
4 openPOWERLINK with RaspberryPi2 9
5 Application developed for RaspberryPi2 kit
10
6 RaspberryPi2 Kit Setup Drawing 11
7 Remotely connecting RPi2 Boards
12
8 Observations while making application 13
9
openPOWERLINK with XILINX ZYNQ
14
POWERLINK
Open Real Time Ethernet protocol.
Fast Reaction Time- Mix of timeslot and Polling procedures.
Nodes: MN (Master-Managing Node) and CN (Slave- Controlled Node).
Better than TCP/IP in Real Time applications.
Function of MN:
Defines the clock pulse for synchronization of all devices.
Manages the data communication cycle.
Frames in POWERLINK:
SoC- Start of Cycle
PReq- Poll Request
Pres- Poll Response
SoA- Start of Async
POWERLINK Cycle :
Start Period : MN sends SoC frame to all devices.
Isochronous phase : MN issues PReq to poll CN to which CN
responds with Pres message.
Asynchronous phase: Transfer of non-time critical data packets (Eg:
parameterization data)
ETHERNET Frame Format :
MAC Header- Destination MAC address, Source MAC address and
Ethertype (0x88AB for POWERLINK).
Ethernet Payload- Usually between 46 and 1500 Bytes.
CRC trailer- Cyclic Redundancy Check.
POWERLINK Frame Format :
POWERLINK Header- Destination address, Source address and
Message Type.
POWERLINK Payload
POWERLINK Message Types :
SoC, PReq, PRes, SoA, ASnd, AMNI and AInv
POWERLINK Node Addressing :
In a network, nodes are addressed via a 8 bit node ID.
Object Dictionary :
Structured List of Objects.
Interface between node’s application and the network.
Objects in OD accessed via SDO and PDO Service.
Object :
Defines an Interface between the application and other network
participants.
Further divided into sub objects.
Object Attributes :-
Index – 16 bit unsigned integer.
Sub Index – 8 bit, 00h contains number of array/record entries
and FFh describes structure of object.
Object type – 7 – VARIABLE (Single Value, No Sub objects)
8 – ARRAY (Array of values of the same data type, entries are given as
sub objects)
9 – RECORD (Structure of values of different data types, entries are
given as Sub-objects)
Data Type – 16 Bit Unsigned Integer to indicate data type. 0001h – BOOLEAN
0002h – INTEGER8
0003h - INTEGER16
0004h – INTEGER32
0015h – INTEGER64
0005h – UNSIGNED8
0006h – UNSIGNED16
0007h – UNSIGNED32
0008h – REAL32
0009h – VSTRING
000Ah – OSTRING
000Fh – DOMAIN
Value Range: The boundaries of the Data Type.
Access Type : const - The object's value is pre-defined and cannot change during
runtime. The object can only be read from network and node side.
ro - The object is read-only from the network side. The node itself can
change the value during runtime.
wo - The object is write-only from the network side. The node itself can
only read the value during runtime.
rw - The object is read-write from the network side. Also the node
itself can read and write a value from/to the object.
PDO Mapping : no - The object cannot be mapped to a PDO.
default - The object is mapped by default to a PDO.
RPDO - The object may be mapped to an RPDO.
TPDO - The object may be mapped to a TPDO.
optional - The object may be mapped to either RPDO or TPDO.
Default Value: The default value determines the value of the
object when it is unconfigured.
Actual Value: From the network side, the actual value of the
object is retrieved via SDO read command or via mapping the
object to a TPDO. The actual value of the object can be set via
SDO write command or via mapping the object to an RPDO.
Object Dictionary Organization :
Sections
Data type definition area
Communication profile area
Manufacturer specific profile area
Device profile specific area
Interface profile specific area
Service Data Objects (SDO) :
Based on client server principle.
Client establishes connection with server and issues specific
commands.
Connection is unicast and not deterministic.
Asynchronous Phase in POWERLINK.
Process Data Objects (PDO) :
Specific Data that needs to be sent frequently and many
participants of the network may be interested in the same data.
Transmitting Node creates a Transmit PDO and Receiving Node
creates a Receive PDO.
Isochronous Phase in POWERLINK.
The process of assembling the TPDOs and RPDOs is called PDO
Mapping.
RASPBERRY PI 2
Features:
Not a Microcontroller but a LINUX Computer!
The processor: 900MHz quad-core ARM Cortex-A7 CPU and 1 GB RAM.
Secure Digital (SD) card slot: No hard drive on the Pi, Therefore everything
stored on a SD card.
HDMI Port
Ethernet Port: RJ45 Port
Combined 3.5mm audio jack and composite video
Camera interface (CSI)
Display interface (DSI)
Micro SD card slot
VideoCore IV 3D graphics core
Indicator LEDs:
ACT – (Green) – Lights when SD card is accessed. PWR – (Red) – Hooked up to 3.3V Power Supply FDX – (Green) – On if network adapter is full duplex LNK – (Green) – Network Activity Light 100 – (Yellow) – On if the network connection is 100Mbps
General Purpose Input Output (GPIO) pins:
Read buttons, switches and input signals and also control actuators
like LEDs, motors and Relays at Outputs.
40 GPIO Pins on the board.
Power Draw:
Without HDMI, GRAPHICS and ETHERNET, Pi2 draws 200mA
current.
Ethernet draws about 40mA current.
Heavy Computational components draw 200-250mA.
Overall, Raspberry Pi2 draws a current of around 650mA.
OpenPOWERLINK
Open Source Industrial Ethernet Stack implementing the POWERLINK
protocol for MN and CN.
Implements Modes of Operation :
Standard
Multiplexed
Poll Response Chaining
Dynamic and Static PDO mapping
SDO via Asynchronous Send (ASnd) and SDO via UDP
Asynchronous Communication via a Virtual Ethernet Interface.
OpenPOWERLINK with RASPBERRY PI 2
Setting up UBUNTU Linux on the RaspberryPi 2 Boards:
Slot SD Card in the SD Card Reader connected to windows PC.
Write the UBUNTU Disk Image File into the SD card using Windows
Disk Imager.
The Peripherals are connected to the RaspberryPi board, it is powered
on and logged in as user ‘linaro’.
The oplk_Pi.zip, wiringPi package, packet capture (pcap) libraries,
dependency files and Install_pcap.sh file are copied into a USB Thumb
drive.
The USB Thumb Drive is mounted, the contents copied to the home
folder and the zipped oplk_Pi is unzipped.
POWERLINK packet capture and its dependencies are installed.
The openPOWERLINK Master binaries are run and the Ethernet Interface
is chosen as ‘eth0’.
The openPOWERLINK Slave binaries are run and the Ethernet Interface is
chosen as ‘eth0’.
The POWERLINK Network is running when master displays
“NmtCsOperational” and slave displays “NmtEventStartNode”.
Testing :
When HIGH (3.3V) is given to Pin 11 of MASTER, Pin 11 of Slave will
also be HIGH.
When LOW (Gnd) is given to Pin 11 of MASTER, Pin 11 of Slave will
also be LOW.
Application developed for RaspberryPi2 Kit
MASTER:
Controlling the Enabling and Direction of
rotation of motor in Slave 2.
Changing the pattern of the lights in Slave 1.
Indicators for Stack Shutdown, Standby Mode
and Application Running.
Indication for Slave operational state.
SLAVE 1:
Four LEDs glowing in pattern controlled from the
master.
Emergency Push Button – to stop the application
when pressed and send an indication to the
master.
SLAVE 2:
Motor connected with a L293D Motor driver,
controlled by the inputs from the master.
Four LEDs brightness varying according to the
Motor’s speed (PWM).
RaspberryPi2 Kit Setup Drawing
CAD Drawing of the setup including:
Three RaspberryPi2 Boards
Three application Dot matrix boards
D-Link Switch
SIEMENS Lights for indicators
Emergency Push Button
Motor
Remotely connecting RPi2 Boards
The Raspberry Pi 2 boards are remotely connected
via SSH using PUTTY.
Static IP addresses are set for the boards:
sudo vi /etc/network/interfaces
iface eth0 inet static
address –
netmask -
In the application setup, the master’s address is
192.168.1.240, slave 1 is 192.168.1.1 and slave 32 is
192.168.1.32.
While connecting via SSH, the IpV4 connection
settings also have to be changed to a static IP and
netmask.
Observations while making application
Xap.h is a file generated by openConfigurator and it
contains the details of the Object attributes.
Xdd file is the device description file given by the
board manufacturer.
Mnobd.c file contains details of the packet size and
PDO mapping.
A maximum of 239 slaves are possible in
POWERLINK network.
pProcessImageIn is directed from master to slave
and pProcessImageOut is from slave to master.
Processing time in processsynq() function has to be
within the cycle time of the network, so delay()
should be avoided.
openPOWERLINK with XILINX ZYNQ
For building openPOWERLINK for ZYNQ SoC, Build
steps to be carried out:
Build Hardware Platform
Build the openPOWERLINK Stack Libraries
Build the drivers
Build the application
Build the zynq bootloader
Building Hardware Platform:
Build the hardware library of MicroBlaze using
cmake
Build platform with driver libraries set to debug.
Make and then make install
Build platform with driver libraries set to release.
Make and then make install
Repeat the same steps for Xilinx ZynqArm
The difference between Debug and Release modes is that
the print statements will be executed in Debug mode but
not in release mode.
Building Stack Libraries:
For Microblaze, choose appropriate compile
libraries and library path from configuration
options.
Cmake compiling in Debug and Release modes.
Repeat same steps for ZynqArm
Building Drivers:
Install PCP Daemon for Microblaze only.
While compiling using cmake, include the lines in
the command –
-DCFG_HW_LIB=”Xilinx-Z702//mn-dual-shmem-
gpio
-DCFG_BUILD_KERNEL_STACK=”PCP Daemon
Dual_Proc …
Building a Demo Application:
Build only for target ZynqArm
The build type in cmake could be either debug or
release.
Building Bootloader:
Create an executable bootloader and cmake
compiling in either debug or release mode.
The generated BOOT.bin file:
The output in Tera Term: