Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Winter Examination Period 2021  January - Semester A

ECS714P Embedded Systems

Question 1

a) Give brief answers to the following questions:

i)    What are the characteristics of an 'embedded' (computer) system that distinguish it from a standard PC or laptop?

ii)   Explain what is meant by the term concurrency’, applied both to the behaviour of an embedded system and to its implementation.

iii)   Describe two challenges of debugging software in an embedded system that make it more difficult to debug than most other software. You should not write about debugging techniques. [12 marks]

b) A micro-controller contains a 32-bit General Purpose I/O (GPIO) port that can be used for both input and output. The following table shows some registers associated with a GPIO port in the KL25Z micro-controller:

Base

Port data output register (PDOR)

Base+4

Port set output register (PSOR)

 

 

 

Base+16

Port data input register (PDIR)

Base+20

Port Data Direction Register (PDDR)

The following code (with added line numbers) uses some of these registers. Assume a suitable definition of the macros.

1    PTB->PDOR |= MASK(RED_LED_POS);

2    PTB->PSOR = MASK(RED_LED_POS);

i)    Lines 1 and 2 show two different ways to set one output bit. Explain how both work, including the advantage of the code on line 2.

ii)   There is a requirement to use another pin in GPIO port PTB as an input. Briefly explain how the GPIO port is configured to allow some pins to be used for input and others for output.

iii)  Once a bit in the GPIO port that has been configured as an input, a program needs to be able to read its value. Outline one method for doing this. [9 marks]

c) Briefly outline what happens when an interrupt is triggered (e.g. by a rising edge on an input pin). Your answer should include how the code that handles the interrupt is found (i.e. its location in memory). [4 marks]

[Total 25 marks]

Question 2

a) Give brief answers to the following questions about timers.

i)    A timer has a counter with N bits that is clocked with a frequency F Hz. Explain how the maximum interval that can be timed is determined.

ii)   In a cyclic system a set of tasks is to be executed every 10ms. Depending on the state of the system, the execution of the tasks takes between 3 and 9ms. Explain how the SysTick timer can be used to ensure that execution occurs every 10ms. [6 marks]

b) Give brief answers to the following questions about the use of Pulse Width Modulation (PWM).

i)    Explain what is meant by modulation frequency’ as applied to PWM and suggest a suitable modulation frequency to vary the brightness of some LEDs.

ii)   A PWM peripheral (such as the KL25Z’s TPM) has a single 16-bit counter, with a  frequency of F Hz and a modulo value (MOD), and two channels each with a channel value (CnV1 and CnV2). The first channel is required to have a duty cycle of 25% and the second one of 75%. Explain what channel values should be used. [6 marks]

c) Give brief answers to the following questions about program executions and clocks.

i)    You are informed that ‘the KL25Z has a maximum CPU clock of 48 MHz’ . Explain how to use this information to estimate the time taken to execute a sequence of instructions.

ii)   An application requires sensor data to be read and written to memory at a high sample rate. A solution is designed using an ISR, but when tested it is found that so much CPU time is used by the ISR that the data cannot be processed. Suggest a solution, outlining your alternative design. [8 marks]

d) A system is required to scan a set of sensors every few minutes but must use very little power. Outline the capabilities of an MCU such as the KL25Z that can be used to meet these requirements [5 marks]

[Total 25 marks]


Question 3

a) A development board such as the FRDM KL25Z, contains a micro-controller (such as the NXP KL25Z).

i)  A program is written in C using a suitable IDE (such as the ARM Keil MDK).  Explain the features of the IDE and of the development board that enable the program to be run on the KL25Z.

ii) The development board is running a program that periodically gathers data from sensors when it is disconnected from the power supply. Explain what happens when the power is reconnected, considering the program, its execution and the  sensor data. [6 marks]

b) An embedded system has tasks A, B and C. Two designs are being considered: either using a cyclic system without an RTOS or using an RTOS.

i)    Outline and compare the way the code for the tasks is organised and executed in the two designs. Assume that the tasks are independent.

ii)   You now learn that the tasks are not independent but interact, with data flowing from Task A to Tasks B and C. Explain whether this is possible in both designs and how it is achieved in each case. [6 marks]

c) Give brief answers to the following questions about scheduling the set of tasks with the periods and worse case execution times (WCET) shown below.

Task

Period

WCET

A

12

4

B

16

6

C

8

1

i)    Explain whether the tasks can be scheduled using the Earliest Deadline First (EDF) policy.

ii)    Either give a schedule to execute these tasks using a cyclic system or explain why this is not possible. [6 marks]

d) A micro-controller such as the KL25Z includes a USART for serial communication. Considering only transmission of data, give brief answers to the following questions:

i)    A byte of data is to be transmitted. Briefly explain the signals (i.e. voltage levels) used to send the data.

ii)   The data is to be transmitted at 9600 baud. Calculate the type taken to transmit at single byte, noting any assumptions.

iii)   An array of data bytes is to be sent. Outline a possible s/w architecture for interfacing with the USART. [7 marks]

[Total 25 marks]

Question 4

A proposed system has the following required behaviour:

In a computer-controlled plant, bottles on a conveyor belt are positioned one by one under a nozzle used to fill each bottle with a vital liquid. The conveyor belt has a motor (M1), which is either on or off. The weight (i.e. mass) (W) of the bottle and any liquid it contains can be sensed. The filling nozzle is lowered into position by a second motor  (M2), also with on and off control only. Finally, the flow of liquid through the nozzle is controlled by a valve (V); the position of the valve varies depending on the voltage applied, varying from closed with 0v to fully open with the maximum voltage.

Each cycle of the system has the following sequence: first the conveyor motor (M1) runs for time T1; then the nozzle is lowered (motor M2) for time T2. After this, the valve is opened, with the valve position determined by the weight. The aim is to insert a given weight of liquid (WL) into the bottle, so the weight of the empty bottle is sensed first and then repeatedly as the bottle fills. At first the valve is 100% open, with the percentage reduced progressively until the liquid added is WL, at which point the valve closes         completely.

Answer the following questions relating to these requirements.

a) The system is being implemented using a FRDM KL25Z development board. Answer the following questions about peripherals to use.

i)    Explain what peripheral you would use for the on and off control of motors M1 and M2, briefly justifying your choice.

ii)   Explain which peripheral should be used to connect the weight sensor W to the system, briefly justifying your choice.

iii)   Given the requirement to vary the degree of opening, explain which peripheral you would choose to connect the valve V to the system. [6 marks]

b) Draw a state transition model showing the operation of the system. Your answer should include:

•   A list of states, with a short description of each state and each transition.

•   A diagram showing states and transitions. The transitions should be labelled with conditions and actions.

If you consider that there are any ambiguities in the requirements, you should explain the ambiguity and how it is resolved in your model. [10 marks]

c) Outline the code that implements the state transition model given in answer to b),    noting whether you propose to use an RTOS or not. Your answer should cover how timing is implemented but there is no need to write exact code. [9 marks]

[Total 25 marks]