Hardware Software Co-Design and Program Modeling: Dr. Prashant Kharote
Hardware Software Co-Design and Program Modeling: Dr. Prashant Kharote
Hardware Software Co-Design and Program Modeling: Dr. Prashant Kharote
Program Modeling
Prepared By
Dr. Prashant Kharote
Unit 2
Introduction
❖ Simplex
❖ Duplex
❖ Half Duplex
❖ Full Duplex
Serial Transmission Formats
❖ Asynchronous
➢ It is a character-oriented data transfer.
➢ In this serial communication, one data byte is transferred serially at a time.
➢ Asynchronous serial communication can be used for debugging, servicing or
analyzing the system.
❖ Synchronous
❖ It is block or packet of data-oriented data transfer.
❖ The block of data bytes are transferred serially.
Baud rate
❖ In serial communication, one bit is transmitted at a time.
❖ Therefore, how long the bit stays on or off is determined by the speed at which
bits are transmitted.
❖ Baud rate is defined as number of signal changes per second i.e. the rate at
which bits are transmitted - bit/second.
Parameter Value
Speed 20 k Baud
Distance 50 ft
Logic 0 + 3v to + 25
Logic 1 - 3v to – 25
Receiver input voltage +15 V or – 15 V
RS – 232 Connector
RS 232 Standard
What is RS-232
❖ RS-232 is a popular communications interface for connecting modems and
data acquisition devices (i.e. GPS receivers, electronic balances, data loggers) to
computers.
❖RS-232 can be plugged straight into the computer’s serial port (know as COM
or Comm port).
RS-232
❖ The longer the cable and the slower the speed at which you can obtain
accurate results.
❖ A large wire capacitance and inductance limits the maximum length of the
cable and/or the maximum speed 50 feet (15m) @ max baud rate is commonly
quoted as the maximum distance.
Flow Control
❖ If one of the device sends data at a very fast rate and other device cannot
absorb the data rate, flow control is used.
❖ RS 232 has signals (handshake signals) that can be used for flow control.
Signals of RS-232 connector
1. DTR (Data Terminal Ready)
➢ The DTE alerts the DCE for data communication by sending this signal.
➢ In response to this signal, the DCE prepares itself for the communication.
➢ Each specific I/O synchronous serial device may be connected to other using specific
interfaces, for example, with I/O device using I2C controller.
➢ I2C Bus communication− use of I2C bus simplifies the number of connections and provides
a common way (protocol) of connecting different or same type of I/O devices using
synchronous serial communication.
What is I2C used for?
➢ Data transfer between ICs and systems at relatively low rates
▪ “Classic” I2C is rated to 100K bits/second
▪ “Fast Mode” devices support up to 400K bits/second
▪ A “High Speed Mode” is defined for operation up to 3.4M bits/second
➢ Slave:
▪ Responds only when addressed
▪ Timing is controlled by the clock line
IO I2C Bus
➢ Any device that is compatible with a I2C bus can be added to the system (assuming an
appropriate device driver program is available), and a I2C device can be integrated into
any system that uses that I2C bus.
I2C Details
❖ Originally developed at Philips Semiconductors.
❖ Synchronous Serial Communication 400 kbps up to 2 m and 100 kbps for longer distances.
➢ The device must be able to sense the logic level on these pins.
➢ The serial clock and data lines are connected to Vdd (typically +5V) through pull up resistors
➢ In normal data transfer, the data line only changes state when the clock is low
SDA
SCL
Data line stable; Change
Data valid of data
allowed
Start and Stop Conditions
➢A transition of the data line while the clock line is high is defined as either a
start or a stop condition.
➢Both start and stop conditions are generated by the bus master
➢The bus is considered busy after a start condition, until a stop condition occurs
SDA SDA
SCL SCL
Start Stop
Condition Condition
I2C Addressing
➢ Each node has a unique 7 (or 10) bit address
MSB LSB
R / Wr
R/Wr
0 – Slave written to by Master
1 – Slave read by Master
➢ Slaves can be
▪ Receiver only
▪ Receiver and transmitter
I2C Masters and Slaves Bus Connections
➢ Master device
– controls the SCL
– starts and stops data transfer
– controls addressing of other devices
➢ Slave device
– device addressed by master
➢ Transmitter/Receiver
– master or slave
– master-transmitter sends data to slave-receiver
– master-receiver requires data from slave transmitter
Data Transfer on the I2C Bus
➢ Start Condition
➢ Slave address + R/W
▪ Slave acknowledges with ACK
➢ All data bytes
▪ Each followed by ACK
➢ Stop Condition
Data Formats
➢Master writing to a Slave
A A A
Data Formats Cont’d.
1
Disadvantage of I2C bus
➢ Certain ICs support the protocol and certain do not.
➢ Open collector drivers at the master need a pull-up resistance of 2.2 K on each
line.
CAN (Controller Area Network)
❖ A CAN is an asynchronous serial bus network that connects devices, sensors and actuators
in a system or sub-system for control applications.
❖ Multi-master communication protocol.
❖ First developed by Robert Bosch in 1986.
❖ Compact
• Twisted Pair Bus line.
❖ Highest Baud Rate is 1Mbps.
❖ Robust in noisy environments.
❖ CAN uses a message-oriented transmission protocol.
❖ There are no defined addresses, just defined messages.
❖ It is present in both physical and data link layer of OSI layers.
CAN (Controller Area Network)
❖ It was designed for automotive applications needing data rates of up to 1 Mbps and high
levels of embedded communication system for microcontrollers, as well as a standard
communication network for industrial control system.
❖ CAN provides two communication services: the sending of a message (data frame
transmission) and the requesting of a message (remote transmission request, RTR).
Before CAN
After CAN
What are some real-world applications of CAN?
– Controller Area Networks are used in many different fields, the bulk of which are
• Auto-motive industry
• Factory Automation
• Machine Control
• Medical Equipment and devices
• And more….
CAN – Protocol
❖ The CAN protocol is an international standard defined in the ISO 11898.
❖ Beside the CAN protocol itself the conformance test for the CAN protocol is defined in
the ISO 16845, which guarantees the interchangeability of the CAN chips.
❖ Identifier – 11 bit identifier set the priority of message. (The lower the binary value, the
higher is the priority.)
❖ RTR - remote transmission request. (dominant when information is required from another
node).
Standard CAN message
❖ IDE – A dominant single identifier extension (IDE) (standard CAN identifier with no
extension is being transmitted).
❖ DLC – The 4 bit data length code specify the number of bytes of data being transmitted.+
Standard CAN message
❖ Data – This field is used for application data. Data size may be upto 64 bits.
❖ CRC – The 16 bit cyclic redundancy check contains the check sum of the preceding
application data for error detection.
Standard CAN message
❖ EOF – End of frame is 7 bit field marks the end of CAN frame.
❖ IFS – 7-bit inter-frame space (IFS) contains the time required by the controller to move a
correctly received frame to its proper position in a message buffer area.
Extended CAN message
❖ SRR – The substitute remote request (SRR) bit replaces the RTR bit in the standard
message location as a placeholder in the extended format.
Extended CAN message
❖ IDE – The recessive bit in the identifier (IDE) indicates that more identifier bits
follow.
❖ E2PROM
❖ RAM
▪ The low rate (LR) wireless personal access network (WPAN) (IEEE 802.15.4/LRWPAN)
▪ It is intended to serve a set of industrial, residential, and medical applications with very low
power consumption, low cost requirement, and relaxed needs for data rate and QoS.
▪ The low data rate enables the LR-WPAN to consume little power.
▪ The IEEE 802.15.4 committee and ZigBee Alliance worked together and developed the
technology commercially known as ZigBee.
▪ It is expected to provide low-cost and low-power connectivity for devices that need battery
life as long as several months to several years but does not require data transfer rates as high
as those enabled by Bluetooth.
ZigBee Technology
▪ ZigBee can be implemented in mesh (peer- to-peer) networks larger than is possible
with Bluetooth
▪ It operate in the unlicensed RF worldwide (2.4 GHz global, 915 MHz America, or
868 MHz Europe) bands.
▪ The data rate is 250 kbps at 2.4 GHz, 40 kbps at 915 MHz, and 20 kbps at 868 MHz.
❖ End devices
➢ Connects one Zigbee network with another or connects to WLAN or cellular network.
❖ Coordinator
➢ Transceiver of data.
NETWORK DEVICES
IEEE
802.15.4 Zigbee
device device roles
roles
FFD RFD
❖ It needs lesser memory than the ZigBee coordinator node, and entails lesser
manufacturing costs.
❖ Requiring even less memory, (no flash, very little ROM and RAM), an RFD will thus be
cheaper than an FFD.
❖ This device talks only to a network coordinator and can be implemented very simply in
star topology.
DATA TRANSFER MODELS
Peer to peer
Star
mesh
Where to use ZigBee?
❖ Building Automation
❖ Remote Control
❖ Smart homes
❖ Easy-to-use touchpads
• Behavioural Things
• A behavioral thing consists of the dynamic parts of UML models. Following are the behavioral things
• Interaction − Interaction is defined as a behavior that consists of a group of messages exchanged
among elements to accomplish a specific task.
• State machine − It defines the sequence of states an object goes through in response to events.
• Events are external factors responsible for state change.
Grouping Things:
• It can be defined as a mechanism to group elements of a UML model together.
• There is only one grouping thing available −
• Package − Package is the only one grouping thing available for gathering
structural and behavioral things.
Structural Things
• Structural things define the static part of the model.
• They represent the physical and conceptual elements.
• Following are the brief descriptions of the structural things
• Class − Class represents a set of objects having similar responsibilities.
• Interface − Interface defines a set of operations, which specify the responsibility
of a class.
• Collaboration −Collaboration defines an interaction between elements.
• Use case −Use case represents a set of actions performed by a system for a
specific goal.
• Component −Component describes the physical part of a system.
• Node − A node can be defined as a physical element that exists at run time.
Annotational Things
• It can be defined as a mechanism to capture remarks, descriptions, and comments of UML
model elements.
• Note - It is the only one Annotational thing available. A note is used to render comments,
constraints, etc. of an UML element.
Relationship
• It is another most important building block of UML.
• It shows how the elements are associated with each other and this association describes the functionality of an application.
• There are four kinds of relationships available.
1. Dependency 3.Generalization
2. Association 4.Relization
• Dependency :
• Dependency is a relationship between two things in which change in one element also affects the other.
• Association :
• Association is basically a set of links that connects the elements of a UML model.
• It also describes how many objects are taking part in that relationship.
• Generalization :
• Generalization can be defined as a relationship which connects a specialized element with a generalized element.
• It basically describes the inheritance relationship in the real world of objects.
• Realization
• Realization can be defined as a relationship in which two elements are connected.
• One element describes some responsibility, which is not implemented and the other one implements them.
• This relationship exists in case of interfaces
UML Diagrams
• All the elements, relationships are used to make a complete UML diagram and the
diagram represents a system.
• The visual effect of the UML diagram is the most important part of the entire
process.
• All the other elements are used to make it complete.
• 1.Class diagram
• 2. Object diagram
• 3. Deployment diagram
• 4.Package diagram
• 5. Component diagram
Behavioural Diagrams (Dynamic)
• UML has the following five types of behavioral diagrams −
• Use case diagram
• Sequence diagram
• Collaboration diagram
• Statechart diagram
• Activity diagram