1 / 103

2012 TS Academy DC – Serial Communication

2012 TS Academy DC – Serial Communication. Prepared by: Thomas Cheng Date: 31-09-2012. Who am I?. 鄭智仁 Thomas Cheng Member of technical service team in DC (8.5Y) Biking, hiking, & running Extension No.1154. Serial Communication. Why Serial Serial Introduction RS-232, RS-422/485

tivona
Télécharger la présentation

2012 TS Academy DC – Serial Communication

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 2012 TS AcademyDC – Serial Communication Prepared by: Thomas Cheng Date: 31-09-2012

  2. WhoamI? • 鄭智仁 Thomas Cheng • Member of technical service team in DC (8.5Y) • Biking, hiking, & running • Extension No.1154 Confidential

  3. SerialCommunication WhySerial Serial Introduction RS-232, RS-422/485 The Others about Practical Q&A Appendix Confidential

  4. Training Essential • Reference&Advanced Study • http://en.wikipedia.org/wiki/Serial_port • http://en.wikipedia.org/wiki/Parallel_port • http://en.wikipedia.org/wiki/IEEE_1284 • http://www.freebsd.org/doc/en_US.ISO8859-1/articles/serial-uart/index.html Confidential

  5. YouwillLearn… Theserialcommunicationconcept Thenecessaryinformationtobesuccessfulindesigning,modifyingortroubleshootinganRS-232,RS-422andRS485communicationsystem. Q&A Confidential

  6. Why Serial? Confidential

  7. Serial isEverywhere Confidential

  8. Dial-upModem Confidential

  9. POS Confidential

  10. ATM Confidential

  11. Kiosk Confidential

  12. Door Access Control Confidential

  13. LED and LCD text displays Confidential

  14. GPS Confidential

  15. Test and Measuring Equipment Confidential

  16. Updating Firmware Confidential

  17. CNC&DNC Confidential

  18. UPS Monitoring Confidential

  19. Software Debuggers Confidential

  20. ConsoleManagement Confidential

  21. Industrial Fieldbuses Confidential

  22. Serial is Old Fashion? • Simple, cheap, highly standardized and widespread. • However, limited transmission speed, distance, relatively large voltage swing, and large standard connectors. • New techs: Ethernet, USB, SATA, PCIe Confidential

  23. Serial Introduction Confidential

  24. Serial Introduction • Parallel vs. Serial Communication • Synchronousvs.Asynchronous • Asynchronous Communication • UART • Block Diagram, Format, Framing, NRZ Coding • Baudrate, Throughput • FIFO, Flow Control • Transmission, Topology Confidential

  25. Parallel Byte Byte ‘e’ ‘e’ 0x65 0x65 Byte(8 bits) -> Byte (8 bits)

  26. Serial Communication Bit Byte Byte 0110 0101 ‘e’ ‘e’ 0x65 0x65 Byte -> Bit, Bit, Bit… -> Byte

  27. Parallel vs. Serial Communication Confidential

  28. Synchronous &Asynchronous Asynchronous Synchronous Serial setting must be the same on two side. Data Data CLK

  29. Synchronousvs.Asynchronous Confidential

  30. Asynchronous Comm. Type I • A & B set the same baudrate. • 16 times clock rate. • 當接收端偵測到falling edge時,再count 8個clock,如果仍是low表示是一個合法的start bit,此時正在start bit的中間,此後再count 16 clock則抓到D0,再count 16 clock則抓到D1….最後收完整個UART frame。 • 兩端的clock可以差距很大 (<3%) • Ex: UART Confidential

  31. Asynchronous Comm. Type II • 假設兩端的clock差異是很小的(<3ppm) • 當接收端收到preamblepattern (ex,0101010101010), • 接收端的機制會開始做鎖相動作(校正), • 經過一段時間後(如Ethernet需要48bytes time), • 接收端的clock會調整成和送端相同的phase,此時就會視同兩端的clock同步。 • 同時具備sync.與async. comm.的優點. • 不需要傳送clocksignal, 又可以達到高速 • Ex, Ethernet, USB, SATA,PCIe Confidential

  32. UART Bit Byte 0110 0101 ‘e’ 0x65 Universal asynchronous receiver/transmitter Translates data between parallel and serial forms Confidential

  33. Block Diagram Confidential

  34. Format Start bit: Always set “low”, 1 bit Data bit: 5, 6, 7, 8 bit Parity: None, Odd, Even, Space, Mark, 1 bit Stop bit: 1, 1.5 (Data bit = 5), 2 bit Confidential

  35. Frame • D/P/S (Data/Parity/Stop) • 8/N/1 (8N1) • This specifies 8 data bits, no parity, 1 stop bit. • In this notation, the parity bit is not included in the data bits. • 7/E/1 (7E1) • Means that an even parity bit is added to the seven data bits for a total of eight bits between the start and stop bits. • If a receiver of a 7/E/1 stream is expecting an 8/N/1 stream, what will happen? Confidential

  36. NRZCoding • Non return to zero • Binary code • “1” represented by one significant condition (usually a positive voltage) • “0” represented by the other significant condition (usually a negative voltage), • No other neutral or rest condition • For example, RS-232 data signal: • "one" is -12V to -5V • "zero" is +5 to +12V Confidential

  37. Baud Rate, Throughput • Baud Rate • bps: bits per second • Include start bit, data bit, parity bit, stop bit • General range: 110 – 115.2k bps • Moxa product range: 50 – 115.2k~921.6k bps • Throughput • Bps: bytes per second • For 8N1, full rate: throughput = baud rate/10 • Ex: For 115.2kbps, 8N1, full rate = 11520 Bps • Throughput is not equal to baud rate. • Do not use “speed” for baud rate or throughput Confidential

  38. Non-Standard Baudrate 500Kbps Users may enter the desired non-standard baud rate, such as 7812 bps, 89.3Kbps, 31250 bps, 153.6 Kbps For example, SICK Data Transmission Sensors require 500K bps Confidential

  39. 500000 - 491520 254234 - 250000 1.7% < 3% 1.7% < 3% = = 500000 250000 500000 526629 491520 1+ 6/8 1.8432 1+ 7/8 250000 254234 245760 3+ 5/8 3.6864 3+ 6/8 How to Calculate Baud Rate? Traditionalsolution is to change the oscillator Baud rate options are fixed 921600, 460800, 230400, … If 500000 bps (7.8% > 3%) or 250000 bps (7.8% > 3%) is needed, we must exchange the oscillator (modify the hardware) (divisoris integer) New solution allows any baud rate without changing oscillator → (Enum = 0-7) →

  40. FIFO • A UART’s FIFO buffer is designed to improve communication performance. • If it is configured incorrectly, you may find that your communication performance is degraded. • For an 8250 or 16450 UART, • The FIFO has a size of only one byte. This means that the UART will issue an interrupt to the system for each byte of data received, which uses a lot of CPU resources. • If you don’t read the data from the UART in time, the next byte will overwrite the data. Confidential

  41. Tradeoff Between Throughput and Latency • Higher throughput: transmitting more bytes once. • For some older devices with a small buffer, it is easy to get overrun in high throughput situations. The solution is to transmit one byte. • Smaller latency: transmitting less bytes once. • The relation on FIFO High/Low Water and Flow Control. Confidential

  42. Flow Control • Prevent data overrun, improve performance • Flow control is used in UART FIFOs, drivers, and OS kernels. Confidential

  43. High/Low Water Level • Receive buffer high water level (RBH) • RBH prevents the receive buffer from overrunning by telling the transmitting side to stop sending data before the Rx buffer is full • Receive buffer low water level (RBL) • RBL, on the other hand, defines when data transmission should be resumed. Confidential

  44. Confidential

  45. Confidential

  46. Confidential

  47. On-chip Flow Control Lets You Stop Transmitting in Time • UART processes the RTS/CTS signals and XON/XOFF characters automatically. • Using a poorly designed driver could cause data loss either. • To enable flow control, you need to check both software and hardware settings. • If you don’t need to use flow control, make sure the setting is off. • If HWflow control is enabled without an RTS/CTS cable connection, what will happen? Confidential

  48. Flow Control Comparison

  49. Transmission Simplex Half-duplex Full-duplex Confidential

  50. Topology Point to Point Daisy Chain (Multi-drop) Star Confidential

More Related