UART LED Project Part 2
Overview
Modify your Part 1 project to use the System Timer (AKA SysTick) instead of a simple spin loop.
UI Requirements
- See 11.7 System Timer in the textbook or see the Cortex M4 Generic User Guide Chapter 4.4 System timer.
- Use the System Timer (AKA SysTick) for timing
- Set the Reload 24 bit value (use about 1 million to start) in SysTick_LOAD
- In SysTick_CTRL Set the clock source to processor clock and set the Enable
- Do NOT use the TICKINT_msk -- this bit turns on interrupts. We are not using interrupts.
Turning this on will crash your code. However, you are allowed to use interrupts if you
want to take on learning how to use it correctly.
- Check the COUNTFLAG bit in the SysTick_CTRL register to determine when the counter hit zero
- You then replace your wait spin loop code from Part 1 with a function that checks the COUNTFLAG bit.
If the bit is set you then add one to your counter for the number times you have waited 100 ms.
That is all there is to part 2 -- changing from a spin loop that burns CPU to using the System Timer (SysTick)
to check for elapsed time.
- Be sure to NOT wait for more than 100 ms at any point in your code.
Rubric and Late Policy
100 possible points as described below. The grading for Part 2 is ONLY for the required changes to Part 1.
Incomplete Part 1 functionality will be ignored as much as is practical.
- Demo Sheet
- 40 -- System Timer initialization requirements:
- A reasonable reload value (not more than 24 bits).
- The SysTick_CTRL must set the clock source to the processor clock and enable the timer.
- If the TICKINT is used there must be a corresponding interrupt service routine.
- 30 -- There is a section of code that correctly checks the COUNTFLAG bit in the SysTick_CTRL register or
uses the interrupt service routine is interrupts are used. This code must effectively provide an appropriate delay.
The Part 1 code spin loop must not be used in Part 2. If it is present that's fine as long as it is not used.
- 20 -- The normal operation of the program must not wait more than approximately 100 ms.
This will be confirmed by code inspection and reasonable responsiveness to keyboard inputs.
- 10 -- The code shows good variable naming and formatting.
- Late penalties of 5% per day apply.
References
Submission
Submit your UART LED project (all files except subdirectories) to the UART LED project Part 2 dropbox by the due date on the schedule.