Machine Design ES1 - Introduction Martin Grimheden, mjg@kth.se Jad El-Khoury, jad@kth.se Mechatronics Lab 1 Machine Design ES1 people Martin Grimheden Jad El-Khoury Staffan Qvarnström Per Mackegård Magnus Persson es1@md.kth.se (teaching team) es1_2010@md.kth.se (all students) Mechatronics Lab 2 1 Machine Design Syllabus – learning objectives The overall aim of the course is to provide understanding and knowledge of the design and implementation of embedded systems in the context of mechatronic products, with emphasis on basic technologies and elements of design. Mechatronics Lab 3 Machine Design This means: … Provide examples of existing embedded systems based products and describe the special requirements placed in developing such systems. Describe and explain important steps in the design of such systems, including useful abstractions and views, and be able to give examples of dependencies between system functionality and the implementation, common faults and failures of embedded systems, and trade-offs that the designer has to deal with. Be able to use modern integrated development environments for microcontroller/processor programming and their features for testing and debugging. Mechatronics Lab 4 2 Machine Design … cont.d… Describe and be able to explain the basic operation of microcontrollers/microprocessors, their internal features and peripherals, and how C-language and assembly instructions correspond to basic processor operations. Describe and provide criteria for choosing microcontrollers and/or FPGA based solutions. Be able to configure and develop microcontroller programs for mechatronic applications, including the usage of I/O and communication peripherals. Describe, explain and apply basic concepts of concurrent and real-time programming including fundamental execution strategies (e.g. foreground-background programming) and scheduling theory, other structuring concepts for embedded software, and their vizualisation using selected diagramming techniques. Describe, explain and apply some of the basic concepts of communication protocols, in particular with reference to the Controller Area Network (CAN). Mechatronics Lab 5 Machine Design …and summarized: Give example of embedded systems and requirements on development Explain how these systems can be developed Use modern tools for development, programming, test and debugging Explain basic functions with a microcontroller and/or FPGA Mechatronics Lab 6 3 Machine Design … cont.d… Develop programs for mechatronics applications Understand, explain and apply concurrent programming, real-time programming, scheduling theory and techniques of visualization Explain and apply basic concepts for communication, specific CAN Mechatronics Lab 7 Machine Design A third (and last attempt)… Become really good at using one advanced microcontroller Mechatronics Lab 8 4 Machine Design Overall course design 6 weeks, 6 modules, 6 labs Half-time programming exam Final written exam Mechatronics Lab 9 Machine Design Course design 2*2h Lectures/week: theory, literature , overview ~1*2h Tutorial/week: ”walk through” exercises, supervision and help ~10h individual lab work/week ~1*2h Reporting, time for questions etc. Mechatronics Lab 10 5 Machine Design Course design, 2 Every week – one Lab exercise, deadline for reporting is Friday the next week After four weeks – small exam 2 hours, in the lab, with computer and microcontroller. Individual work (one person per set-up) Programming tasks (flash LED with 2Hz, create code from an UML diagram, find error in a program, control a DC-motor etc) Mechatronics Lab 11 Machine Design Course design, 3 Written exam at end of the course 4 hours, written exam (Tenta) No books or papers, only a pen Mechatronics Lab 12 6 Machine Design Grading LAB: 3 cr, grade P/F KS: 1 cr, grade A-F TEN: 2 cr, grade A-F Final grade is weighted average of KS & TEN. Mechatronics Lab 13 Machine Design Course structure, 6 weeks=modules 1. 2. 3. 4. 5. 6. Mechatronics Lab AVR32 Modelling Communication and CAN Distributed systems (and CAN) Power Management Advanced AVR32 14 7 Machine Design Examples AVR32: C-programming Modelling: create state-space diagrams, manual code generation CAN: control a speedometer in the lab, send messages between lab computers Power: maximize endurance, minimize power competition Arithmetics: implement complex formulas and fast calculation Mechatronics Lab 15 Machine Design AT32UC3L picoPower Consumption Mode CPU BUS Peripheral OSC & DFLL RTC RC BOD & Bandgap VDDCORE Typ. Consumption Run X X X X X X X 1.62V 280 µA/MHz X X X X X X 1.62V 150 µA/MHz X X X X X 1.62V 90 µA/MHz Idle Frozen Standby X X X 1.62V 70 µA/MHz Stop X X X X 1.62V 40 µA Deep Stop X X Static Shutdown Shutdown Mechatronics Lab X 1.62V 20 µA 1.62V 5 µA 0V 1.6 µA 0V 100 nA 16 8 Machine Design Formal course prerequisites DD1321 – Applied programming EL1120 – Control theory MF1016 – Electronics (or similar) Mechatronics Lab 17 Machine Design Informal course prerequisites Electronics Enough to read circuit diagrams, make smaller circuits Control Theory Can design and implement a basic controller Programming C-programming, structures, pointers etc Mechatronics Lab 18 9 Machine Design Beneficial pre-requisities Microcontroller Previous experiences with microcontrollers Can use, program and debug on basic level, typically 8-bit uP. Mechatronics Lab 19 Machine Design Accepted to study the course? See the list Mechatronics Lab 20 10 Machine Design Example of expected previous knowledge Mechatronics Lab 21 Machine Design Examples Mechatronics Lab 22 11 Machine Design Examples Mechatronics Lab 23 Machine Design Examples Mechatronics Lab 24 12 Machine Design Examples Mechatronics Lab 25 Machine Design Examples (tomorrow) AVR32_GPIO.port[1].gpers = 1 <<27; int i=(AVR32_GPIO.port[2].pvr >> 24) & 0x01; Mechatronics Lab 26 13 Machine Design Examples (in two weeks) pFlt2_5++; CAN2515ByteWrite(Channel, RXF3SIDH, *pFlt2_5 >> 3); CAN2515ByteWrite(Channel, RXF2SIDL, (*pFlt2_5 << 5) |0x08 ); Mechatronics Lab 27 Machine Design Lab equipment Mechatronics Lab 28 14 Machine Design Lab equipment HW needed: PC, EVK, debugger PC: 15+12 in Mechatronics lab or own computer Evaluation kit (EVK) and debugger: you borrow your own set from us Special tools for special labs: use in the lab SW needed: Mostly free downloads Development environment (IDE): AVR32 studio, toolchain, framework (free) Modelling tool: Rhapsody (free on campus) Mechatronics Lab 29 Machine Design Borrow equipment When formally accepted for the course Sign form and receive equipment Return after exam Responsible for equipment (2kSEK) Start experiment today! Mechatronics Lab 30 15 Machine Design Course time calculations 6+1 weeks, 6 credits = 40% of full time 2*2h lectures + 2h tutorial/week = 15% of full time => individual work at least 10h/week Mechatronics Lab 31 Machine Design Schedule, week 1 Mechatronics Lab 32 16 Machine Design Schedule, week 3 Mechatronics Lab 33 Machine Design Experimental platform Mechatronics Lab 34 17 Machine Design The EVKs - 1100 Mechatronics Lab 35 Machine Design EVK1101 Mechatronics Lab 36 18 Machine Design debugger Mechatronics Lab 37 Machine Design Buy your own? EVK1100 500 SEK via us (1600 SEK elsewhere) EVK1101 300 SEK via us (1000 SEK elsewhere) Debugger (not necessary) 1100 SEK via us (3700 SEK elsewhere) Buy at ITM student office, close to mechatronics lab Mechatronics Lab 38 19 Machine Design Modelling platform Rhapsody UML Mechatronics Lab 39 Machine Design Web platform Kth.se/social Platform links to resources such as AVRfreaks AVRTV Wikibooks Mechatronics Lab 40 20 Machine Design Course literature See web platform All material on ”course literature” site is covered in final exam Mechatronics Lab 41 Machine Design Admin questions? Mechatronics Lab 42 21