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

EL3250 Practical Assessment

This assessment tests your ability to write and test code for an ARM Cortex Microcontroller STM32L476.  All the tasks use ideas from lab work you have done earlier in the course.

You will use the same equipment you used to complete the module laboratory work.  You will need to access the EL3250 Blackboard Module for reference material.

Marks for each Task section are indicated in brackets.  The total marks available are 30, and this will be scaled up to give a percentage. This assessment has a weighting of 25% for the module.

There are 3 tasks which need to be completed.  You will be assessed on the code you submit, and the answers to the questions about each of the tasks.  You may consult your previous lab work and any other Blackboard materials to help you write the code.  The submission will be a Word document containing the answers to the questions + a zip file of the complete Keil project folder containing your code.  The answers to the questions will form the main part of the assessment, and we may look at your code if we need clarity on anything you have done.

The work you submit must be your own.  Standard University assessment rules apply.

You may use register based programming style or the ‘LL’ libraries provided by ST.  Use of techniques like HAL, CubeMX and mbed are not permitted.

You must begin a new project on the day called EL3250_Jan22.  You are required to create one ‘main’ file for each task (or subtask), e.g.  Task1main.c, Task2main.c  . . . etc. so that you only need to create one project file for the whole exercise.  

You will need to know how to create a zip file of your completed Keil project.  You will need to take screen dumps from Keil and incorporate them in your answers.

If you cannot complete any question, then in your answer, explain why you think you were unable to complete.  You may be awarded marks for appropriate ideas that just didn’t work out properly.

Each task is started on a new page and includes the associated questions.

Submission of work:

The Word document containing your Answers should be placed inside the Keil project folder.  Zip up the answers+project and submit to Blackboard, using your ‘G’ number as the zip file name.  The project file will not be allocated marks directly, but may be consulted to help us award marks to your incomplete answers.

You must submit your work by the end of the assessment session – this gives you 4 hours to finish the tasks.

The assessment starts from 9:30, 13th Jan 2022 and closes at 13:30, 13th Jan 2022. PEP students might have 25% extra time as normal.

Learning Outcomes

3.

Design, breadboard and program a micro-controller system.

4.

Evaluate and use various IO devices (e.g. keypads, ADC, LCD modules, relays).

Task 1

You are required to output a signal that could flash LEDs on port pins PB6 and PB7 (the LEDs are not available).  

The LEDs should be ON for 0.1 seconds and off for 0.1 seconds running in ‘antiphase’, i.e. when one is on, the other is off.  

The GPIO pins should be configured to run at ‘Medium Speed’

Accurate timing for this should be provided by the SysTick Timer.

You will use the Logic Analyser to check the timings by using it to plot the action of the LEDs.  You may use additional variables to help you plot the state of the LEDs.

Questions for Task 1

1. Explain how you configured port B to drive the LEDs by writing out the configuration code and adding comments (you may copy and paste from your code). (3 marks)

2. The debugger allows you to check configuration of GPIOs once a program has been started and stopped using a breakpoint.  Using appropriate screen shots from the Keil debugger, explain how you were able to confirm the configuration of port pins PB 6 and 7. (3 marks)

3. Copy a screen shot of the Keil Logic Analyser display showing the action of both of the LEDs.  State whether the timing accuracy is as expected. (3 marks)

4. Use the debug printf() facility to output the state (1/0 or ON/OFF) of each LED whilst the program is running.  Show screenshots of this output. (3 marks)

Task 2

The UART is minimalistic communication still widely used for control, debugging, or data recording. You are involved in building an interface between your microcontroller and a remote PC (Personal Computer) through USART2 with a baud rate of 14400 bps. Terminal program screenshots should be used to prove successful data transmission according to the objectives. The Terminal can also provide you with a full ASCII table characters’ numeration if you press the ASCII table button centrally located in the panel – this includes codes for ‘Carriage Return’ and ‘Line Feed’ (see part 3 below).

Questions for Task 2

1. Design a Keil based program to transmit and display a single character ‘H’ when a user presses once the Nucleo Board switch ‘Push Sw’. (3 marks)

2. If the microcontroller is running at 4MHz and USART2 is set to 14400bps what should be the value of USART2_BRR. Explain the result and provide calculations. (3 marks) 

3. Design a Keil based project, to send all capital letters of the alphabet from ‘A’ to ‘Z’, with 100ms second delay between each character, continuously.  After printing the sequence to ‘Z’, send a ‘Carriage Return’ and ‘Line Feed’ so that the next printout of the ABCD…..Z starts on a new line.  Include a screen dump of this output as part of your answer. (3 marks)

Task 3

STM32L476RG has one Real Time Clock (RTC) unit on-board. RTC has two sets of alarms (ALARM-A, ALARM-B).   In the lab session of RTC, we worked on ALARM-A to generate a 1Hz square wave on PA5.

Questions for Task 3

a) Assume the asynchronous prescaler of RTC is equal to 0x3F. Using ALARM-A, design a project to generate a 1 Hz square wave on PA6. Provide the source code in C.

Hint: you might use polling, or an interrupt scheme in your code. (3 marks)

b) Explain why your project outputs a square-wave of 1 Hz. (3 marks)

c) The sub-second registers of ALARM-A/ALARM-B of RTC are shown below:

 

Explain why your value used to configure the bit-field SS[14:0] doesn’t affect the signal on PA6. (3 marks)