Professional Documents
Culture Documents
Soft UART Assignment
Soft UART Assignment
In this assignment, you have to program the functionality of the UART by software only (not using
the HW registers).
The goal of this assignment is:
to better understand timing issues in receiving serial, asynchronous data,
to learn how to debug this kind of issues,
to design and implement a state machines in the communication protocol context,
to understand the UART protocol in detail.
Hardware needed:
Arduino, RedBoard or Nucleo
(Logic Analyzer)
Some wires, LED’s, etc
Experiment setup:
Connect your Arduino, RedBoard or Nucleo to your laptop with the USB cable.
Use putty, or any other terminal program of your liking to send data to your device.
Make sure the settings comply with the ones used in your implementation.
Check out which pin is normally used by the UART to receive serial data from the USB
connection.
Configure this pin as an ordinary input (so this pin now has to be read by software, and not
by the UART).
Implement your function for receiving one byte of serial data , as described above.
For testing purposes, make a program that triggers certain actions when certain characters
have been received (for example: switch LED on after receiving character ‘A’ and off after
receiving ‘B’). In this way you can check whether your UART implementation works correctly.
To make sure that this test program works well, first use the standard UART function to read
the data (Serial.read). When it all works as expected, then replace Serial.read by
your own function.
Possible extensions, when you are done, have some time left:
Implement different frame formats (different number of data bits, odd/even/no parity,
multiple stop bits).
Implement different baud rates.
Implement multiple samples per bit.
Implement sending of data also.
Or maybe you have an idea of your own; feel free.
Deliverables required:
Make a video that shows clearly that your solution works well.
Make a document with the following information:
o Your complete state machine, including the diagram, state descriptions, transitions
with conditions, actions.
o Explanation about how and why you changed your initial design after the
implementation.
o Explanation of special parts of your code (things that took more time and effort than
expected, special ways in which you implemented things, how you debugged).
o Description of the tests you performed.
o Link to the video that you made.
o What extensions you made to the basic version (if applicable).
Planning:
Week 4, Tuesday: show the first design of your State Machine
Week 5, Tuesday: show progress; ask questions
Week 6, Monday: hand in the code + documentation