Development of a Multi-Bus Platform for Automation Testbed
Total Page:16
File Type:pdf, Size:1020Kb
A Master Thesis Work in Electronics Development of a Multi‐bus platform for automation testbed By Lukas Knapik and Mathias Isaksson Examiner: Professor Lars Asplund, Mälardalens University Supervisor: Martin Ekström, PhD Student in Electronics, Mälardalen University Dan Olsson, M.SC Physics, Infotiv AB Lukas Knapik Mathias Isaksson 070‐7124691 073‐8079350 [email protected] [email protected] Mälardalen University, Västerås 2010‐02‐17 Development of a Multi‐bus platform for automation testbed Master Thesis CEL505 ABSTRACT The task for this thesis was to develop, construct and evaluate a multi‐bus communication system, connected to a PC via USB and capable of communicating in CAN, I2C and SPI and develop drivers for it in National Instruments LabVIEW. In the beginning a study was made of the communication buses followed by an investigation of what type of hardware that could accomplish this task. A microcontroller unit was selected and programmed in MikroElektronika MikroC Pro v.3.2 to act as the interface between the communication busses and PC. A PCB prototype of the system was constructed by using Eagle Cad software v.5.6.0. General drivers for this system where created in LabVIEW v.8.6.1 so the end‐user simply can create their own applications and control the compatible hardware depending on their type of purposes. The system was tested on criteria’s such as: speed, power consumption, burst performance and transmission length depending on which communication bus was used. Lukas Knapik, Mathias Isaksson Mälardalen University, Västerås 2010‐02‐17 Development of a Multi‐bus platform for automation testbed Master Thesis CEL505 ACKNOWLEDGEMENTS We would like to thank Infotiv AB for giving us the opportunity to do this thesis. A special thanks to our supervisors Martin Ekström at Mälardalens University and Dan Olsson at Infotiv AB for all their help and time they have dedicated to us. Lukas Knapik, Mathias Isaksson Mälardalen University, Västerås 2010‐02‐17 Development of a Multi‐bus platform for automation testbed Master Thesis CEL505 Table of Contents 1. Introduction ................................................................................................................................ 1 1.1 Infotiv AB ....................................................................................................................................................... 1 1.2 Background .................................................................................................................................................... 1 1.3 Purpose .......................................................................................................................................................... 1 1.4 Why Infotiv and this thesis ............................................................................................................................ 1 1.5 Delimitations ................................................................................................................................................. 2 1.6 Deliverables to Infotiv ................................................................................................................................... 2 1.7 University Requirements ............................................................................................................................... 2 1.8 Timetable ....................................................................................................................................................... 2 1.9 The report layout ........................................................................................................................................... 3 2. Bus study and research ................................................................................................................ 4 2.1 The Inter‐Integrated Circuit Bus .................................................................................................................... 4 2.1.1 Arbitration ................................................................................................................................................ 6 2.1.2 Clock synchronization ............................................................................................................................... 7 2.2 The Control Area Network bus ...................................................................................................................... 7 2.2.1 The CAN protocol ..................................................................................................................................... 7 2.2.2 CAN messages .......................................................................................................................................... 8 2.2.3 CAN Errors .............................................................................................................................................. 11 2.3 The Serial Peripheral Interface Bus ............................................................................................................. 13 2.3.1 Data Transmission .................................................................................................................................. 13 2.3.2 Multiple SPI slaves .................................................................................................................................. 14 2.3.3 SPI drawbacks ......................................................................................................................................... 15 3. Pre‐design circuitry considerations ............................................................................................ 17 3.1 Selecting an appropriate operations controller .......................................................................................... 17 3.2 Selecting an appropriate ADC ...................................................................................................................... 17 3.3 Power supply ............................................................................................................................................... 18 3.4 Selecting ground .......................................................................................................................................... 18 3.5 Protection against high voltage peaks ......................................................................................................... 18 3.6 Diagnostics ................................................................................................................................................... 18 3.7 Bus connectors ............................................................................................................................................ 18 3.8 Schematics and PCB software ..................................................................................................................... 19 4. Circuitry components and design ............................................................................................... 20 4.1 Converter card components ........................................................................................................................ 20 4.1.1 Microcontroller – Microchip PIC18F4680 ............................................................................................... 20 4.1.2 USB UART Interface – FTDI FT232 .......................................................................................................... 21 4.1.3 I2C Switch – Texas Instruments PCA9548A ............................................................................................. 21 4.1.4 I2C Accelerator – Linear Technologies LTC4311 ..................................................................................... 21 4.1.5 CAN Transceiver MCP2550 ..................................................................................................................... 22 4.1.6 Voltage Regulator REG1117‐5.0 ............................................................................................................. 22 4.1.7 TVS Diodes .............................................................................................................................................. 22 4.2 Converter card design ................................................................................................................................. 23 4.2.1 Power supply and ground ....................................................................................................................... 23 4.2.2 Setting up the FTDI circuitry ................................................................................................................... 24 4.2.3 Setting up the MCU circuitry .................................................................................................................. 24 4.2.4 I2C Switch Setup ...................................................................................................................................... 25 4.2.5 I2C Accelerator setup .............................................................................................................................. 26 4.2.6 SPI setup ................................................................................................................................................. 26 4.2.7 CAN setup ............................................................................................................................................... 27 4.2.8