Infotronik
HSLU - HS17 Systemstrukturierung und Programmierung von Embedded Systems
HSLU - HS17 Systemstrukturierung und Programmierung von Embedded Systems
Kartei Details
Karten | 185 |
---|---|
Sprache | Deutsch |
Kategorie | Elektronik |
Stufe | Universität |
Erstellt / Aktualisiert | 08.10.2017 / 06.12.2018 |
Weblink |
https://card2brain.ch/box/20171008_infotronik
|
Einbinden |
<iframe src="https://card2brain.ch/box/20171008_infotronik/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>
|
What is the key advantages of using the Trigger module?
- Only one timer is needed
- common infrastructure
- save memory
How can you make a Trigger continue to run after it has been expired?
Set the trigger again at the end of the callback.
What is the key advantage of using a state Machine with triggers to debounce the buttons?
We can do something else during the bouncing.
How long can a switch bounce?
- Typically it is in the 50 ms range, but it varies depending on the switch hardware
- it can be up to several seconds --> Empirische Ermittlung durch messen
If using interrupts for detecting a push button press, what do you have to consider during debouncing?
disable the button interrupts during debouncing and enable after debouncing.
At which time is the IDLE task of FreeRTOS created?
Wenn vTaskStartScheduler() aufgerufen wird
Which two scheduling modes are provided in FreeRTOS?
preemptive and cooperative modes
Why does a task to run in an endless loop?
- There is nothing to 'return' to
Describe a simple way to visualize (e.g. with an oscilloscope) the active time of the IDLE task:
Toggle a LED/Pin in the IDLE hook. Pin activity shows that the IDLE task is running.
Do you have to use/implement the hooks of FreeRTOS?
No, they are optional.
The following can be used to communicate or synchronize between FreeRTOS tasks:
What is the benefit of calculating the reflectance sensor values with a special algorithm which weights the different sensor values with different factors?
The following is used in the interface to the motors (H-Bridge) to identify the motor:
In version control systems you are asked to provide a 'commit message': explain why you should provide such a message:
Eine Commitlisting erlaubt es den anderen Nutzer ein Verständnis für die Änderungen im Repository zu geben.
In our drivers we implemented Deinit() functions, for example for the shell:
void SHELL_Deinit(void)
Explain the purpose of such Deinit() functions:
Deinit() bedeutet deinitialisierung:
- free up memory or semaphores...etc.
- Get the driver back to the reset state
The boards we used (Robot and Remote) have different number of LED's available. Describe your strategy how you can write a common LED driver for all these boards (supporting multiple platforms with a single driver):
- Verwende Macro und gibt dabei die Anzahl LEDs an
- Ein Macro für LED ein- und ausschalten
Describe with your approach how you can deal with a board which has no LED's at all:
Use a macro to disable it completely, or set number of LED to zero.
You are using GIT as VCS. Explain what the following actions mean. Use ' remote repository ', 'local repository ', 'index ' and 'working directory ' in your answers.
(a) clone
(b) add
(c) push/sync
(d) commit
a) Copy the remote repository as local repository.
b) Add a new file to the index.
c) Add my changes from the index/local repository to the global repository.
d) Add my changes from the working directory/index to the local repository.
List three different clock sources which can be used for the microcontroller we used in INTRO:
- External crystal
- external oscillator
- internal clock.
We used in our shell parser the following xatoi() interface:
byte UTIL1_xatoi (const unsigned char **str , long *res);
Explain why it is using **str and not *str:
It advances the parsing pointer, so xatoi() can be uses sequentially on the input string.
In our labs we used the RTOS with a tick timer period of 10 ms. List advantages and disadvantages for changing it to a period of 1 ms:
Vorteile:
- Higher accuracy for wait/timing/scheduling
Nachteile:
- Higher interrupt load
- Performance tick counter needs to be changed too.
Below is an extract of a header file:
/* drv . h */
#ifdef DRV_H_
#define DRV_H_
/* header file content follows here . . . */
#endif
Using the above header file, you find out that things are not working properly. Identify the problem.
Typo, should be #ifndef
List advantages and disadvantages of using Processor Expert for a project we did in INTRO:
Pros:
- Hardware abstraction
- provides Libraries
Cons:
- learning phase
- code not that optimized
The microcontroller we used in INTRO are using a table for the vectors: The vector table contains the address of the vector function. Explain what will happen during power-on reset if the whole vector table would be filled with zero (0x00) bytes:
- Power-On reset will not work -> no stack defined, no startup vector
- Code will divert (umleiten) to address 0x0 -> potentially crash.
Explain the fundamental differences between using
EnterCritical() ; ExitCritial() and xSemaphoreTake(), xSemaphoreGive() with respect to interrupts:
EnterCritical disables the interrupts, while the other method is using semaphores and itself does not disable interrupts
On the Remote board we used an interrupt to detect button press.
- (a) Why do we not know which button was pressed from the interrupt source?
- (b) How can you know which button is pressed?
- (c)We get an interrupt for a button. But when we check the pin status in the debouncing state machine we see that this pin is not pressed. What could be the most likely problem?
- (a) Es wird nur eine Interrupt-Source für mehrere Interruptspin (wie in diesem Beispiel mit Buttons) verwendet.
Ein Interrupt Port für mehrere Port Pins. - (b) Durch Lesen welchen Wert der Port pin aufweist
- (c) Wenn zur Interrupt-Ausführungszeit der "Switch-State" bereits wieder zurückgesetzt wurde -->
(Port gibt den Zustand zum Interrupt-Zeitpunkt nicht wieder an).
The following #define might cause a problem using it:
#define INCREMENT(a) a+1
Explain the problem and provide a solution how to fix it:
- Wenn in einem Macro eine Rechenoperation ausgeführt wird, sollten immer genügend viele Klammern eingesetzt werden, ansonsten kann es zu fehlberechnungen kommen.
- Bessere Implementierung
#define INCREMENT(a) ((a) + 1)
Explain why FreeRTOS is using 'number of addressable units' as parameters to create a task, and not 'number of bytes':
- Weil der Stack so oder so auf adressierbare Units abgestimmt werden muss.
An RTOS is using following interface for a 'wait' API call:
void vTaskDelay (portTickType xTicksToDelay);
(a) Explain why FreeRTOS is using 'number ticks' as parameters to the delay routines and not 'number of milliseconds'
(b) You need to wait for 200 milliseconds with vTaskDelay(), but you do not want to depend on the frequency of the tick timer. How can you do this?
- (a) Because the tick timer can be in smaller units than milli-seconds.
- (b) Usinge something like vTaskDelay(200/portTICK_RATE_MS);
Evaluate the following statements about interrupt system for an ARM Cortex M0+ core.
List two advantages of using an optical quadrature encoder compared to a mechanical one:
- Optical encoders do not have the problem of bouncing
- Can operate at faster signal frequency as there are no mechanical parts involved
- Additionally they are free of maintenance or wear-out.
List the 4 specific requirement for a realtime system:
The (a) right answer at the (b) right time, (c) independent of the system load, (c) in deterministic way.
Explain the fundamental difference between a hard and a soft realtime system:
- Ein Real-Time System muss eine harte Zeitgrenze einhalten: Das Fehlen dieser Grenze bedeutet einen Fehler.
- Ein Soft Real-Time System könnte diese Zeitgrenze verfehlen, und das System würde immer noch als ordnungsgemäß funktionierend angesehen werden, aber das verfehlen dieser Zeitgrenzen würde eine Systemverschlechterung bedeuten (iaber kein Fehler).
Explain the advantages and disadvantages of using Processor Expert for a system we have developed in INTRO:
It allows to abstract from the hardware, and to focus on the higher level of the application. It generates the driver code and saves development time. On the other side it necessary to learn a tool, and to configure it properly.
Explain reasons why you would use a VCS:
Backup, restore, synchronization, tracking, short/long term undo, ownership, sandbox, branching, merging.
Explain reasons when you should use a VCS:
Every time you need control over your code and/or when you work together with other persons on the same code.
Explain disadvantages and advantages using macros:
Cons:
- Code might be harder to read (additional textual replacement)
- traps and pitfalls can happen when using macros.
Pros:
- Easy way to configure code at compilation time (versus run time)
- better/faster code
- helping the compiler to optimize code generation.
Explain why synchronization between systems is needed:
Systems need to get aligned and synchronized with the real world. The real world time is continuous, while the computer time is clock based. To have computers attached to the real world, they need to synchronize with the time of the
real world.
List three different synchronization methods:
- Interrupt synchronization
- realtime synchronization
- gadfly/polling synchronization.
Explain a case where a synchronization between two systems does not make any sense (keinen Sinn ergibt):
If one system is so slow that it cannot react to the events from the other system. The system is overloaded and has no time to synchronize anyway.