EECS 373 Lab 6: Serial Bus Interfacing - Answer and Demo Sheet

Name and Unique Names

 

 

Staff Signature for Demo

 

Interrupt Driven UART DEMO:___________________________________________________

 

Radio Demo: _____________________________________________________________

 

Bonus Demo: _____________________________________________________________

In-Lab Assignment

Interrupt Driven UART Communication

How does the application initialize the UART connection? What is the UART speed and configuration? How is this different from earlier uses when you output data using printf?

 

 

 

Change the application such that it reacts immediate on key presses and changing the output mode of the OLED accordingly. Instead of using a polled character read function, you will have to use interrupts. Look at the UART driver in drivers/mms_uart, especially the MSS_UART_set_rx_handler() function definition in mss_uart.h, to find out how to subscribe to interrupt events, and configure the driver for interrupt driven communication. In addition, you will have to change the switch block for the new behavior. Consider how you can use a global variable that is set in the UART interrupt service routine to exit loops and delays in the  switch block.  For instances, much time is spent in the delay function.  This would be a good place to use the global variable to exit the delay loop.  Note that you don't have to check for a change of state after every operation. Human reaction time is around 100 ms. Thus, if you react to a key press within that time, we can't really differentiate if it was immediate or not. Last thing to note: If a case statement cannot finish (by braking at the middle) some of the OLED setting might not get reset for another case statement's proper display.

Serial Protocol Analysis

Identify the peripheral to which each signal belongs.

Signal Name Pin Number Breakout Name Peripheral Name
MISO E3 F0
MOSI F3 F1
SCK G4 F2
CS H5 F3
RX H6 F4
TX J6 F5
SDA B22 F6
SCL C22 F7

Serial Analyzers

Using the different logic analyzer capabilities answer the following questions for the different serial protocols. Make sure you measure average transfer rates over a significant amount of time, not just over one transfer (e.g. 100ms to 1 second).

SPI
  1. What is the frequency of the clock SCK?
     

  2. What is the polarity of the clock SCK (low or high when inactive)? Note, you will have to figure this out in order for the SPI Analyzer block to work correctly.
     

  3. What's the throughput in bytes/second? How and why is it different from the clock speed?
     

  4. What is the data we transmit? Hint: convert the bytes to ASCII.
     
I2C
  1. What is the frequency of the clock SCL?
     

  2. What's the average transmit (master to slave write) data rate in bytes/second?
     

  3. What's the average receive (master to slave read) data rate in bytes/second?
     

  4. What are the slave addresses the master tries to contact?
     

  5. Are the messages getting acknowledged? If yes, by whom? If not, how does it work? Who guarantees that the line stays high, even though all the devices put their SDA line on high-z (floating) status? Hint: look at the wiring diagram of the FPGA Cores and the individual Core configurations.
     

UART

The UART uses 8 bit data. Answer the following questions using the logic analyzer.

  1. What is the baud rate of the UART signal?
     

  2. What is the configuration (Even/Odd Parity)?
     

  3. What is the average transfer rate in bytes/sec?
     

  4. What does the UART data say in ASCII?
     

  5. Are there any other optional signals UART could use? If so, name them.

Comparing Serial Buses

Give at least two potential improvements in order to speed up transfer on all the serial protocols.

 

 

 

Code Deliverables


  1. Submit an explanation of the modifcations you did to make the Interrupt Driven UART along with the main.c code. 
  2. Submit the C code for your SPI driver and main.c.