Lab Assignment: UART


This assignment will require a partner.

To learn how to communicate between two master devices using UART in order to off load computation to another device.


Part 1: Design UART driver

Using the following class template

  1. Design a UART driver as you have the previous drivers.
  2. Implement any functionality you deem useful for a general purpose UART driver.
  3. Document/comment each method and variable within the class template.
#ifndef LABUART_H
#define LABUART_H

class LabUART


Code Block 1. UART Driver Template Class

Part 2: Serial Application

For this application, one device will ask the other device to calculate the result of two number and an operation.


Figure 1. 

Think about it like this, using figure 1 as a guide:

  1. Device 1 sends a single digit '5', Device 2 receives single digit '5' 
  2. Device 1 sends another single digit '7', device 2 receives single digit '7'
  3. Device 1 sends an operator '+', device 2 receives operator '+' and computes the result.
  4. Device 2 sends result back to device 1.

Use the on-board buttons and 7-segment display as human interface devices (HID) so that the user can punch in which two numbers and the operation should perform and some way to send it. Be creative about this.

When the result is calculated, both the devices 7-segment displays should show that resultant.

You MAY use the pre-written 7-segment display driver and the button driver for this lab.


  • Design UART driver.
  • UART driver driver should be able to support UART2 or UART3.
  • Utilize a queue between a ALU handler task and the UART receiving task. 
  • ALU application must be able to support the following operators
    • +   Addition
    • -    Subtraction
    • *   Multiplication
  • Must use a terminal command for this.
  • Receive should utilize UART interrupt and FreeRTOS queues.

What to turn in:

  • Place everything inside of main file or include all relevant files.
  • Turn in the screenshots of terminal output.
  • Logic Analyzer Screenshots
    • Waveform of device 1 UART TX sending a digits and operator to device 2.
      • These can be in separate images if you can't fit everything in one image.
    • Waveform of device 2 UART TX sending result back to device 1.
    • Whole window screenshot with the Decoded Protocols (lower right hand side of window) clearly legible.
Back to top