UART Cross Connect Interrupt 2

Overview

The purpose of the project is to transfer the "Hello World" string from UART 1 to UART 4 and to transfer the "I hear you" string in the opposite direction. Your code must confirm that the received strings match the transmitted strings.

This project uses the same cross connect as the cross connect polling project. The sample code is in myCourses in the Content area in Zhu_text_537-539.pdf. Also, refer to the UART slides.

Setup

Make a copy of your UART cross connect polling code and then start implementing the interrupt logic.

Requirements

  1. Copy the UART interrupt code setup from page 537 into function called UART_Interrupt_Enable(). This needs to also set up UART 4 as well (all four lines).
  2. Use the receive buffer size of 81 (80 plus end of string).
  3. Use two receive buffers (one for each UART).
  4. Copy the interrupt handlers and helper functions for both UARTs from pages 538 and 539.
  5. For the send function change the code to look for a 0 byte (the end of string) to stop the transmission after sending that byte.
  6. Note that you will have to combine the send and receive interrupt service code into one ISR per UART. To do this easily create two boolean flags called uart1_send and uart4_send. These boolean values must be true ONLY when a send is in progress. The last send interrupt (when we send a 0 byte) must both turn off the transmit empty interrupt and must clear the corresponding boolean flag.
  7. All of your code must be in uart_cross_interrupt.c. (This is for ease of submission and grading -- please use modular design!)
  8. Whenever possible hide as much as possible using the static keyword (such as counters and buffers)
  9. Create a testing function, interrupt_tests(), that is called from main. This function should be declared in uart_cross_interrupt.h. This header needs to be included by main.c so the linker will connect the reference in main.c to the function in uart_cross_interrupt.c.
    1. Your transmit and receive code MUST use interrupts to transfer the data.
    2. Calls UART_Interrupt_Enable().
    3. Calls send_hello_world() unit test. This test transmits the string using UART 1. This test verifies that UART 4 receive buffer gets the expected "Hello World" string. Be sure to send the 0 at the end of the string to indicate the end of the transmission.
    4. Calls send_I_hear_you() unit test. This test transmits the string using UART 4. This verifies that UART 1 receive buffer gets the expected "I hear you" string.
    5. Be sure to send the 0 at the end of the string to indicate the end of the transmission.
    6. Lights red LED if either test fails.
    7. Lights green LED if both pass.
    8. The code waits for the down button to be pressed. When it is pressed the send_hello_world() and send_I_hear_you() functions must be executed again.
    9. NOTE -- your test functions must handle the removal of one of the jumper wires. This means you must have some sort of timeout that causes each of your unit tests to fail. This should not exceed 2 seconds.

Hints and Tips

This section provides specific recommendations on successfully implementing this project.

References

Rubric

Rubric is defined in the demo sheet

Submission

Only submit uart_cross_interrupt.c and uart_cross_interrupt.h to the UART Cross Interrupt myCourses folder.