bus systems and communications - biomedical engineering

32
2017-11-09 1 Bus systems and communications CHRISTIAN ANTFOLK Announcement Assignment 1 Hand in on Sunday 12th November at 23:59! Project presentations will be here in E:1328 on 12.12.2017 between 10-12 More on projects at the end of the lecture Sign-up lists for the labs are now on the bulletin board

Upload: others

Post on 09-Feb-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

2017-11-09

1

Bus systems and communicationsCHRISTIAN ANTFOLK

Announcement

• Assignment 1 Hand in on Sunday 12th November at 23:59!

• Project presentations will be here in E:1328 on 12.12.2017 between 10-12

• More on projects at the end of the lecture

• Sign-up lists for the labs are now on the bulletin board

2017-11-09

2

Structure of a measurement system

• pressure

• temperature

• speed

• angular velocity

• luminosity

• force

Physicalquantity

Measurementsystem

Presentation(and control)

• Signal conditioning

• DAQ-cards

• Bus control of instruments• GPIB (parallel)

• RS232 (serial)

• Bus systems with integrated and standardized instruments• VXI/PXI

• Real time controllers

• Field buses

• Graphical programming• LabVIEW

• Agilent VEE

• DASYlab

• Textual programming• LabWindows CVI

• Measurement Studio

• Visual Basic

• Visual C/C++

• Matlab

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Measurement system

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

3

What is a computer bus?

• A collection of wires which transfer digital data according to a specific protocol between separate units.

• There are several standards to allow seamless connectivity of instruments from a number of different vendors.

• E. g. PCI, USB, GPIB, Firewire, SATA, Ethernet, etc

• E. g. of entire systems with specific computer buses incorporated in each unit are fieldbuses, VXI-systems, PXI-systems, real-time controllers etc.

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

General Purpose Interface Bus

• Introduced by HP 1965 (HP-IB)

• 1 MB/s

• Requires special cables and och plug-in cards

• Max 20 m total cable length and 15 instruments

• Still very much used for instrument control in both industry and research environments, probably due to the rugged connectors

• IEEE-488 / IEEE-488.2

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

4

General Purpose Interface Bus

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

GPIB-busGPIB-instrumentoch controller

Software control

Generalizerad instrument control

IEEE-488

IEEE-488.2

SCPI

VISA

Formalized the mechanical, electrical, and basic protocol parameters of GPIB.

Basic syntax and format conventions, device-independent commands, data structures, error protocols.

Standards for syntax and command for control ofinstruments.

Makes it possible to programs independent of hardware interface (GPIB, serial, VXI…)

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

General Purpose Interface Bus

2017-11-09

5

Connecting GPIB units

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Star

Daisy chain

GPIB system

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

• Three types of instruments (Controller, Talker , Listener)

• 31 primary addresses (Talker resp. Listener)

• 8 bit parallel data transfer

• Max. 2 m cable per instrument connected to the bus

• Negative true logic

2017-11-09

6

GPIB system

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Handshake & Bus management lines• Handshake

– DAV - Data Valid – used by the Talker to indicate that the eight data lines are settled and valid

– NRFD - Not Ready For Data – used by receiving unit (Listener)

– NDAC – Not Data Accepted - used by receiving unit (Listener)

• Bus management

– ATN - Attention – used by the controller

– IFC - Interface Clear - used by the controller, resets all connected units

– REN - Remote Enable - used by the controller, puts units in a remotely controlled state

– EOI - End Or Identify - used by the talker or the controllers. Talker : indicates the end of a message. Controller : start a parallell poll.

– SRQ - Service Request - used by the talkers to notify the controller that somethig is wrong

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

7

Two types of commands

• ATN is true (= low level = 0) – bus commands can be sent

– E.g. put unit in Listener mode

• ATN is false (= high level = 1) – data is sent to and from units through the DIO 1-8 lines

– The data can be instrument commands or measurementdata

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Handshaking protocol

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

0

1

2

4

5

6

73

2017-11-09

8

Handshaking protocol

• By transferring data in this way the data is placed onto the bus at a rate which is suitable for the talker, and it is held until the slowest listener has accepted it. In this way the optimum data transfer rate is always used, and there are no specifications and interface problems associated with the speeds at which data must be transferred.

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Bus commands

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

9

Example of instrument control over GPIB

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Mätdator : talaradress U / lyssnaradress 5Spänningsaggr: lyssnaradress 3Voltmeter: talaradress Q / lyssnaradress 1

Example of instrument control over GPIB continued

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Mätdator : talaradress U / lyssnaradress 5Spänningsaggr: lyssnaradress 3Voltmeter: talaradress Q / lyssnaradress 1

2017-11-09

10

Example in LabVIEW

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Errors

• What is an error?

– An unknown command is sent

– Overflow (measurement out of range)

• What happens?

– The instrument activates the SRQ control line

– The instrument puts bits in the its status register

• What if you want the controller to handle the error?

– Poll

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

11

Polling

• Serial polling

– The controller addresses the units sequentially and theyreply by sending back a status byte

• Parallel polling

– Each instrument is assigned one of the eight data lines. When the controller activated EOI (with ATN line set totrue) the instrument(s) which generated a SRQ assertsits line.

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Bus commands IEEE 488.1

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Universal commands - unaddressed

LLO - Local Lock Out – Turns off the instruments front panelDCL - Device Clear – Resets all units on the busPPU - Parallell Poll Unconfigure – Turns off the parallel poll function in units with that functionSPE - Serial Poll Enable – Activates serial poll function in units with that functionSPD - Serial Poll Disable – Turns off serial poll function in units with that function

UNL - Unlisten - Recalls all Listeners on the busUNT - Untalk – Recalls all Talkers on the bus

Addressed commands

GET - Group Execute Trigger – Eg. starts a measurement in an instrumentSDC - Selected Device Clear – Resets a specific deviceGTL - Go To Local – Activates front panel on a specific devicePPC - Parallell Poll Configure – Prepares a listener for configuring of parallel pollTCT - Take Control – Gives control to a specific device, device needs to have controller capability

2017-11-09

12

Serial buses

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Standards for serial communication

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

• RS-232

– Unbalanced (one ground wire + one active wire)

– Point-to-point

– Up to 19,2 kbit/s at 15 m cable

• RS-422

– Balanced (both wires are active but in opposite phase)

– Point-to-point

– Up to 2 Mbit/s

• RS-485

– Balanced (both wires are active but in opposite phase)

– Multiple units are connected in parallel, however the communication is serial (Multidrop)

– Up to 10 Mbit/s

• USB, FireWire, Ethernet, SPI, I2C

2017-11-09

13

Comparison RS232 – RS422

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Tx

GNDRS232

Tx-

Tx+

RS422/RS485

0

1

Differential signalling

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

14

SPI

• Serial Peripheral Interface

• Typical serial communicationbetween a AD converter and microcontroller

• ”Hardware” addressing

• De facto standard

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

I2C

• Inter-Integrated Circuit

• 7 or 10 bit addressing

• Device need unique address

• Speeds up to 5 Mbit/s

• Typical 100 – 400 kbit/s

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

15

Serial communication

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

• USB, FireWire, Ethernet

– 5 m cable for USB,

– 5 Gbit/s (USB 3),

• FireWire

– 72 m cable

– 3.2 Gbit/s

• Ethernet

– 72 m cable

– 10 Gbit/s

• SATA 3

– 8 m cable

– Up to 6 Gbit/s

– Designed to send data quickly to harddrives

Drawbacks

• From an industrial perspective

– No (standard) secure locking mechanism on the connector

– Cables (usually) not specified for (heavy) industrial use

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

16

Connectors on a instrument

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Universal Serial Bus - USB• Host controlled (computer controls how

connected units communicates)

• A host can address up to 127 units

• 1,5, 12 and 480 Mbit/s

• Available on most (if not all) modern computers

Lund University | Faculty of Egineering | Dept. of Biomedical Engineering

A

B

2017-11-09

17

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Example of a USB based system

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Example of a USB based system

2017-11-09

18

USB – Data transmission1. The USB-unit is connected

2. Host/Controller gives the unit an address

3. A ”reset” command is sent to the unit

4. The data transfer speed of the unit is checked

– Low speed = 1.5 Mbit/s

– Full speed = 12 Mbit/s

– High speed = 480 Mbit/s (USB 2)

– SuperSpeed = 5 Gbit/s (USB 3)

– SuperSpeed+ = 10 Gbit/s (USB3.1)

5. The different ”endpoints” of the unit is checked, how much power it uses etc. (”pipes”)

6. The internal clock of the unit is synchronized to the host

7. ”Token packets” are sent before the command/data packets are sent

8. Data packets are always followed by handshake packets

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

USB data transfers

• Message pipe: short simple commands

• Stream pipe:

– Interrupt - A device like a mouse or a keyboard, which will be sending very little data, would choose the interrupt mode.

– Bulk - A device like a printer, which receives data in one big packet, uses the bulk transfer mode. A block of data is sent to the printer (in 64-byte chunks) and verified to make sure it's correct.

– Isochronous - A streaming device (such as speakers) uses the isochronous mode. Data streams between the device and the host in real-time, and there is no error correction

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

19

USB – Data Transmission

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

• Token packet

• Data packet (optional)

• Handshake packet

USB – Data transmission

• Packet IDs

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Enumeration : a ”host” give a ”device” an address 1-127, the device sens a device descriptor

2017-11-09

20

FireWire – IEEE 1394

• Daisy chain topology

• Support peer-to-peer (no controller needed)

• Up to 63 devices

• Bitrate : 400-3200 Mbit/s (FireWire 400 - S3200)

• Many computers do not have FireWire

– License fee

– Complexity of devices = less devices on the market

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

LAN & LXI (LAN eXtension for Instrumentation

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

21

Rackinstruments – VXI & PXI

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

VXI – VMEbus eXtensions for Instrumentation

• Faster & more compact thanGPIB (160 MB/s)

• Open standard (1987). Backed by more than 250 manufacturers

• Can use MXI (Multisystem eXtension Interface) or GPIB iftraditional instrument are alsoused in the same setup

• FireWire (IEEE-1394), USB, LAN etc

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

22

The PCI bus in a PC

• The PCI-bus, 32 bits, 133 MB/s, 33 MHz

• ”Peripheral Component Interconnect”

• The PCI-e bus, ”PCI-express”, 64 bits, 256 MB/s per line (total of 20 lines), 2 GHz

• Full duplex = to send and receive data at the same time => 512 MB/s

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

PXI – PCI eXtensions for Instrumentation

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

23

PXI – PCI eXtensions for Instrumentation

• PCMCIA/PC card/PC express card to laptop

• MXI-buss to stationary PC

• Between two PXI system

• Fastest with an embeddedcontroller

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

PXI Express

• Bandwidth > 6 Gbyte/s

• Vectorsignalgenerators (up to 6,6 GHz)

• Vectorsignalanalyzer

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

24

Fieldbuses

• Used to interconnect automation devices in a network

• Heavily used in industry

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Fieldbuses

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

25

Fieldbuses

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Examples of Fieldbuses• FIP (Factory Information Protocol)

• Three transmission speeds : 31.25 kbit/s, 1 Mbit/s, 2.5 Mbit/s• Max 255 units per segment• The ”bus arbitrator” sends an address and the• corresponding device answers by outputting a value

• Profibus• RS-485 or optical• Max 122 units• 500 kbit/s• ”Token bus”: the active units pass around a token,• passive units only listen

• CAN-bus (Controller Area Network)• Developed by Bosch for vehicles• Max 1 Mbit/s at 40 meter• Bus organization: no superior node, messages lack address – each node

is programmed to receive a message of a specific typeLund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

26

The CAN bus in cars

• The expenses for the electronic circuitry in today’s cars can be up to a fourth of the construction costs

• Advanced cars: up to 4 km cable…

• Weight and power consumption effect the gasoline/diesel consumption

• Cars of today have a number of different buses of different data transmission rates

– < 125 kbit/s - comfort (seats, windows, AC etc)

– < 1 Mbit/s more real time demanding functions like ABS and cruise control

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Computer buses in cars

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

27

Why use fieldbuses

• Distributed intelligence gives:

• Less cabling, especially over long distances

• Measurement cells can be made self calibrating or be calibrated remotely through the bus

• Self diagnostic systems

• Flexible system when transducer units are exchanged

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Buses

• Local

• Regional

• National

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

28

Local bus

• SPI

• I2C

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Regional bus

• USB

• GPIB

• PXI

• etc

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

29

National bus

• Ethernet

• Fieldbus

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Comparisons

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

30

Comparison

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Projects 2017

• Project:

– Build a measurement system (room E:1309B)

– Choose project week 3 of the course

– Short project description and suggested approach to solution Monday 26.11.2017

– Short oral presentation Tuesday 12.12.2017 + written report

– Report hand-in Friday 15.12.2017

– 2-3 students per group

• Gear : PC with LabVIEW and Matlab

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

31

Example projects• LabVIEW GUI for Siglent Spectrum Analyzer (BME /

Johan Nilsson)

• Make a LabVIEW application for the “practical test” (BME / Various)

• Real-time control of a virtual hand using the MyoArmband (BME / Christian Antfolk)

• LabVIEW communication with the BLE Nano Platform (BME / Nebojsa Malesevic)

• Full list on webpage

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

Projects 2017

• All project groups will give a ~15 minutes long oral presentation of their projects on Tuesday the 12th of December, 2017. The project presentations are scheduled to be at 10-12 in E:1328.

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering

2017-11-09

32

Projects 2017• The report should contain:

– Title of the project and name of the authors

– Summary

– Definition of the task

– Description of all measurement equipment used in the project

– Method: Data acquisition method, flowchart, etc.

– Results and discussion: Analysis of the results and comments on how the results couple to the project plan

– Program documentation (commented LabVIEW code etc)

– References

• Also send an electronic version of your working and commented “code”. Send the files (report + LabVIEW code) to [email protected] and [email protected].

Lund University | Faculty of Engineering | Dept. of Biomedical Engineering