Improving the performance and reliability of systems which employ the ’CONTROLLER AREA NETWORK’ protocol through low-level changes to the controller implementation Thesis submitted for the degree of Doctor of Philosophy at the University of Leicester by Imran Sheikh Embedded Systems Research Group Department of Engineering University of Leicester Leicester, UK. JANUARY 2011 Abstract The CAN (Controller Area Network) protocol provides one of the cost-effective meth- ods to network current generations of distributed embedded systems. Although it is a robust protocol with short messages and simple priorities, it is largely thought of as only being suitable for soft real-time, event-triggered systems. Safety critical applications require highly predictable behaviour with strict bounds on worst-case message transmission times; the next-generation mechatronic systems also requires a high level of information throughput. In its current form, CAN lacks most of these requirements principally due to its medium access scheme and physical-layer design. This thesis presents a frame work which aims to enhance the capabilities of CAN, in order to push the boundaries of the protocol’s current operation. In particular, the main research question to be addressed is the exploration of the extent to which low-level modifications can enhance CAN suitability for use in the next generation of critical systems. In order to answer this question, it is first necessary to develop a flexible and robust platform to implement these modifications using a novel facil- ity made up from custom soft-core CAN controllers. This novel facility was then employed to implement and experimentally investigate three small but conceptually significant protocol modifications as follows: Increasing the effective data rate from 1 to 10 Mbps whilst doubling the effective payload from 8 to 16 bytes; Reduction of unwanted transmission jitter by compen- sating for bit stuffing; Enabling a windowed transmission scheme to provide optimal trade-off’s between transmission reliability and real-time behaviour in noisy environ- ments. The thesis describes the results obtained from these experiments and summarizes the main pros and cons that appear. The thesis then concludes with observation that the modified CAN protocol may be suitable for use with certain classes, of the next generation time-critical distributed embedded systems. i Dedication To My Late Parents May Allah rest there soul in peace ii Acknowledgements All praises to the Almighty ’ALLAH’ who is the most beneficent who has given me the strength to achieve what I have in my life and whatever I will in future. The work presented in this thesis would not have been possible without the help of my supervisors Michael Short and Michael Pont. Michael’s thank for believing in me, you have always supported my ideas and work, and inspired me throughout the last four years. Also, I must thank my colleagues at ESL and TTE systems, especially Dr Ayman Gendy for listening patiently and giving me some inspirational ideas. Specially i would also like to thanks Dr K.M. Yahya and Dr Tariq Jadoon who have always acted as my mentor and provided with every support in my carrier. I would also like to thank NWFP UET Peshawar, Higher Education Commission and peopleofPakistanforfundingmyPhDstudies, itisasuchagreathonourtorepresent my country who although been in dire financial crisis have funded my studies. Finally I would like to thanks, my wife Sana, my beautiful and lovely three daughters Sara, AreeshaandMominawhohaveextendedtheirloveandcooperationinachieving this goal. I cant forget here my Mother and Father whom I miss dearly on this day, when i am so near to achieve my doctorate for which they had worked so hard in their life time. I also want to thanks my three sister and brother Zeeshan for their support to continue my studies during the tough time, when we lost both of our dear parents. My home, Leicester Imran Sheikh August 12, 2010. iii Related Publications and Contributions A number of papers were published during the course of the work described in this thesis. Please note that the contents of some of these papers have been adapted for presentation in this thesis:(in reverse chronological order): 1. Imran, S.andShort, M.J.(2010), Conformance Testing of Soft-Core CAN Controllers: A Low-Cost And Practical Approach, In: J.A. Cetto et al. (Eds), Informatics in Control, Automation and Robotics: Lecture Notes in Electrical Engineering, Vol. 85, Part 2, pp. 129-141, Springer-Verlag, Berlin, ISBN: 978-3-642-19729-1, 2011. 2. Short, M.J.andImran, S.(2010),Computing Optimal Window sizes to en- force dependable communications in time-triggered Controller Area Networks, Proceedings of the 9th International workshop on Real time Net- works RTN 2010, Brussels, Belgium, 6th July, 2010. 3. Imran,S.,Short,M.J.andHanif,M.(2010),Improvinginformationthrough- put and transmission predictability in Controller Area Networks, Pro- ceedings of IEEE Symposium on Industrial Electronics, ISIE 2010, Bari, Italy, pp. 1736-1741,,July 4-7, 2010. A revised version of this paper has been recom- mended for the special section of IEEE Transaction on Industrial Electronics and has been submitted for review with the title Analysis of an Enhanced Protocol Controller for Next-Generation CAN Networks. 4. Imran, S., Short, M.J. and Yahya, K.M. (2010), Analysis of Overclocked Controller Area Network, Proceedings of the 7th IEEE International Con- ference on Networked Sensing Systems (INSS 2010), Kassel, Germany, June 15 - 18, 2010, pp. 37-40, Published by IEEE Industrial Electronics Society, ISBN 978-1-4244-7910-8 5. Short, M.J. and Imran, S. (2010), Dual-rate overclocking in CAN net- works: a soft-core controller prototype, Proceedings of the 7th IEEE International Conference on Networked Sensing Systems (INSS 2010), Kassel, iv Germany, June 15 - 18, 2010, pp. 314-317, Published by IEEE Industrial Elec- tronics Society, ISBN 978-1-4244-7910-8. 6. Imran, S. and Short, M.J. (2010), Employing Integrated Logic Analy- sers and Virtual I/Os to Verify Soft Core Protocol Implementations, IAENG International Journal of Computer Science, Vol. 37(1), pp. 36-49. 7. Imran, S. and Short, M.J. (2009), A Low Cost and Flexible Approach to CAN Conformance Testing,Proceedingsofthe6thInternationalConference on Informatics in Control, Automation and Robotics, Intelligent Control Sys- tems and Optimization, ICINCO 2009, Milan, Italy, July 2-5, 2009, INSTICC Press 2009, ISBN 978-989-8111-99-9. 8. Imran, S., Short, M.J. and Athaide, K.F. (2009), Using Virtual I/O for CAN Bit Timing Conformance Tests, Proceedings of the World Congress on Engineering, WCE 2009, London, U.K, July 1 - 3, 2009, Vol. 1, pp. 480-485, ISBN: 978-988-17012-5-1. (Best Student Paper Award). 9. Imran, S. and Short, M.J. (2009), Improving Information Throughput in CAN Networks: Implementing a Dual Speed Approach,Proceedings of the 8th International workshop on Real time Networks, RTN 2009, Dublin ,Ireland, June, 2009. 10. Imran, S., Short, M. and Pont, M.J. (2008), Hardware implementation of a shared-clock scheduling protocol for CAN: A pilot study,inProceedings of the 4th UK Embedded Forum (September 2008, Southampton, UK), pp.72- 78. ISBN 978-0-8634-1949-2. ISSN 0537-9989. Techical Report 1. I. Sheikh and M. Short. CAN conformance testing-A new approach Technical Report, Tech-Report ESL-09-01, ESL, Engineering Department, University of Leicester, Feb 2009. This technical report include the details of all the conformance tests performed on the CAN IP core during this research work. v Contributions Thisnextsectionsummarizesthemaincontributionsoftheauthorofthisthesis,inthe papers listed above. The number in brackets represents the percentage contribution of the author in each case. Conformance Testing Paper 1 (75%), 6 (80%), 7 (80%) and 8 (85%) are principally adopted for Chapter 5 on CAN conformance testing. Paper 1: This paper is an extension of the paper 8 (conference paper) to a book chapter. Paper 6: This paper is an extension of the paper 7 (conference paper) to a journal paper. The ideas contained within these works were conceived by the thesis author, with appropriate guidance and suggestions from the supervisor. Formation of the Confor- mance test bench, running of the tests and documentation were all done by the thesis author. In paper 7 the third author helped in the installation of the Xilinx tools for the running of the tests. Overclocking Paper 4 (65%), 5 (45%) and 9 (70%) are adopted in the Chapter 6 on CAN over- clocking. The basis of this work is an idea published in previous works by Cena & Valenzo, However the idea has never been implemented or experimentally evaluated before. Paper 9: The implementation was carried out on the CAN IP Core exclusively by the author of this thesis. The experimentation and the case studies presented in this paper is principally the work of the author, with appropriate reviews provided by the supervisor. Paper4: ThispaperisrelatedtotheanalysisofOverclocking(whichwasimplemented and published before in paper 9). The idea and implementation of the experimental analysis is done by the author of the thesis, given in section III, A of the paper. The section III, B is adapted from the 2nd author’s previous work, the mathematical adaptation as Equation 6 and 7 in the paper is a combined work by the 1st and 2nd author. vi Paper 5: The implementation and experiment done in section III of this paper is contributed by the author of the thesis. Jitterless Communication Paper 3 (80%) has been adapted for Chapter 7 on Jitterless communication. The work was conceived following detailed discussions with the supervisor. The thesis author carried out the implementation exclusively on the CAN IP core, all the case studies and analysis has been done by the author of the thesis. The 3rd author of the paper assisted with the timer configuration of the ARM board used in the experiment for the case study presented in section 7.3 of the thesis and section IV of the paper. The paper and work was done in the guidance and suggestion of the supervisor. Windowed Transmission Paper 2 (30%) is adapted for the work shown in Chapter 8 and 9. The idea of this work and the ideas contained in section 8.4.3. are principally the work of the first author of paper 2. The contributions of the thesis author to this work is to assist in the solution for the main theorem given in section 8.4.2. Section 8.5, 8.7 and 8.8, which covers the implementation of the idea on the IP Core (in its entirety), and the setting up of the experiment and presenting the results and analysis is contributed by the author of the thesis. The work shown in Chapter 9 is now under review for a publication in IEEE TIE (70%), this is an enhanced version of paper 3 containing the main results of the case study. All the implementation, compilation of results and analysis has been done by the thesis author, under the guidance of the supervisor. CAN Test Bench Paper 10 (80%) has been partially (only section 2) adapted in Chapter 3 of this work. The section 2 of this paper discussed an early implementation of the CAN IP core, early versions of the HDL coding, the setup of the test bench and execution of the experiments is principally the work of the author. The author 2 and 3 (supervisor’s) provided appropriate guidance and review on the paper. vii Contents Abstract i Dedication ii Acknowledgements iii Related Publications and Contributions iv 1 Introduction 11 1.1 Problem Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.2 Main Research Question . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.3 Thesis Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.4 Thesis Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2 Current Approach: Predictable and Time-Triggered Communica- tions 22 2.1 Time Triggered Communication in Field buses . . . . . . . . . . . . . 23 2.1.1 Enhancements in CAN to support TT communications . . . . 27 2.2 Jitter in Transmission Times . . . . . . . . . . . . . . . . . . . . . . . 31 2.3 Throughput Limitations . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.4 Protocol Conformance Testing . . . . . . . . . . . . . . . . . . . . . . 38 2.4.1 CAN Conformance Testing . . . . . . . . . . . . . . . . . . . . 38 3 Controller Area Network 42 3.1 Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.1.1 Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.1.2 Arbitration in CAN Bus . . . . . . . . . . . . . . . . . . . . . 45 3.1.3 Message Filtering . . . . . . . . . . . . . . . . . . . . . . . . . 47 1 2 3.1.4 Error Detection and Confinement . . . . . . . . . . . . . . . . 48 3.1.5 Physical Signalling . . . . . . . . . . . . . . . . . . . . . . . . 50 4 CAN Test Bench 52 4.1 CAN IP Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.1.1 Bus Interface Logic . . . . . . . . . . . . . . . . . . . . . . . . 54 4.1.2 CAN Configuration Registers . . . . . . . . . . . . . . . . . . 56 4.1.3 Bit Stream Processor (BSP) . . . . . . . . . . . . . . . . . . . 56 4.1.4 Bit Timing Logic (BTL) . . . . . . . . . . . . . . . . . . . . . 66 4.2 CAN Test Bench hardware . . . . . . . . . . . . . . . . . . . . . . . . 68 4.3 Design Flow and Analysis . . . . . . . . . . . . . . . . . . . . . . . . 73 4.4 A Simple Two Node Test Network . . . . . . . . . . . . . . . . . . . . 79 4.4.1 Message Transmission . . . . . . . . . . . . . . . . . . . . . . 80 4.4.2 Message Reception . . . . . . . . . . . . . . . . . . . . . . . . 81 4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 5 CAN Conformance Testing 83 5.1 Conformance Testing of Protocols Implemented on IP Cores . . . . . 84 5.1.1 Conformance Testing Standards . . . . . . . . . . . . . . . . . 85 5.1.2 Proposed Environment . . . . . . . . . . . . . . . . . . . . . . 87 5.2 Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 5.2.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5.2.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 5.2.3 Use of Virtual I/O . . . . . . . . . . . . . . . . . . . . . . . . 94 5.3 ISO 16845: CAN Conformance Standard . . . . . . . . . . . . . . . . 96 5.3.1 Frame Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Description: