EECS 373 Midterm 2 Exam Winter 2018

Similar documents
EECS 373 Midterm 2 Fall 2018

EECS 373 Midterm Winter 2016

EECS 373 Midterm Winter 2013

EECS 373 Midterm Winter 2012

EECS 373 Practice Midterm & Homework #2 Fall 2011

EECS 373 Midterm Winter 2017

EECS 373 Practice Midterm / Homework #3 Fall 2014

EECS 373, Homework 4, Fall 2018 Assigned: Wednesday 10/3; Due: Wednesday 10/10 at 10pm

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Design of Microprocessor-Based Systems

EECS 373 Lab 3: Introduction to Memory Mapped I/O

EECS 373 Fall 2018 Homework #3

esi-multichannel Timer

EECS 373 Design of Microprocessor-Based Systems

EECS 270 Midterm Exam

Architectural design proposal for real time clock for wireless microcontroller unit

EECS 470 Midterm Exam Answer Key Fall 2004

1 Contents 2 2 Overview 3 3 Hardware Interface 4 4 Software Interface Register Map Interrupts 6 5 Revision History 8

1 Contents. Version of EnSilica Ltd, All Rights Reserved

EECS 452 Midterm Closed book part Fall 2010

Final Exam. Date: May 12, 2017

EECS 470 Midterm Exam Fall 2006

CSE 466 Exam 1 Winter, 2010

Roa Logic. APB4 Multiplexer. Datasheet. October, c Roa Logic B.V.

In Class Assignment 2

Embedded Systems. 3. Hardware Software Interface. Lothar Thiele. Computer Engineering and Networks Laboratory

EE251: Tuesday December 4

1 Contents. Version of EnSilica Ltd, All Rights Reserved

EECS 473 Midterm Exam

EE251: Thursday November 30

APB4 GPIO. APB4 GPIO Datasheet Roa Logic, All rights reserved

EECS 452 Midterm Closed book part Fall 2010

EECS 470 Midterm Exam Winter 2015

1 Contents. Version of EnSilica Ltd, All Rights Reserved

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

EECS 470 Midterm Exam Fall 2014

EECS 470 Midterm Exam Winter 2008 answers

AvnetCore: Datasheet

Winford Engineering ETH32 Protocol Reference

EECS 373. Design of Microprocessor-Based Systems. Prabal Dutta University of Michigan. Announcements. Homework #2 Where was I last week?

17. I 2 C communication channel

EECS 470 Midterm Exam

Universität Dortmund. ARM Cortex-M3 Buses

A VHDL 8254 Timer core

Serial Peripheral Interface Bus SPI

FINAL EXAM. last name first name

Microcontroller & Interfacing

Unlocking the Potential of Your Microcontroller

University of Florida EEL 3744 Spring 2018 Dr. Eric M. Schwartz. Good luck!

problem maximum score 1 8pts 2 6pts 3 10pts 4 15pts 5 12pts 6 10pts 7 24pts 8 16pts 9 19pts Total 120pts

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

CoreAHBtoAPB3 v3.1. Handbook

CoreAPB3 v4.1. Handbook

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

I also provide a purpose-built ADC/DAC board to support the lab experiment. This analogue I/O board in only needed for Part 3 and 4 of VERI.

EECS 470 Final Exam Fall 2005

Embedded Systems. Software Development & Education Center. (Design & Development with Various µc)

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

University of Florida EEL 4744 Spring 2014 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 1 April Apr-14 9:03 AM

EECS 470 Final Exam Winter 2012

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

DIGITAL SYSTEM DESIGN

One and a half hours. Section A is COMPULSORY

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Engineering 100 Midterm Exam Technical Part Fall 2010

Microcontroller and Embedded Systems:

EECS 470 Midterm Exam

Chapter 2. Overview of Architecture and Microcontroller-Resources

MOTENC-Lite 4-Axis PCI Motion & I/O Control Board. Reference Manual Rev 1.1, June 20, Copyright 2005 VITAL Systems Inc

MOTENC Axis PCI Motion & I/O Control Board. Reference Manual Rev 1A, April Copyright 2004 VITAL Systems Inc

Introduction to ARM LPC2148 Microcontroller

(Embedded) Systems Programming Overview

Interrupting SmartFusion MSS Using FABINT

University of Florida EEL 3744 Spring 2017 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 22 February Mar-17 1:44 PM

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

Department of Electronics and Instrumentation Engineering Question Bank

Signature: 1. (10 points) Basic Microcontroller Concepts

ENGR 100 Midterm (CSE Part) Winter 2014

Lecture 25 March 23, 2012 Introduction to Serial Communications

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

Interrupts, timers and counters

Combinational Verilog Intro. EECS 270 Labs

Systems Programming. Lecture 4 Z16 Architecture and Programming

Accel 5 click. PID: MIKROE 3149 Weight: 24 g

Interconnects, Memory, GPIO

CENG-336 Introduction to Embedded Systems Development. Timers

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Quiz IV

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

AN 038. Getting Started with the KXTJ2. Introduction

Mercury System SB310

COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University

Logosol Joystick Node LS-731

Network Embedded Systems Sensor Networks Fall Hardware. Marcus Chang,

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

May the Schwartz be with you!

CN310 Microprocessor Systems Design

Transcription:

EECS 373 Midterm 2 Exam Winter 2018 Name: SOLUTION unique name: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: Problem # Points 1 /15 2 /15 3 /15 4 /15 5 /40 Total /100 NOTES: There are 16 pages including this one. Closed book, closed notes. Calculators are allowed, but no PDAs, Portables, Cell phones, etc. Don t spend too much time on any one problem and be sure you get to the design problem with plenty of time to spare. You have about 120 minutes for the exam. Be sure to show work and explain what you ve done when asked to do so. Getting partial credit without showing work will be rare. Throughout the exam standard logic gates means arbitrary input ANDs, ORs, NANDs, NORs, XORs and XNORs as well as NOT gates. Do not write on the back of pages, as they will not scan into the grading system. An additional page is left at the end if you need additional space. Page 1 of 16

1. Interrupts [15 pts] Part A Write a generic function in C which would set the priority of a certain interrupt, given desired preemption and subpriority values. The interrupt priority register ranges from address 0xE000E400-0xE000E4EF, with each byte in the register storing the priority for a single interrupt. Assume that the board is set to PRIGROUP 6, and that all possible priorities are implemented. void setintpriority(int interrupt, int subpriority, int preemption) { uint8_t* baseaddr = (uint8_t*)0xe00e400; baseaddr += interrupt; uint8_t priority = (preemption << 7) subpriority; *baseaddr = priority; } Page 2 of 16

Part B You are an intern at NASA tasked with assigning priorities to various interrupts on the Mars Rover. The interrupts are related to checking the battery, collecting data, motion planning, and communicating with Earth. If the robot checks its battery and finds it is low, it will enable its solar panels in order to charge. Assume that the battery check interrupt occurs at the frequency at which it is set to occur, then it will be impossible for the battery to run out. The board on the Mars Rover is set to be on PRIGROUP 5 and the priorities of the 4 interrupts are given below. Interrupt Battery check Communicate Motion Planning Collect Data Priority 0x00 0x74 0xA5 0xF3 Explain a situation in which the Mars Rover under these settings could run out of battery. NOT GRADED Page 3 of 16

Part C Briefly explain how Late Arrival support uses Tail Chaining to improve interrupt performance on ARM systems. Be sure to indicate the advantages and how they are achieved. From http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337e/ddi0337e_cort ex_m3_r1p1_trm.pdf 5.6 and 5.7

2. Timers [15 pts] You have a robot named Renee 2.0, who has a few different tasks that must be handled at different time intervals. She has: A motor driven by a PWM signal with 75% duty cycle and 200 Hz Bumper sensors that should be sampled every second A Lidar scanner that sends pulses at 100kHz Headlights that toggle every second A temperature sensor that samples every 5 minutes a. Please describe how to use two hardware timers clocked at 50MHz and additional virtual timers to handle monitoring and sampling the sensors. Please explain how to set the overflow and/or compare values and what is done at overflow and/or compare for each of the timers. Describing what is done with the sensors data and how to implement what is done is not necessary. If there is a virtual/hardware timer you do not need, write N/A under that timer. (Multiple possible answers, but here is one) Hardware Timer 1: Overflow Value: 500 At overflow send lidar pulse Hardware Timer 2: Overflow Value: 250000 Compare Value: 187500 At compare send PWM signal from high to low. At Overflow send PWM signal from low to high Virtual Timer 1: Based on Hardware Timer 2: Overflow Value: 200 At overflow toggle headlights and sample the bumpers. Virtual Timer 2: Based on Hardware Timer 2: Overflow Value: 60000 Sample the temperature sensor at Overflow Virtual Timer 3: N/A

3. Serial Busses [15 pts] You are tasked with communicating with an accelerometer over I2C. You are trying to read the acceleration along the x -axis by reading from the address 0x48. You put the transaction on the Salae and see that it is not the data you expected. Here is the timing diagram: Why was the data different than you expected? The read/write bit should be high for a read. Page 6 of 16

You are now tasked with writing the code for a I2C write transaction to a 16- bit DAC. You want to output approximately 1V from the DAC. Assume the reference voltage is 5V and ignore quantization error. The address for writing to the DAC in 0x49. Assume the SmartFusion is running at 40MHz and the DAC has a maximum I2C speed of 1MHz. You want the transmission to be as fast as possible. Fill in the blanks in the code below: #include <stdio.h> #include <inttypes.h> #include "drivers/mss_i2c/mss_i2c.h" #define TARGET_ADDRESS 0b1001001 int out1v() { uint8_t transmit_buf[] = { 0x33, 0x33 }; uint8_t receive_buf[10]; MSS_I2C_init(&g_mss_i2c1, TARGET_ADDRESS, MSS_I2C_PCLK_DIV_60); MSS_I2C_write ( &g_mss_i2c1, TARGET_ADDRESS, transmit_buf, sizeof(transmit_buf), // 2 MSS_I2C_RELEASE_BUS ); MSS_I2C_wait_complete(&g_mss_i2c1, MSS_I2C_NO_TIMEOUT); return(0); Page 7 of 16

Answer the following questions about serial interfaces: a. The peripheral you are using has both I2C and UART available as options. Dedicated hardware for both are unused on your SmartFusion. Which one is the higher performance option and why? I2C because it is faster. b. You are designing an embedded system and trying to decide which microcontroller to use on our board. Keeping the price down is the highest priority. One peripheral you are communicating with can interface with can communicate over SPI and UART. Which serial interface is better for this situation and why? UART because it uses fewer pins and pins are money. c. Consider the serial interfaces we covered in class (I2C, SPI, UART). For which one do the devices communicating have to predetermine the speed at which data will be transmitted and why? UART because it is asynchronous. Page 8 of 16

4. DAC/ADC [15 pts] a. Using 2-3 sentences, describe monotonicity and why it is important for ADCs/DACs. Monotonicity is when the output voltage/number continues to increase or stay the same over time with increasing input. This is important to ADCs/DACs because they are converting ways to represent data and should match the linear rise of input. If the output is not increasing with increasing input, this could cause large inaccuracies in the data. b. Consider the following 3-bit ADC. Draw the conversion transfer function (binary vs. input voltage) on the top graph. Draw the quantization error transfer function (error voltage vs. input voltage) on the bottom graph. Make sure transition points are clear. Assume Vref is 5V. Clearly show any work below the graph to receive partial credit.

5. Design Problem: XY Plotter [40 Points] Overview Your task is to implement the motor control for an XY plotter. Two motors will position the XY plotter head by turning one way or the other for some number of rotations to position the plotter head. The X and Y motors will be controlled with single bit signals that will turn them on and off and control whether they spin clockwise or counter clockwise. The motors also have an integrated sensor that produces several pulses per rotation. Consequently, the plotter head can be positioned from a known starting point by counting the pulses. Positioning Hardware The pulses will be counted with a hardware counter. The count value will be continuously compared to a MMIO compare register. If the compare value is equal to the count value, an interrupt will be generated to notify the software that the motor has finished rotating the designated number of counts. Since we will be controlling two motors, we will need two counters and compare registers. To verify that both counters have reached their compare values, the compare equal bit will have to be read by the software via MMIO. Software Function Setting the compare value, motor direction and turning the motors on and off will be handled by a software driver you will write. Stopping the motor will be handled in an interrupt that you will write. Considerations and Design Assumptions 1. The pulses that come from the rotational sensors are not synchronous with your hardware clock (PCLK). 2. FABINT is a 10ns high pulse. 3. You can assume the XY plotter was initialized to X position = 0, Y position = 0; 4. A 32-bit counter is sufficient size and should be used for the rotational pulse counter. 5. PCLK is 100MHz Memory Mapped IO Addresses: Table 1 Register Address Bit Map X Counter Register 0x40050000, 32 bit read write 31 MSB, 0 LSB Y Counter Register 0x40050004, 32 bit read write 31 MSB, 0 LSB X Counter Compare Register 0x40050008, 32 bit read write 31 MSB, 0 LSB Y Counter Compare Register 0x4005000C, 32 bit read write 31 MSB, 0 LSB Motor Control Register 0x40050010, 32 bit read write Bit 0 X Motor On/Off, Bit 1 X Motor DIR Bit 2 Y Motor On/Off, Bit 3 Y Motor DIR Compare Status Register 0x40050014, 32 bit read only Bit 0 X Compare, Bit 1 Y Compare There are 3 parts to this problem. Read them all before doing any one part. Consider how the functionality will be divided across the parts. Page 10 of 16

Part 1: Hardware Design (20pts) Provide the Verilog that implements the motor rotational pulse counters, interrupt generation and MMIO interface listed in Table 1. The following module interface is provided along with its decleration. module bob( /*** APB3 BUS INTERFACE ***/ input PCLK, // clock input PRESERN, // system reset input PSEL, // peripheral select input PENABLE, // distinguishes access phase output wire PREADY, // peripheral ready signal output wire PSLVERR, // error signal input PWRITE, // distinguishes read and write cycles input [31:0] PADDR, // I/O address input wire [31:0] PWDATA, // data from processor to I/O device (32 bits) output reg [31:0] PRDATA, // data to processor from I/O device (32-bits) /*** I/O PORTS DECLARATION ***/ output reg FABINT, output xmon, // x motor on or off, logical 1 is on output xmdir, // x motor direction, logical 1 is clockwise output ymon, // y motor on or off, logical 1 is on output ymdir, // y motor direction, logical 1 is clockwise input xmp, // x motor compare register status, 1 is equal 0 is not equal input ymp ); // y motor compare register status, 1 is equal 0 is not equal Two answer pages follow. Please use these pages instead of writing on the back. Hint: Organize your answer into functional sections. Variable declaration, MMIO interface, rotational pulse counter, etc. Page 11 of 16

Part 1: Hardware Design (answer page 1) assign PSLVERR = 0; assign PREADY = 1; wire write = PENABLE & PSEL & PWRITE; wire read = PENABLE & PSEL &!PWRITE; reg [31:0] comparex, comparey, mcontrol, countx, county; reg Q0, Q1, xmpsynch, ympsynch, xeq, yeq, F1, F2; /* assign motor control bits */ assign xmon = mcontrol[0]; assign xdir = mcontrol[1]; assign xdir = mcontrol[2]; assign xdir = mcontrol[3]; /*mmio interface */ always @(posedge PCLK) begin /* MMIO */ if (write) begin case (PADDR[7:0]) 'h0: countx <= PWDATA; 'h4: county <= PWDATA; 'h8: comparex <= PWDATA; 'hc: comparey <= PWDATA; 'h10: mcontrol <= PWDATA; default: countx <= PWDATA; endcase end else if (read) begin case (PADDR[7:0]) 'h0: PRDATA <= countx; 'h4: PRDATA <= county; 'h8: PRDATA <= comparex; 'hc: PRDATA <= comparey; 'h10: PRDATA <= mcontrol; 'h14: PRDATA <= {30'b0, yeq, xeq}; default: PRDATA <= countx; endcase end

/* synch pulses */ Q0 <= xmp; xmpsynch <= Q0; Q1 <= ymp; ympsynch <= Q1; /* count pulse */ if ( countx == comparex) xeq <= 1; if ( county == comparey) yeq <= 1; if (xmpsynch &!xeq) countx <= countx+1; if (ympsynch &!yeq) county <= county+1; /* FABINT generation needs rising edge detection*/ Q0 <=xeq; Q1 <= Q0; F1 <= Q0 &!Q1; Q0 <=yeq; Q1 <= Q0; F2 <= Q0 &!Q1; FABINT <= F1 F2; end endmodule

Part 2: Software: Motor Driver (10pts) Wirte a C function that turns the motor on and off, sets the direction and the number of counts the motor must travel from the current position. Assume you do not know the current count for the sensor rotational pulses. Each motor will have its own driver. You need only write the driver for motor_x void motor_x(int monoff, int mdir, int counts) ; monoff turns the motor on and off. Logical 1 is on and logical 0 is off. mdir sets the direction of the motor. Logical 1 turns the motor clockwise, logical 0 turns counter clockwise. counts are the number of pulses the motor must rotate from the current position. void motor(int monoff, int mdir, int counts){ int* counterx = (int *)0x40050000; int* comparex = (int *)0x40050008; int* mcontrol = (int *)0x400500010; *counterx = 0; *comparex = counts; *mcontrol &=FFFC; *mcontrol =monoff (mdiv<<1) }

Part 3: Software: Compare Interrupt (10pts) Complete the following interrupt compare function that will stop the motors once the compare value is reached. No other control features or registers should be changed. _attribute_((interrupt)) void Fabric_IRQHandler( void ) { int* status = (int *)0x40050014; int* mcontrol = (int *)0x400500010; if ()*status & 1) *mcontrol = *mcontrol & 0xfffe; if ()*status & 2) *mcontrol = *mcontrol & 0xfffb; }