Transcript
Department of Electronics, Telecommunications and Computing Integrated Masters in Electronic and Telecommunications Engineering Embedded Systems Programming 2015/2016
Project Report Microwave Controller Firmware
Authors 25828 Luís Almeida 59510 Sofia Marques 64215 Francisco Castro 64884 Bruno Grego Company SoftProgramming Group 2 Date
14/12/2015
Teaching Pedro Fonseca Resume
In this project we will talk about our approaches to create a firmware robust and solid enough to control a Microwave, according to the specifications of the client. We will show our rezoning and problems encountered and the solutions encountered to resolve them.
Project Report Microwave Controller Firmware
1 Index Introduction ........................................................................................... 2 Project requirements ............................................................................. 3 Technical specifications .................................................................... 3 Budget .............................................................................................. 3 Timeline ............................................................................................ 3 Firmware ................................................................................................ 5 State Machines ................................................................................. 5 Main program ................................................................................... 9 Modules .......................................................................................... 10 Unit tests .............................................................................................. 12 Level 1 ............................................................................................ 12 Level 2 ............................................................................................ 13 Risk analysis ........................................................................................ 15 Conclusion ........................................................................................... 18 References ........................................................................................... 19 Annexes ……………………………………………………………………….20
Embedded Systems Programming Aveiro University
Page 1
Project Report Microwave Controller Firmware
2 Introduction In the following report we aim to demonstrate how was our approach to the creation of a robust and solid firmware, capable of controlling a Microwave according to the client specifications. We will also talk about our reasoning process and creation of the said firmware, and the problems encountered in its creation and the solutions implemented. Also the unit tests and all the board tests will be discussed in order to demonstrate that our project was developed and tested in order to assess all problems and bugs that could be sorted. Firmware is defined as a software program or a set of instructions programmed on a hardware device. It is typically stored in non-volatile memory devices. Embedded systems are examples of devices containing firmware, being the Microwave an example of an embedded system containing a firmware that was requested to be created and implemented by our company. In a first stage, it is presented the project requirements that include the technical specifications of the product, the proposed budget and the expected timeline. The next stage aims to clarify the different processes that were used throughout the creation and implementation of the firmware, starting with the study and development of the state machines. These are used as a way of modeling the behavior of systems and it is a methodology used in embedded systems, where the system commutes from one state to another in association to events or conditions. It is a tool that allows to have clearly overview of the essential functions that must be implemented and how the system must work [1]. Moving on to the next point it is presented and explained in detail the function main, followed by a description of the modules that compose the code. Unit tests consists of small units of code that are tested and it is the base of Test-Driven Development which is a software development process to develop code incrementally. This method suggests that tests are defined before the code is written and the code is only accepted if it passes those tests [2]. In this project the unit tests were implement using the CppUTest framework to perform a series of tests that will ensure the validation of the code. Then, a basic framework was developed in order to test the firmware in the target hardware. Finally, an analysis of the risks associated with the product is presented, based on metrics explained in full detail in the respective section. This is an extremely important part of the project since it aims to develop code for a product that is used daily by people and as any other device it comes with possible situations that may cause harm to the users. In the end we achieved great results with a functional firmware developed using the board ATxmega256A3BU from Atmel® [3], able to create all the desired functions that the client wanted and in an easy, fast and intuitive use.
Embedded Systems Programming Aveiro University
Page 2
Project Report Microwave Controller Firmware
3 Project requirements 3.1 Technical Specifications The client demanded a full operational firmware to control a microwave oven that meets the following requirements:
A user interface with a 4 digit 7-segment display and 5 touch buttons ("+" - increase, "-" decrease, Start/Stop, Power and Time) capable of controlling the microwave’s power and clock. When the Power button is pressed there are 4 modes of average power: 750W, 500W, 350W and 150W controlled by the +/- buttons. For average power calculations, if the microwave clock is configured with a time lesser than 1 minute, the period of the magnetron’s on-off cycle is 4.5 seconds, otherwise the period is 9 seconds. When the Time button is pressed there is 3 modes of controlling the microwave clock: if the time is lesser than 1 min, the time is increased/decreased (+/- buttons) by the second. If the time is between 1 to 3 min the time is increased/decreased in multiples of 10 seconds. At last, if the time is greater than 3 minutes the time is increased/decreased in multiples of 30 seconds. The minimum setting time is 5 seconds. After setting the average power and microwave clock, when the start/stop button is pressed the microwave starts to work normally and the time starts to decrease second by second. While the microwave is active, if the Start/Stop button is pressed, the time freezes. If the Power button is pressed, the display shows the power setting for 2 seconds and then returns to show the remaining time. While the microwave is active, if the door is opened the microwave’s magnetron will be turned off. If the triac’s temperature rises above 80 Celsius degrees, the microwave will be shut down. A proper controller to the oven light and the turntable motor will also be implemented.
After analysing the client's order, the company proposed some extra features to guarantee the proper function and safety of the microwave:
While the microwave is active, if the door is opened, the microwave will be turned off and the clock freezes. Then, when the door is closed again, the microwave goes back to working normally, starting from the time previously froze. While the microwave door is open, the oven light is on and the turntable is turned off. Whenever the microwave is turned off the turntable and the light are also turned off. The user can turn the microwave off by pressing the Start/Stop button for 3 seconds. To turn it on press the Start button.
3.2 Budget As agreed with the client, the project budget is 7500 € + IVA.
3.3 Timeline The project had the duration of two months and the work plan was the following.
Embedded Systems Programming Aveiro University
Page 3
Project Report Microwave Controller Firmware
Figure 1- Project Gantt chart
Embedded Systems Programming Aveiro University
Page 4
Project Report Microwave Controller Firmware
4 Firmware Initially in order to be easier to develop the code necessary and to figure out the required requisites for the Microwave we started to develop the state machines that would rule our firmware actions. After the determination of said state machines we started developing the code in modules, to make it more easy to read and to prevent situations were one would need to remove one function or one another and the full program would still work with the new functionality or without the removed module. After the creation of the modules we passed on to the creation for a main function that would join all the modules and control the microwave behaviour and provide the necessary functions for the user interface with the microwave. On the next chapters, we will prevent the results that we achieved.
4.1 State Machines In the next figure is presented a state machine that represent the microwave normal working, in a high level perspective.
Figure 2- Global State Machine
When you plug in the microwave, its starts in a standby mode (saving power mode), that waits for the user to press any button to turn on the LCD with 1 minute and a power of 750 W configured by default. Then the user can press start to initiate the cooking process. While the microwave is in the cooking process, if the door is opened, the microwave will transit to the pause mode, which saves the current time and turns off the microwave magnetron. The return to the cooking process the user must shut down the door, and press the Start/Stop button. If the time reach the 0 value, that indicates that the cooking is completed, and the microwave magnetron must be turned off. To back to the cooking process the user must configure the desired time and press the Start/Stop button. In all on sub-states, if temperature reach 80 degrees or the Start/Stop button is pressed more than 3 seconds, the microwave pass to the stand-by state. The microwave only back’s to On state only if temperature is lesser than 80 degrees. The upper region represents Embedded Systems Programming Aveiro University
Page 5
Project Report Microwave Controller Firmware the ability of the firmware to change the current value of Power and Time anytime. To do so, the user must press the Time button and use the “+” or “-“to select the desired time. To change the value of the average power, the user press the Power button and repeat the previous behaviour. In the annexes A is presented a flow diagram, which explain the high level logic with more detail.
Next is presented the Time state machine.
Figure 3 - Time Menu State Machine
Time state machine only have one State, because this module only do 3 tings, increase, decrease and save the current time value. If is pressed the “+” button the time must increase one seconds, if “-“button is pressed the time must be decrease one seconds, and if no button is pressed nothing is supposed to happen, and the current time value is saved. In the annex is presented a flow diagram that explain with more detail the Time module logic (annexes B). Last, it’s presented a state machine to modulate Power module behaviour.
Figure 4 - Power Menu Sate Machine
By default, the microwave is initiate with maximum power, because in real life, people tend to use always the maximum power. Then if the user press “-“in while in the Power menu, the power is decrease to a minimum value of 150 W. Now if the user press the “+” the power is increased to a maximum value of 750W. One more time, in annexes is presented a more detail flow diagram to better understand the behaviour of the Power module (Annexes C).
Embedded Systems Programming Aveiro University
Page 6
Project Report Microwave Controller Firmware Now, that was explained the top level of the microwave working, it will be presented flow diagrams, to explain with more detail the microwave behaviour. The diagrams talk for themselves, so explanations will be skipped. When the microwave is powered on we have the following state machine.
Figure 5 - Microwave Power On Flow diagram
As we can see in the figure, when the user press the time button, he can change the microwave time while the microwave is on. The same happen to the power, the user only need to press the power button and the press “+” or “-“to change the average microwave power. While the microwave is on, when the door is opened the microwave change to “Door Open” that immediately shut down the microwave magnetron. Otherwise, the microwave check if there is still time left, and if it isn’t change to “Stop State”. If the stop button if pressed, the microwave change to “Stop State”. If this button is pressed more than 3 seconds than the microwave change to “Standby” mode.
Embedded Systems Programming Aveiro University
Page 7
Project Report Microwave Controller Firmware And finally we have the flow diagram for when the microwave is working and when it is stopped. This flow diagrams talk for themselves, so the explanation will be skipped.
Figure 6 - Microwave Working flow diagram
Figure 7 - Microwave Stopped flow diagram
Has we can see reading the flow diagrams and the state machine, we are able to understand the next state in any moment of the Microwave and what can happen in the various situations.
Embedded Systems Programming Aveiro University
Page 8
Project Report Microwave Controller Firmware
4.2 Main program Next we will be talking about main function, the one that controls all modules and interactions with the user and the Microwave. We can see in Figure 8, a flow chart of the cycle for the main function considering all its possibilities.
Figure 8 - Main Function Cycle
Embedded Systems Programming Aveiro University
Page 9
Project Report Microwave Controller Firmware When the board starts, the main function runs all its configurations, then performs all tests available in order to determine if any problem was detected in the configuration process, this also consists in some consistency tests to some modules. Has predefined values the program starts with 1 minute of working time and a power of 750 W, the maximum value available, according to the definitions of the client. Next working cycle starts. We perform a check for the status of all buttons present on the system. Next we check if the microwave was powered on, in order to turn the correspondent LED on to signal its status. Next we check for the shutdown sequence which detects if the user if pressing consecutively for 3 seconds on the start button, resulting in powering off the Microwave, turning off the LED that signals it is power on and powering off the LED that displays the power and time settings. Then if the microwave is not powered on we go back and start the working cycle again, but if it is, we perform a read on the temperature present inside the microwave. After that if the temperature is above the limit level the microwave will shut down and stop everything it was doing in order to prevent any malfunction or danger to the user and destruction of the microwave. If the temperature is below the limit level, we then check the state of the door. If it is open the cycle stops and goes back to the start and does everything again, if it closed it goes forward and checks if there was a request to start the microwave and the required definitions weren’t assembled (time different than zero, and closed door, and the microwave power is on). Next we check if the time menu button was pressed and if it was the main function calls the function that controls the time menu behaviour and when it is done comes back to this point. Next we check if the power menu button was pressed and if it was the main function calls the function that controls the power menu behaviour and when it is done comes back to this point. Finally, if the conditions are met we check if the microwave has the required definitions to be able to start, if it doesn’t, it remains stopped. After all these steps we send all the relevant information to the LCD, printing the value of the power selected and the time defined for the microwave to work, and then the working cycle of the main function restarts again.
4.3 Modules We created modules in order to more adequately organize the code and to be able to develop the main function so that if we remove one module it is a matter of only disabling it by simply commenting some lines of codes. We created the following modules:
Power Module: o Module that controls the power menu and functions in the microwave. Increases and decreases power by pressing the plus and minus button; sets the power (internal function); resets the power and gets the power level if required. Time Module: o Module that controls the time menu and functions in the microwave. Increases and decreases time by pressing plus and minus button; sets time (internal function); resets time and gets time if required. Configuration of the timers is necessary to do the update of the time clock. Update time function allows to decrease the time every one second, being triggered by the timer configured in the beginning of the program. PWM Configuration: o Module that controls the configuration of the PWM signal necessary to send to the microwave’s magnetron when the microwave is working.
Embedded Systems Programming Aveiro University
Page 10
Project Report Microwave Controller Firmware
Control Buttons: o Module that configures and checks the status of all buttons and saves them in internal variables in order to use in the other functions and main function. LEDs Module: o Module that configures and defines the status of the LEDs used in the simulation of the microwave environment. Microwave Module: o Module that contains all the functions from main, making it easier to read and more organized. Has all the functions described in the chapter 4.2 and we can also check it in Figure 8.
Embedded Systems Programming Aveiro University
Page 11
Project Report Microwave Controller Firmware
5 Unit Tests A set of unit tests [4] was implemented to test power and time modules. The unit tests were implemented with CppUTest framework in the development phase (level 1) and was also created a simple framework [5] to run the unit tests on the project development board (level 2).
5.1 Level 1 The next 2 tables present the unit tests performed in the CppUTest framework.
Table 1 - Time module unit tests that ran in the CppUTest framework
Test ID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Description
Check
Tests the functions setClockTime and getClockTime. Sets the internal clock to 01:30 and verifies it. Tests the function resetClock. The internal clock is set to 59:59 initially and after the function call the time is 01:00. Tests the function increaseTime in the under 1 minute condition. The internal clock is set to 00:30 initially and after the function call the time is 00:31. Tests the function increaseTime in the 1 minute condition. The internal clock is set to 00:59 initially and after the function call the time is 01:00. Tests the function increaseTime in the over 1 minute and under 3 minutes condition. The internal clock is set to 01:00 initially and after the function call the time is 01:10. Tests the function increaseTime in the 3 minutes condition. The internal clock is set to 02:50 initially and after the function call the time is 03:00. Tests the function increaseTime in the over 3 minutes condition. The internal clock is set to 04:00 initially and after the function call the time is 04:30. Tests the function increaseTime in the upper limit condition. The internal clock is set to 59:30 initially and after the function call the time is 59:59. Tests the function increaseTime in the over limit condition. The internal clock is set to 59:59 initially and after the function call the time is 59:59. Tests the function decreaseTime in the under limit condition. The internal clock is set to 00:00 initially and after the function call the time is 00:00. Tests the function decreaseTime in the under 1 minute condition. The internal clock is set to 00:30 initially and after the function call the time is 00:29. Tests the function decreaseTime in the 1 minute condition. The internal clock is set to 01:00 initially and after the function call the time is 00:59. Tests the function decreaseTime in the over 1 minute and under 3 minutes condition. The internal clock is set to 02:50 initially and after the function call the time is 02:40. Tests the function decreaseTime in the 3 minutes condition. The internal clock is set to 03:00 initially and after the function call the time is 02:50. Tests the function increaseTime in the over 3 minutes condition. The internal clock is set to 04:30 initially and after the function call the time is 04:00. Tests the function decreaseTime in the upper limit condition. The internal clock is set to 59:59 initially and after the function call the time is 59:30. Tests the function updateClockTime in the 2 minute condition. The internal clock is set to 02:00 initially and after the function call the time is 01:59.
Embedded Systems Programming Aveiro University
Page 12
Project Report Microwave Controller Firmware Table 2 - Power module unit tests that ran in the CppUTest framework
Test ID 1 2 3 4 5 6 7 8 9
Description
Check
Tests the functions setPower, getPower and resetPower. Sets the internal power value to 500 W, resets it to 750 W and verifies both values. Tests the function increasePower with the initial internal power value set to 150 W. After the function call the value is 350 W. Tests the function increasePower with the initial internal power value set to 350 W. After the function call the value is 500 W. Tests the function increasePower with the initial internal power value set to 500 W. After the function call the value is 750 W. Tests the function increasePower in the over limit condition, with the initial internal power value set to 750 W. After the function call the value is 750 W. Tests the function decreasePower with the initial internal power value set to 750 W. After the function call the value is 500 W. Tests the function decreasePower with the initial internal power value set to 500 W. After the function call the value is 350 W. Tests the function decreasePower with the initial internal power value set to 350 W. After the function call the value is 150 W. Tests the function decreasePower in the under limit condition, with the initial internal power value set to 150 W. After the function call the value is 150 W.
5.2 Level 2 In order to test power and time modules on the target hardware was developed a basic framework composed by two files, UnitTests.c and UnitTests.h. A global function runUnitTests is called on the main function to run all the unit tests. The function checkEqual checks if the two values passed as arguments are equal and prints in the terminal an error message if not. The function printResults prints the overall results in the terminal. TimeModuleTest and PowerModuleTest functions implement the unit tests for each module. The tests to both modules are done sequentially to simplify initial conditions.
Embedded Systems Programming Aveiro University
Page 13
Project Report Microwave Controller Firmware Table 3 - Time module unit tests that ran in the target hardware with the basic framework developed
Test ID 1
2
3
4
5
6
7
8
9
10
Description
Check
Tests the function decreaseTime in the under 1 minute and under limit conditions. The internal clock is reset to 01:00 and the function decreaseTime is called 61 times. The final clock time is 00:00. Tests the function increaseTime in the under 1 minute condition. The internal clock initially time is 00:00, the function increaseTime is called 60 times and the final clock time is 01:00. Tests the function increaseTime in the over 1 minute and under 3 minutes condition. The internal clock initially time is 01:00, the function increaseTime is called 1 time and the final clock time is 01:10. Tests the function increaseTime in the over 3 minutes condition. The internal clock initially time is 01:10, the function increaseTime is called 12 times and the final clock time is 03:30. Tests the function increaseTime in the upper and over limit conditions. The internal clock initially time is 03:30, the function increaseTime is called 114 times and the final clock time is 59:59. Tests the function decreaseTime in the upper limit condition. The internal clock initially time is 59:59, the function decreaseTime is called 1 time and the final clock time is 59:30. Tests the function decreaseTime in the over 3 minutes condition. The internal clock initially time is 59:30, the function decreaseTime is called 1 time and the final clock time is 59:00. Tests the function decreaseTime in the over 1 minute and under 3 minutes condition. The internal clock initially time is 59:00, the function decreaseTime is called 113 times and the final clock time is 02:50. Tests the function decreaseTime in the under 1 minute condition. The internal clock initially time is 02:50, the function decreaseTime is called 12 times and the final clock time is 00:59. Tests the function updateTime. The internal clock initially time is 00:59, the function increaseTime is called 7 times, the function updateTime is called 1 time and the final clock time is 01:59.
Table 4 - Power module unit tests that ran in the target hardware with the basic framework developed
Test ID 1 2 3 4 5 6 7 8
Description
Check
Tests the function decreasePower with the initial internal power value set to 750 W. The power is initially reset to 750 W and after the function call the value is 500 W. Tests the function decreasePower with the initial internal power value in 500 W. After the function call the value is 350 W. Tests the function decreasePower with the initial internal power value in 350 W. After the function call the value is 150 W. Tests the function decreasePower in the under limit condition, with the initial internal power value in 150 W. After the function call the value is 150 W. Tests the function increasePower with the initial internal power value in 150 W. After the function call the value is 350 W. Tests the function increasePower with the initial internal power value in 350 W. After the function call the value is 500 W. Tests the function increasePower with the initial internal power value in 500 W. After the function call the value is 750 W. Tests the function increasePower in the over limit condition, with the initial internal power value in 750 W. After the function call the value is 750 W.
Embedded Systems Programming Aveiro University
Page 14
Project Report Microwave Controller Firmware
6 Risk analysis "Risk is defined as this uncertainty of outcome, whether positive opportunity or negative threat, of actions and events. The risk has to be assessed in respect of the combination of the likelihood of something happening, and the impact which arises if it does actually happen. Risk management includes identifying and assessing risks (the “inherent risks”) and then responding to them." [6] To perform an assessment on the possible risks of this project it was used the risk matrix template available on e-learning which is based on the parameters "Mishap Severity Categories (MIL-STD-882)" to evaluate the severity of the risk and "Failure Probability Levels(MIL-STD-882)" to evaluate the probability of it to happen. [7] On an initial analysis, the following risks were marked and categorized [8]: 1. Microwave door or other part of the oven breaks while the magnetron is on This risk has as consequence radiation emission to the outside of the microwave that in significant quantities can lead to critical situations since the radiation emitted by the microwave can be extremely dangerous when in contact with persons. Despite the likelihood being remote, the level attributed is 2, accordingly to the risk matrix. 2. Door sensor does not recognize when the door effectively opens/closes As described above, this risk has also as consequence the radiation emission to the outside since the door sensor is responsible to detect the opening of the door that will force the magnetron to stop. Despite the likelihood being remote, the level attributed is 2, accordingly to the risk matrix. 3. Temperature sensor does not work properly (fails to read the temperature) The client requires that if the temperature rises above 80˚C, the microwave must be switched off. If the temperature sensor fails there might be a rise in temperature that exceeds maximum values and can lead to a fire. Despite the likelihood being remote, the level attributed is 2, accordingly to the risk matrix. 4. Power outage forcing the microwave to shutdown during operation If there is a power outage while the microwave is working there might be data corruption due to it being forced to shut down during operation. This is likely to happen since it is not controlled by the microwave and has a marginal severity that does not implicate dangerous situations but only microwave's malfunctions, so the level attributed is 2. 5. Power does not correspond to the desired values If the power does not correspond to the desired values food may be too heated or not heated enough. In extreme cases, some foods or plastics may burn or melt. Despite the
Embedded Systems Programming Aveiro University
Page 15
Project Report Microwave Controller Firmware
likelihood being remote, the extremes cases lead to this being categorized as critical, so the level attributed is 2. 6. Magnetron does not stop when time reaches zero It is expected that when the time set reaches zero the magnetron will stop. If this does not happen food may be overcooked and in extremes cases some foods or plastics may burn or melt. Despite the, so the level attributed is 2. 7. Blocked ventilation caused by user's faulty Blocking the microwave's ventilation may lead to overheating and in extreme cases may cause a fire. The likelihood is occasional due to being a user's fault and since it can lead to critical situations, the level attributed is 2. 8. Microwave light burns out or faulty illumination This may happen occasionally and as a consequence the user won't be able to properly see the cooking state of the food. Since it does not implicate dangerous situations, it is categorized as negligible, so the level attributed is 3.
After identifying the possible risks and their likelihood and severity and attributing a level accordingly to the risk matrix, it is time to proceed to the residual risk analysis starting by identifying the solution for each risk mentioned above: 1. Implement system to measure the radiation quantity inside the microwave and turn off magnetron in case of lower values. Implement shock sensors in case of fall By implementing this solution the risk of emission of radiation to the outside is reduced, since it guarantees high reliability by creating redundancy that is provided by using a radiation measurement system and shock sensors. With this solution it is unlikely that radiation is emitted to the outside, being still categorized as a critical situation if it still happens. Level 3 is attributed then. 2. Implement a redundant door sensor and use the radiation measurement system to ensure that the magnetron is turned off This solution also allows redundancy by implementing a second door sensor and using the radiation measurement system to detect lower values of radiation. With this solution the probability of the risk is reduced to unlikely, being still categorized as a critical situation. The level 3 is attributed. 3. Implement a redundant temperature sensor The probability of the risk associated with this solution is reduced by resorting also to redundancy. Using a second temperature sensor works as a guarantee, preventing the temperature from reaching maximum values. It is unlikely that the second
Embedded Systems Programming Aveiro University
Page 16
Project Report Microwave Controller Firmware
temperature sensor also fails, still if it does the category is critical and so the level attributed is 3. 4. Implement a system to monitor supply power and reset the microwave controller if a high variation peak is detected To prevent data corruption in case of a power outage it is proposed to implement a system to monitor the supply power and in a case of a high variation peak the microwave is reset, lowering the probability of the data being corrupted. With this system it is unlikely that there will be data corruption but if it does the severity is marginal since it does not lead to dangerous situations, so the level attributed is the lowest (level 4), accordingly to the risk matrix. 5. Firmware restores the desired value if the radiation measured is not the expected Implement a power detection system that restores the values to the expected values, reducing the probability of the associated risk. It is unlikely that this system will fail and it comes with marginal severity. The level 4 is attributed. 6. Use radiation measurement system to verify that magnetron is still on and reset the system Resorting to the radiation measurement system, it is possible to verify if the magnetron is still on when it shouldn't be and reset it. This system is unlikely to fail and the severity of this risk is marginal, so it is categorized as level 4. 7. Add "Do Not Cover" on top of the microwave To prevent this user's fault by adding a notice on a spot that is easy viewable by the user the probability of the associated risk is reduced to being unlikely of happening with a marginal severity. It is attributed the level 4. 8. Add a second light that turns on in case of failure of second light With a second light the risk associated is reduced to being unlikely and with a marginal severity. It is attributed the level 4.
Embedded Systems Programming Aveiro University
Page 17
Project Report Microwave Controller Firmware
7 Conclusion In accordance with the client some changes were made to the initial requirements. The 4-digit 7-segment display was replaced by the development board LCD, which can be used in the final product if desired. In consequence, the requirement of showing the power setting for 2 seconds and then return to show the remaining time was removed. Once the LCD can show more information we take the decision of LCD showing always both power and time while the microwave is on and an arrow symbol (“->”) indicates the selected menu. Another little change was made, now the microwave can be turned by pressing the start/stop button, the time menu button and the power menu button. If one of the first 2 is pressed the time menu is initially selected and if the third is pressed it is selected the power menu, as it should be. Also in accordance with the client some features were added in order to improve the user interface: it is possible to change both power and time while the microwave’s oven is on; by default initial power is 750 W (maximum power) and initial time is 1 minute (common desired time setting by the user); pressing the plus or minus buttons continuously, under the 1 minute time setting condition, increases or decreases the time in multiples of 5 (the user interface becomes faster, which may please the users). The unit tests were only performed on the firmware modules that control the user interface. It was desired by the team to develop more unit tests in order to test more parts of the firmware, but it was not possible because of time constraints. Nevertheless, a lot of visual tests were performed to the microwave’s controller and the code was developed in a way that resets the system in case of fatal errors (that may cause malfunctions of the system and jeopardize the users safety) in order to ensure maximum safety while using the microwave. All the requirements were fulfilled [9] and it was done a sufficient risk analysis and a user manual [10] was developed in order to ensure that the users can use the microwave without compromise their safety.
Embedded Systems Programming Aveiro University
Page 18
Project Report Microwave Controller Firmware
8 References [1] "Implementing State-Machines in C for Embedded Systems", Pedro Fonseca, Department of Electronics, Communications and Informatics, University of Aveiro, June 2013 [2] "Unit Testing in Embedded Systems based on ATMEL Micro-Controllers", Pedro Fonseca, Department of Electronics, Communications and Informatics, University of Aveiro, April 2013 [3] “8/16-bit Atmel XMEGA A3BU Microcontroller – ATxmega256A3BU Data Sheet”, Atmel, 2014 [4] “Unit Tests for Embedded Code”, accessed on November 29th 2015, from: http://www.embeddedrelated.com/showarticle/558.php [5] “Unit Testing with AVR Studio and AVR-GCC”, accessed on November 29th 2015, from: http://whimsicalotter.com/2013/09/13/unit-testing-with-avr-studio-and-avr-gcc/ [6] "The Orange Book, Management of Risk - Principles and Concepts", October 2004, Crown copyright 2004 [7] Risk matrix template, provided by Prof. Pedro Fonseca in the scope of the discipline "Embedded System Programming", 2015/2016 [8] "Risk Analysis Matrix", December 2015, SoftProgramming [9] "Requirements Traceability Matrix ", December 2015, SoftProgramming [10] "User Manual - English", December 2015, SoftProgramming
Embedded Systems Programming Aveiro University
Page 19
Project Report Microwave Controller Firmware
9 Annexes Annexe A : Global Flow Diagram
Embedded Systems Programming Aveiro University
Page 20
Project Report Microwave Controller Firmware
Annex B: Time module flow diagram.
Embedded Systems Programming Aveiro University
Page 21
Project Report Microwave Controller Firmware Annex C: Power module flow diagram
Embedded Systems Programming Aveiro University
Page 22