Dariusz Makowski Department of Microelectronics and Computer - - PowerPoint PPT Presentation

dariusz makowski department of microelectronics and
SMART_READER_LITE
LIVE PREVIEW

Dariusz Makowski Department of Microelectronics and Computer - - PowerPoint PPT Presentation

Embedded Systems Dariusz Makowski Department of Microelectronics and Computer Science tel. 631 2720 dmakow@dmcs.pl http://fiona.dmcs.pl/es 1 Department of Microelectronics and Computer Science Embedded Systems Lecture Agenda Agenda


slide-1
SLIDE 1

Department of Microelectronics and Computer Science Embedded Systems

1

Dariusz Makowski Department of Microelectronics and Computer Science

  • tel. 631 2720

dmakow@dmcs.pl http://fiona.dmcs.pl/es

slide-2
SLIDE 2

Department of Microelectronics and Computer Science Embedded Systems

2 Lecture Lecture Agenda Agenda

Microprocessor Systems, Embedded Systems ARM Processors Family Peripheral Devices ARM Processor as Platform for Embedded Programs Methodology of Designing Embedded Systems Interfaces in Embedded Systems

slide-3
SLIDE 3

Department of Microelectronics and Computer Science Embedded Systems

3

Interfaces in Embedded Systems

slide-4
SLIDE 4

Department of Microelectronics and Computer Science Embedded Systems

4 Fundamental Fundamental Definitions Definitions Computer Memory

Electronic or mechanic device used for storing digital data or computer programs (operating system and applications).

Peripheral Device

Electronic device connected to processor via system bus or computer interface. External devices are used to realise dedicated functionality of the computer system. Internal devices are mainly used by processor and operating system.

Computer Bus

Electrical connection or subsystem that transfers data between computer components: processors, memories and peripheral devices. System bus is composed of dozens of multiple connections (Parallel Bus) or a few single serial channels (Serial Bus).

Interface

Electronic or optical device that allows to connect two or more devices. Interface can be parallel or serial.

slide-5
SLIDE 5

Department of Microelectronics and Computer Science Embedded Systems

5 Connectivity of Processor and Peripheral Devices Connectivity of Processor and Peripheral Devices Interfaces used in Embedded Systems: Parallel Interface PIO (usually 8, 16 or 32 bits), Serial interfaces:

Universal Serial Asynchronous Receiver-Transmitter (USART), Serial Peripheral Interface (SPI), Synchronous Serial Controller (SSC) I2C, Two-wire Interface (TWI), Controlled Area Network (CAN), Universal Serial Bus (USB), Ethernet 10/100 Mbits (1 Gbit), Debug/programming interface (EIA RS232, JTAG, SPI, DBGU).

slide-6
SLIDE 6

Department of Microelectronics and Computer Science Embedded Systems

6 Interfaces available in AT91SAM9263 Interfaces available in AT91SAM9263 Parallel Interface PIO (configurable 32 bits), Serial interfaces:

Debug interface (DBGU), Universal Serial Asynchronous Receiver-Transmitter (USART), Serial Peripheral Interface (SPI), Synchronous Serial Controller (SSC), I2C, Two-wire Interface (TWI), Controlled Area Network (CAN), Universal Serial Bus (USB, host, endpoint), Ethernet 10/100 Mbits, Programming interface (JTAG).

slide-7
SLIDE 7

Department of Microelectronics and Computer Science Embedded Systems

7

Universal Asynchronous Receiver/Transmitter Module

slide-8
SLIDE 8

Department of Microelectronics and Computer Science Embedded Systems

8 EIA RS232 Serial Interface EIA RS232 Serial Interface

slide-9
SLIDE 9

Department of Microelectronics and Computer Science Embedded Systems

9 UART Transceiver UART Transceiver

transmitter Receiver

TxD RxD

D0-D7 D0-D7 Clk Clk

Shift register

slide-10
SLIDE 10

Department of Microelectronics and Computer Science Embedded Systems

10 Data Frame of UART (1) Data Frame of UART (1)

Mark Space

slide-11
SLIDE 11

Department of Microelectronics and Computer Science Embedded Systems

11 Data Frame of UART (2) Data Frame of UART (2)

Send data: 0100.1011b = 0x4B

slide-12
SLIDE 12

Department of Microelectronics and Computer Science Embedded Systems

12 Synchronous vs asynchronous transmission Synchronous vs asynchronous transmission

Transmitter

Internal clock

Transmitter Receiver Receiver

Data Clock

Internal clock

Similar reference frequency

slide-13
SLIDE 13

Department of Microelectronics and Computer Science Embedded Systems

13 Electrical specification of EIA RS232c Electrical specification of EIA RS232c

slide-14
SLIDE 14

Department of Microelectronics and Computer Science Embedded Systems

14 Null-Modem Cabel EIA 232 Null-Modem Cabel EIA 232

slide-15
SLIDE 15

Department of Microelectronics and Computer Science Embedded Systems

15 Hardware Flow Control Hardware Flow Control

DTE Data Terminal Equipment – terminal, PC DCE - Data Circuit-terminating Equipment – Modem DSR - Data Set Ready - modem DTR - Data Terminal Ready – terminal RTS - Request to Send Data CTS - Clear to Send - ready to send data

Remarks Symbol Start transmission Line state Modem ready Circuit Request to send Ready to send Computer ready

slide-16
SLIDE 16

Department of Microelectronics and Computer Science Embedded Systems

16 Null-Modem Cabel EIA 232 with Hardware flow Control Null-Modem Cabel EIA 232 with Hardware flow Control

slide-17
SLIDE 17

Department of Microelectronics and Computer Science Embedded Systems

17 Voltage Levels of EIA RS232 Voltage Levels of EIA RS232

Processor output EIA RS 232

slide-18
SLIDE 18

Department of Microelectronics and Computer Science Embedded Systems

18 Voltage Levels Translator Voltage Levels Translator

MAX 232 (5 V) MAX 3232 (3,3 V)

slide-19
SLIDE 19

Department of Microelectronics and Computer Science Embedded Systems

19 Software for EIA RS232 communication Software for EIA RS232 communication Hyper terminal Minicom ssh Terminal

(http://www.elester-pkp.com.pl/index.php?id=92&lang=pl&zoom=0)

slide-20
SLIDE 20

Department of Microelectronics and Computer Science Embedded Systems

20

AT91SAM9263 – debug module DBGU

(chapter 30)

slide-21
SLIDE 21

Department of Microelectronics and Computer Science Embedded Systems

21 Serial interface as Diagnostic Tool Serial interface as Diagnostic Tool Features of DBGU port (DeBuG Unit):

Asynchronous data transmission compatible with RS232 standard (8 bits, single parity bit – can be switched off), Single system interrupt, shared with PIT, RTT, WDT,DMA, PMC, RSTC, MC, Frame correctness analysis, RxD buffer overflow signal, Diagnostic modes: external loopback, local loopback and echo, Maximum transmission baudrate 1 Mbit/s, Direct connectivity to debug module buildin ARM core (COMMRx/COMMTx).

slide-22
SLIDE 22

Department of Microelectronics and Computer Science Embedded Systems

22 Block diagram of DBGU transmission module Block diagram of DBGU transmission module

Interrupt signal Input-Output ports Serial Transceiver

slide-23
SLIDE 23

Department of Microelectronics and Computer Science Embedded Systems

23 Transmission speed Transmission speed Reference clock generator is responsible for Baud Rate . Baud rate can be calculated using formula: Baud Rate = MCK / (16 x CD), where CD Clock Divisor can be found in DBGU_BRGR register

slide-24
SLIDE 24

Department of Microelectronics and Computer Science Embedded Systems

24 Transmission errors Transmission errors

Receiver Buffer Overflow (BGU_RHR) Parity Error (PE) Frame Error (FE)

slide-25
SLIDE 25

Department of Microelectronics and Computer Science Embedded Systems

25 Configuration of DBGU transceiver Configuration of DBGU transceiver

static void Open_DBGU (void){

  • 1. Deactivate DBGU interrupts (register AT91C_BASE_DBGU->DBGU_IDR)
  • 2. Reset and turn off receiver (register AT91C_BASE_DBGU->DBGU_CR)
  • 3. Reset and turn off transmitter (register AT91C_BASE_DBGU->DBGU_CR)
  • 4. Configure RxD i TxD DBGU as input peripheral ports (registers AT91C_BASE_PIOC->PIO_ASR and

AT91C_BASE_PIOC->PIO_PDR)

  • 5. Configure throughput (e.g. 115200 kbps, register AT91C_BASE_DBGU->DBGU_BRGR)
  • 6. Configure operation mode (e.g. 8N1, register AT91C_BASE_DBGU->DBGU_MR, flags

AT91C_US_CHMODE_NORMAL, AT91C_US_PAR_NONE)

  • 7. Configure interrupts if used, e.g. Open_DBGU_INT()
  • 8. Turn on receiver (register AT91C_BASE_DBGU->DBGU_CR),
  • 9. Turn on transmitter if required (register AT91C_BASE_DBGU->DBGU_CR),

}

slide-26
SLIDE 26

Department of Microelectronics and Computer Science Embedded Systems

26 Read and write via DBGU port Read and write via DBGU port

Interrupts are disabled. void dbgu_print_ascii (const char *Buffer) { while ( data_are_in_buffer ) { while ( …TXRDY... ){}; /* wait intil Tx buffer busy – check TXRDY flag */ DBGU_THR = ... /* write a single char to Transmitter Holding Register */ } } void dbgu_read_ascii (const char *Buffer, unsigned int Size){ do { While ( ...RXRDY... ){}; /* wait until data available */ Buffer[...] = DBGU_RHR; /* read data from Receiver Holding Register */ } while ( …read_enough_data... ) }

slide-27
SLIDE 27

Department of Microelectronics and Computer Science Embedded Systems

27

AT91SAM9263 – USART

(rozdział 34)

slide-28
SLIDE 28

Department of Microelectronics and Computer Science Embedded Systems

28 Serial port USART Serial port USART

Features of Universal Synch. Asynch. Receiver-Transmitter:

Asynchronous or synchronous data transfer, Programmable frame length, parity, stop bits, Single system interrupt (shared with: PIT, RTT, WDT,DMA, PMC, RSTC, MC), Analysis of correctness of received frames, Buffer overflow error TxD or RxD, Elastic buffer – possibility of receiving frames with different length (uses additional counter), Diagnostic modes: external loopback, local loopback and echo, Maximum transmission speed 1 Mbit/s, Hardware flow control, Support for Multidrop transmission – data and address, Available Direct Memory Access channel, Support for RS485 differential transmission mode and infrared systems (build-in IrDA modulator-demodulator).

slide-29
SLIDE 29

Department of Microelectronics and Computer Science Embedded Systems

29 Block diagram of USART transceiver Block diagram of USART transceiver

slide-30
SLIDE 30

Department of Microelectronics and Computer Science Embedded Systems

30

Serial Peripheral Interface

slide-31
SLIDE 31

Department of Microelectronics and Computer Science Embedded Systems

31 Serial Peripheral Interface Serial Peripheral Interface Features of SPI: Serial synchronous transmission, Full duplex, master-slave or master-multi-slave transfers, High data transmission speed (>12 Mbit/s), Application: External peripheral devices (ADC, DAC, RTC, EEPROM, thermometers, etc...), Auxiliary control, e.g. CCD matrix with high speed parallel interface, SPI used for configuration, Memory cards, e.g. SD/SDHC/MMC.

slide-32
SLIDE 32

Department of Microelectronics and Computer Science Embedded Systems

32 Serial Peripheral Interface Serial Peripheral Interface

Master Output Slave Input Master Input Slave Output

Master Slave

CS

slide-33
SLIDE 33

Department of Microelectronics and Computer Science Embedded Systems

33 SPI Protocol SPI Protocol

Clock signal configuration: Clock polarisation: Negative CPOL = 0 (low level, 8 clock signals), Positive CPOL = 1 (high level, 8 clock signals), Clock phase: Zero clock phase (data sampled on first clock slope), Delayed clock phase (data sampled on second clock slope).

slide-34
SLIDE 34

Department of Microelectronics and Computer Science Embedded Systems

34 Thermometer with SPI Thermometer with SPI TMP 121: SOT 23-6 package, Maximum clock speed 15 MHz SPI-Compatible Interface Resolution: 12-Bit + Sign, 0,0625°C Accuracy: ±1.5°C for temp. −25°C - +85°C Current consumption in sleep mode: 50μA (max.) Power supply: 2,7V to 5,5V 3 mm

slide-35
SLIDE 35

Department of Microelectronics and Computer Science Embedded Systems

35 SPI Frame of TMP121 Thermometer SPI Frame of TMP121 Thermometer

slide-36
SLIDE 36

Department of Microelectronics and Computer Science Embedded Systems

36 SPI Module of ARM AT91SAM9263 processor (1) SPI Module of ARM AT91SAM9263 processor (1) Features of SPI: Support for Master or Slave mode, Receiver and transmitter buffers, Data transfers: from 8 to 16 bits, Four programmable outputs for SPI devices selection (max. 15 devices), Programmable delay between transfers, Programmable clock phase and polarity.

slide-37
SLIDE 37

Department of Microelectronics and Computer Science Embedded Systems

37 SPI Module of ARM AT91SAM9263 processor (2) SPI Module of ARM AT91SAM9263 processor (2)

slide-38
SLIDE 38

Department of Microelectronics and Computer Science Embedded Systems

38 SPI Module of ARM AT91SAM9263 processor (3) SPI Module of ARM AT91SAM9263 processor (3)

slide-39
SLIDE 39

Department of Microelectronics and Computer Science Embedded Systems

39 Exam Dates Exam Dates Exam #1 – 15.01.2018 8.15-12.15 Exam #2 – 19.01.2018 8.15-12.15 Exam #3 – 12.02.2018 8.15-12.15 No lecture 22.01.2018

slide-40
SLIDE 40

Department of Microelectronics and Computer Science Embedded Systems

40

I2C Bus Standard

slide-41
SLIDE 41

Department of Microelectronics and Computer Science Embedded Systems

41 I2C Bus I2C Bus

  • Standard developed by Philips company on early 80s,
  • Two wire synchronous interface (SDA – data line, SCL – clock line),
  • Bidirectional master-slave (multi-master) transfers, 8-bit frames,
  • Transmission speed:
  • 100 kbps (standard mode),
  • 400 kbps (fast mode),
  • 3,4 Mbps (high-speed mode),
  • 7-bit or 10-bits device address,
  • Synchronisation allows to use devices with different speeds (autonegotiation),
  • Number of devices connected to I2C bus limited by bus capacitance (C=400 pF),
  • Arbitration used for multi-master transmission.
slide-42
SLIDE 42

Department of Microelectronics and Computer Science Embedded Systems

42 Application of I2C Bus Application of I2C Bus

I²C standard is applied to various digital and analogue devices: PCF8563/8583 – clock, calendar, alarm, timer and NVRAM, PCF8574 – 8-bit IO expander, PCF8576, PCF8577 – LCD controllers, PCF8582 - EEPROM memory, 256 bajts (1, 2, 4 kB, ... MB), PCF8591 - 8-bit, 4-channels ADC/DAC converter.

slide-43
SLIDE 43

Department of Microelectronics and Computer Science Embedded Systems

43 I2C Bus Signals I2C Bus Signals

Master device – initialize transmission, generates clock signal Slave device – analyse signals on bus, read address and data

slide-44
SLIDE 44

Department of Microelectronics and Computer Science Embedded Systems

44 Transmission Start and Stop Transmission Start and Stop

Transmission start – START signal (falling slope on SDA, change from “1” to “0”, during valid clock signal, SCL = ”1”). Signal generated by Master. Transmission end – STOP (rising edge on SDA bus, change from “0” to “1” during valid clock signal, SCL = ”1”). Signal generated by Master.

slide-45
SLIDE 45

Department of Microelectronics and Computer Science Embedded Systems

45 I2C Protocol I2C Protocol

A) Transmission initialised by Master, START condition. B) Transmission of 8 bits (7 address bits, 1 R/W bit). C) After 8 bit (clk signals) SDA bus is controlled by Slave (9th clk). Acknowledge is generated to confirm address receive ACK = '0' or not (ACK = “1”). E) Data read or write phase – Master or Slave sends 8 data bits. F) Transmission is finished when ACK signal is generated by data receiver (Master or Slave). Master generates Stop condition.

slide-46
SLIDE 46

Department of Microelectronics and Computer Science Embedded Systems

46 I2C – Read or Write I2C – Read or Write

7-bit 7-bit

Master write n-bytes of data Master reads n-bytes of data

slide-47
SLIDE 47

Department of Microelectronics and Computer Science Embedded Systems

47 Two-Wire Interface – standard compatible with I2C ? Two-Wire Interface – standard compatible with I2C ?

ARM processors are equipped with TWI interface compatible with developed by Philips I2C (I2C interface was patented by Philips).

Features of TWI interface:

Compatible with I2C, Master, Multimaster or Slave modes, IO voltage equal to 3,3 V, Maximum transmission speed: 400 kHz, Transfers triggered with interrupts, Automatically Slave mode activated when collision detected on I2C bus (Arbitration-lost interrupt), Interrupt triggered when I2C slave address recognised, Automatic bus busy recognition, Support for 7 and 10-bits addresses.

slide-48
SLIDE 48

Department of Microelectronics and Computer Science Embedded Systems

48 Block diagram of TWI module Block diagram of TWI module

slide-49
SLIDE 49

Department of Microelectronics and Computer Science Embedded Systems

49 Real Time Clock Real Time Clock

Features of DS1629:

Real Time Clock,

Build-in thermometer -55 – 125 C, Thermometer resolution: 9 bits, Thermometer accuracy +/- 2 C, Thermostat mode, 32 bytes of SRAM, Power Supply 2,2 – 5,5 V, Interface compatible with I2C (400 kHz).

slide-50
SLIDE 50

Department of Microelectronics and Computer Science Embedded Systems

50 Real Time Clock Real Time Clock

slide-51
SLIDE 51

Department of Microelectronics and Computer Science Embedded Systems

51 Real Time Clock – I2C Transmission Real Time Clock – I2C Transmission

slide-52
SLIDE 52

Department of Microelectronics and Computer Science Embedded Systems

52 Serial Interfaces - comparison Serial Interfaces - comparison

EIA RS232 I2C SPI

1 kbps 10 kbps 100 kbps 1 Mbps 10 Mbps 100 Mbps 1 cm 10 cm 1 m 10 m 100 m

slide-53
SLIDE 53

Department of Microelectronics and Computer Science Embedded Systems

53

Universal Serial Bus

slide-54
SLIDE 54

Department of Microelectronics and Computer Science Embedded Systems

54 Universal Serial Bus Universal Serial Bus

slide-55
SLIDE 55

Department of Microelectronics and Computer Science Embedded Systems

55 Features of USB Features of USB

Asynchronous, serial, differential data transmission, Automatic recognition of connected/disconnected devices, automatic configuration, Single, standardized connector, Up to 127 devices on single bus, Automatic detection and errors correction, Transmission speed: LOW 1.5 Mb/s, specification USB >1.1, FULL 12 Mb/s, specification USB >1.1, HIGH 480 Mb/s, specification USB 2.0, Specification USB 3.0 => 5 Gb/s.

slide-56
SLIDE 56

Department of Microelectronics and Computer Science Embedded Systems

56 Data layers of USB Data layers of USB

USB is designed as a star bus. USB model is composed of three layers: Physial layer, Logical layer, Functional layer.

Data pipe Control pipe Signal wires USB interface USB interface Application USB driver Logical device Device function

slide-57
SLIDE 57

Department of Microelectronics and Computer Science Embedded Systems

57 Data flow in USB Data flow in USB

Virtual channels (Pipes) Control channel (EP0) Data channels EP1 – EP30 (End Points)

slide-58
SLIDE 58

Department of Microelectronics and Computer Science Embedded Systems

58 Physical Layer Physical Layer

USB “A” and “B” type Mini USB Differential transmission, half-duplex. Included power supply bus 5 V/500 mA

slide-59
SLIDE 59

Department of Microelectronics and Computer Science Embedded Systems

59 USB Frame USB Frame

slide-60
SLIDE 60

Department of Microelectronics and Computer Science Embedded Systems

60 Available Transfer Modes Available Transfer Modes

slide-61
SLIDE 61

Department of Microelectronics and Computer Science Embedded Systems

61 Bulk and Interrupt Transfer Bulk and Interrupt Transfer

slide-62
SLIDE 62

Department of Microelectronics and Computer Science Embedded Systems

62 Isochronous Transfer Isochronous Transfer

slide-63
SLIDE 63

Department of Microelectronics and Computer Science Embedded Systems

63 Control Transfer Control Transfer

slide-64
SLIDE 64

Department of Microelectronics and Computer Science Embedded Systems

64 Configuration Configuration

Enumeration – configuration of devices connected to USB bus after connection to disconnection of devices from bus. Enumeration is performed by Master node (address 0). Master assigned individual address to devices connected to USB and configures basic parameters: Device address in USB area, Transfer mode, Transfer direction (read, write, read-write), Size of data packet, Transmission speed, Allocates buffers for virtual channels, Allocated power for connected devices.

slide-65
SLIDE 65

Department of Microelectronics and Computer Science Embedded Systems

65 USB Hubs USB Hubs

slide-66
SLIDE 66

Department of Microelectronics and Computer Science Embedded Systems

66 USB to I2C converter USB to I2C converter

slide-67
SLIDE 67

Department of Microelectronics and Computer Science Embedded Systems

67 Universal converter Universal converter RS 232, parallel, SPI, CAN to USB

slide-68
SLIDE 68

Department of Microelectronics and Computer Science Embedded Systems

68 USB and ColdFire processors USB and ColdFire processors

Low\Full speed:

MCF 527X (72-75) 66 – 166 MHz MCF 5221X (72-75) 80 MHz MCF 5222X (72-75) 80 MHz MCF 527X (72-73) 240 MHz 68HCS08JW32 8 MHz

High Speed:

MCF 547X (72-75) 200 –266 MHz MCF 548X (82-85) 166 – 200 MHz MCF 537X (77-79) 240 Mhz MCF 5253 140 MHz

slide-69
SLIDE 69

Department of Microelectronics and Computer Science Embedded Systems

69 Motorola 68HC908JW32 Motorola 68HC908JW32

Features of USB module of HC908: Interface compatible with USB 2.0 full speed, 12 Mbps data rate, Build-in 3.3 V regulator, Endpoint 0 with 8-bytes Tx/Rx buffers 64 bytes buffer for endpoints 1-4.

slide-70
SLIDE 70

Department of Microelectronics and Computer Science Embedded Systems

70 Cypress Processor with USB CY7C68013A Cypress Processor with USB CY7C68013A Features of CY7C68013:

Compatible with USB 2.0–USB-IF high speed, Based on 8051 core, Integrated 16 kB RAM (SRAM) Memory can be loaded from USB, Memory can be loaded from external EEPROM. Four programmable endpoints (BULK/INTERRUPT/ISOCHRONOUS) Additional 64 bytes endpoint (BULK/INTERRUPT), Parallel 8- or 16-bits external interface, DMA channel, GPIF (General Programmable Interface)

slide-71
SLIDE 71

Department of Microelectronics and Computer Science Embedded Systems

71 Cypress CY7C68013A processor Cypress CY7C68013A processor

slide-72
SLIDE 72

Department of Microelectronics and Computer Science Embedded Systems

72

slide-73
SLIDE 73

Department of Microelectronics and Computer Science Embedded Systems

73 USB 3.0 USB 3.0 Serial high speed, full-duplex interface Data transmission speed: 5 Gb/s (10 more than USB 2.0) Compatible with USB 2.0 (drivers and connector), however significantly differ from USB 2.0 Two channels for full-duplex, power supply Intelligent power supply control, lower power consumption Physical and data layers similar to PCI express 2.0

slide-74
SLIDE 74

Department of Microelectronics and Computer Science Embedded Systems

74 Physical Layer of USB 3.0 Physical Layer of USB 3.0