182.694 Microcontroller VU Martin Perner SS 2017 Featuring Today: Preliminary Talk
Definitions What is a Microcontroller? Note: Microcontroller is sometimes shortened as µc, uc, or MCU. Preliminary Talk March 1, 2017 2
Definitions What is a Microcontroller? A microcontroller is a microprocessor extend with RAM/Memory and Input/Output peripherals. Note: Microcontroller is sometimes shortened as µc, uc, or MCU. Preliminary Talk March 1, 2017 2
Definitions What is a Microprocessor? Preliminary Talk March 1, 2017 3
Definitions What is the difference between a CPU and a µp? Preliminary Talk March 1, 2017 3
Definitions Is this a µp? Figure: Mailüfterl (1958) By Florian Staudacher CC-BY-3.0 via Wikimedia Commons. Preliminary Talk March 1, 2017 4
Definitions A µp is...... a processor which is integrated onto a chip. Preliminary Talk March 1, 2017 5
Definitions Figure: Atmel s ATmega238P (2009). 20 MHz 8-bit AVR, 32 Pins. Preliminary Talk March 1, 2017 5
Definitions Figure: Freescale s KL03 (2013). 48 MHz ARM Cortex-M0+, 20 Pins. Preliminary Talk March 1, 2017 5
Microcontroller are everywhere Figure: Nexus 5 main logic board front, by Sam Lionheart CC-BY-NC-SA-3.0 via ifixit. Preliminary Talk March 1, 2017 6
Microcontroller are everywhere Figure: Nexus 5 main logic board back, by Sam Lionheart CC-BY-NC-SA-3.0 via ifixit. Preliminary Talk March 1, 2017 6
Question Have you ever used a microcontroller? Preliminary Talk March 1, 2017 7
Motivation Microcontrollers are everywhere! Automotive Household appliances (fridge) Gadgets Botnets (Internet of Shitty Things)... Preliminary Talk March 1, 2017 8
Motivation Microcontrollers are even recursively used! Every modern x86 platform contains several other auxiliary processors, which kind of erase the line between pure hardware and software. [... ] The aim of this talk is to provide insight to the security, architecture and vulnerability of the AMD SMU firmware found in modern AMD x86 processors. The SMU is designed to prevent unauthorized code execution, thus making it ideal candidate to verify if it is so. This is where the fun starts. AMD x86 SMU firmware analysis by Rudolf Marek at 31C3. Preliminary Talk March 1, 2017 9
Motivation Dieselgate Question: Who does the exhaust gas treatment in the ECU (blackbox) work? Solution: Get the software; by using a 0-day bug in the microcontroller to get the binary. Results: This was probably not an accident about which only a few knew. Figure: Artwork by Barnrook, Klink & Friends, Brandalism.org The exhaust emissions scandal ( Dieselgate ) by Felix Domke and Daniel Lange at 32C3. Preliminary Talk March 1, 2017 10
Motivation After this course you will... have an in-depth understanding of MC fundamentals be able to work out small MC applications yourself Preliminary Talk March 1, 2017 11
Motivation After this course you will... have an in-depth understanding of MC fundamentals be able to work out small MC applications yourself Interesting practicals at our department are open to you Preliminary Talk March 1, 2017 11
Our Department Institut für Technische Informatik E182/2 Embedded Computing Systems Group (ECS) Treitlstrasse 3 2. Stock http://ti.tuwien.ac.at/ecs Preliminary Talk March 1, 2017 12
Our Laboratory TILAB Treitlstrasse 3 Mezzanine (0.5 floor) Room 4 http://www.tilab.tuwien.ac.at Extensively use the lab, however come prepared There will be slots reserved for you Preliminary Talk March 1, 2017 13
Lab Equipment MC Platform bigavr6 contains the ATmega1280 MC, 16 MHz oscillator 2 Displays text & graphical Real-time clock Serial EEPROM SD card reader Preliminary Talk March 1, 2017 14
Lab Equipment Lab Kit MC board ATmega board Display (text) Keypad board Temperatur sensor Preliminary Talk March 1, 2017 14
Lab Equipment Lab Kit MC board ATmega board Display (text) Keypad board Temperatur sensor Available at the department from Mon Tue, 09:00 12:00 and Wed Thu, 13:00 16:00 by our technician (Mr. Odebrecht), for a e100 security deposit. Preliminary Talk March 1, 2017 14
Lab Equipment The Keypad Board... there are more add-on boards waiting for you during Application 1 and 2. Preliminary Talk March 1, 2017 15
Lab Equipment Digital Storage Oscilloscope TDS2024B bandwidth 200 MHz 4 channels 8 bit resolution This and the LEDs will be your friends when you are debugging. Preliminary Talk March 1, 2017 16
Grading What contributes towards your grade? 50% from two (out of three) exams (theory and practical) 50% from two applications (coding and theory questions) Preliminary Talk March 1, 2017 17
Grading For each of the 3 exams (1, 2 and Make-up) you can achieve: 13 pts per programming part Each exam consists of 2 practical exercises. Grading is, in general, binary (6.5 pts or 0 pts)! There will be two exercises, one in 2 nd exam and one in the make-up exam, which partial points. More on that in the respective recitations. 12 pts per theory part Multiple choice, 8 topics with 3 answers each. For each answer 0.5/0/ 0.5 pts (correct/withhold/incorrect) are awarded. The lowest scored programming exam and theory exam is discarded E max = 2 13 + 2 12 ( 50 pts) Preliminary Talk March 1, 2017 18
Flow of the first application 1 You receive the specification from us and analyze it. 2 You can write an implementation proposal. If you conduct a talk with a tutor, in the week after the deadline of the Implementation proposal, you will be awarded with up to two bonus points. 3 You implement the application. 4 You submit your code. 5 You participate in a delivery talk with a tutor. 6 You submit the protocol and your solutions for the theory tasks. Preliminary Talk March 1, 2017 19
Grading Delivery Talk You are required to participate in a delivery talk, with a tutor, for every application you submit. Your submission will be checked and you will be asked questions regarding your program. If there are discrepancies, you will be invited to another talk with a member of the teaching staff, where point reductions can be made. Preliminary Talk March 1, 2017 20
Grading For each application (A 1, A 2 ) you can achieve: 20 pts for the Code (C). 5 pts for the theory tasks (T ). A {1,2} = C + T 25 pts Preliminary Talk March 1, 2017 21
Grading A word of warning: We will check your code submissions not only for functionality. We will review every submission in-depth and deduct points if there are design flaws, bad coding style, etc. (see the coding guidelines)! Preliminary Talk March 1, 2017 22
Grading Bonus Points: You can achieve up to 3 Bonus Points for solving assembler tasks before the first exam: Code tasks 2.2.1&2.2.2, 2.4.1&2.2.3, and 2.2.8. After presenting the code to a tutor and answer the questions listed in exercises.pdf, you get a point for each of the task(s). Up to 2 Bonus Points for the implementation proposal. For exceptional work during the applications we might also award bonus points. Preliminary Talk March 1, 2017 23
Grading In total: E + A 1 + A 2 + B Positive grade prerequisites: programming exams 13 pts E + A 1 + A 2 55 points Grade prerequisites not fulfilled nicht genügend [ 0, 55) nicht genügend [55, 66) genügend [66, 77) befriedigend [77, 88) gut [88, ) sehr gut Preliminary Talk March 1, 2017 24
Grading Collaboration policy We encourage discussions among students, but all work you submit must be written by you, in your own words, and must have been programmed by you. Cheating, of any kind, will lead to 0 pts for the respective part, and we will also deduct 15 pts from the total points of everybody involved! Note that this also applies to the tasks for bonus points! If you are caught cheating during an exam both, theory and practical, will be graded with 0 pts! Preliminary Talk March 1, 2017 25
ECTS Breakdown 7 ECTS ECTS Users Guide http://ec.europa.eu/education/tools/ects en.htm ECTS credits are based on the workload students need in order to achieve expected learning outcomes. Learning outcomes describe what a learner is expected to know, understand and be able to do after successful completion of a process of learning...., whereby one credit corresponds to 25 to 30 hours of work. Preliminary Talk March 1, 2017 26
ECTS Breakdown 7 ECTS 25 h = 175 h Hours Usage 10 h Lecture 6 h 3 Exams 30 h Preparation for Exam 1 75 h Application 1 and preparation for Exam 2 54 h Application 2 and preparation for Make-up Exam Preliminary Talk March 1, 2017 27
Part 0 Assembler Aims Get used to the lab equipment Understand the tool-chain Get to know the insides of MC hardware & their peculiarities Solve simple MC exercises (4 per week recommended!) Preliminary Talk March 1, 2017 28
Part 1 C Aims C programming for MC (gcc,... ) Learn to use the MC s periphery (timer, ADC,... ) in detail Communicating with the MC (UART, I 2 C,... ) Solve more demanding MC exercises Preliminary Talk March 1, 2017 29
Part 1 C The Application: Fan Control Control of a 4-wire fan Ensure a low ambient noise with a microphone Communicate via ZigBee current measurements/receive target RPM Preliminary Talk March 1, 2017 30
Part 2 TinyOS Aims... after having learned assembler and C... get to know an OS from scratch develop low-level drivers for OS develop high-level application (with tasks) Preliminary Talk March 1, 2017 31
Part 2 TinyOS The Application: Lunar Lander Clone (?) MP3 board Accelerometer (control) Preliminary Talk March 1, 2017 32
A Coarse Course Schedule Phase 1 5.3. Registration Deadline (23:59) 23.3. De-Registration Deadline (12:00) 24.3. Exam 1 Preliminary Talk March 1, 2017 33
A Coarse Course Schedule Phase 2 2.4. (Optional) Application 1 Implementation Proposal 15.4. 23.4. Easter Holidays (TILAB only closed on public holidays) 14.5. Application 1 Code Deadline (23:59) 15.5. 18.5. Delivery Talks 19.5. Exam 2 21.5. Application 1 Protocol Deadline (23:59) Preliminary Talk March 1, 2017 34
A Coarse Course Schedule Phase 3 25.6. Application 2 Code Deadline (23:59) 26.6. 29.6. Delivery Talks 30.6. Make-up Exam 2.7. Application 2 Protocol Deadline (23:59) Preliminary Talk March 1, 2017 35
First Steps Please remember to register soon in TISS (by 5.3.)! Make sure you have an account in myti (by 5.3.)! (Login once with your account) on 6.3. we will transfer TISS registrations to myti: After that you can suggest up to 3 priority lab slots These slots will be assigned on the 20.3.! (But you should start working before) Late registration (only exceptional!): until 23.3. per email only possible if there are slots available! If the demand for course slots is higher than available, BTI will be prioritized. Preliminary Talk March 1, 2017 36
First Steps Priority Slot During the lab hours of the tutors, everyone will get one priority slot assigned. During this one-hour slot, you have to right to work on a PC with a microcontroller. I.e., if need be you can send a colleague away. This also means that someone might ask you to leave your PC to them, but this rarely happens. Otherwise, there is not difference between your priority slot and any other time a tutor is present. Preliminary Talk March 1, 2017 37
First Steps Communication We will provide updates, and reminders via TISS News. Please be sure that you are subscribe (RSS or E-Mail)! Preliminary Talk March 1, 2017 38
First Steps Accounts You will receive an E-Mail to your @student.tuwien.ac.at address once your account is generated (around the 7.3.). After that, you have to visit https://password.tilab.tuwien.ac.at and accept the usage policy of the lab. On that page, you can also can set/change the password of your account. If you have not accepted the policy by the 23.3. you will be dropped from the course! After you have accepted the policy, your TUcard will be able to open the doors to the TILab. Preliminary Talk March 1, 2017 39
First Steps Lecture Notes Available at the homepage (prereading recommended!) The lecture notes where written for a direct predecessor for this course. The board differs, but the architecture (AVR) is still the same. Lab Start with exercises soon! Datasheets are available at homepage In the first two weeks the tutors will give you introductions to the environment in the lab! Preliminary Talk March 1, 2017 40
Online Information Sources Course homepage https://ti.tuwien.ac.at/ecs/teaching/courses/mclu Timetable, exercises,... TILab Homepage http://www.tilab.tuwien.ac.at Room assignments, email howto,... Preliminary Talk March 1, 2017 41
Online Information Sources TISS Forum https://tiss.tuwien.ac.at For our announcements and your questions subscribe! Informatik Forum https://informatik-forum.at Is not officially supported by us, but we check it (irregularly). Preliminary Talk March 1, 2017 42
Personal Information Sources 1 Consult online sources 2 Ask our tutors In their slot Per email (available at homepage) 3 Ask our Studienassistent Per email mc-studass@tilab.tuwien.ac.at 4 Visit us in on Fridays, from 13:00 14:00, in the Lab or write an email to mc-leitung@tilab.tuwien.ac.at Preliminary Talk March 1, 2017 43
A Word of Warning... Through Part 0 (Assembler): No compulsory exercises But: We will check your learning progress afterwards! And: The exams (both theoretical and practical) will be difficult! Preliminary Talk March 1, 2017 44
Another Word of Warning This is a practical course Do not expect that you learn everything you need by visiting the lecture. Hands-On experience is of utmost importance! Preliminary Talk March 1, 2017 45
Learning Objectives Weekly Training Objectives Lab exercises available online There is a list of recommendable exercises. Furthermore, some of those are mark, in the slides, with to show that you will definitely need this exercises at some point in the course to show that you will profit from doing that exercises They are not required for the completion of the course, yet highly recommended. We will discuss in the lecture the exercises of the previous week. Tutors Available to help you solve the exercises and give feedback on your solutions. Do not just use them as walking debuggers! Preliminary Talk March 1, 2017 46
Weekly Training Objective Next week 1.2 Board test 2.1.1 Assembler demo program 2.1.2 Makefile 2.2.1 Logical operations The week after next 2.2.2 Input with floating pins 2.2.4 Monoflop buttons 2.2.5 Digital I/O 2.4.1 precompiled LCD Until Exam 2.2.3 LED Rain 2.2.9 LED curtain 2.4.2 Calling conventions I 2.4.3 Calling conventions II Preliminary Talk March 1, 2017 47
Lecture The Lectures... will not replace your work in the laboratory! will be in the HS 14A lecture hall, every Monday, at 16:00 (c.t.). will end two weeks the second exam. After that we will be in the laboratory at the time of the lecture. Preliminary Talk March 1, 2017 48
Questions? Preliminary Talk March 1, 2017 49