PH415 Computer Interfacing 2013
OSU logo
Serial Communications

Table of Contents

Introduction

This task will be focused on the many different types of interfacing available to the μC such as: SPI,I2C, and USB Serial. An investigation into each will be performed, as well as using multiple communication protocols together.

USB Serial Interfacing

Use the high-level Arduino-style libraries in MPIDE to establish bidirectional communication with the MAX32 and the host PC, via MPIDE's Serial Monitor function. With the code written for the MAX32, write a python script to capture and send USB serial information to the MAX32. Also add functionality to store the data received and if necessary act on it.

  • Write an Arduino-style code to perform Serial communication from the μC to the Serial monitor in MPIDE
  • Add the functionality to your Arduino-style code to switch on/off an led via the USB serial interface and MPIDE serial monitor
  • Using pySerial, write a script to capture the output of your first program in python and store to a file
  • Add the functionality of switching a led on the MAX32 via USB Serial to your python script

I2C Interfacing: Measuring Temperature

This task will explore I2C interfacing with a pModTMP2. While writing code for this pMod, be sure to keep consideration for the possibility that you might want to use your code many more times in the future.

  • Read the reference manual and look over the schematic for the pModTMP2: PmodTMP2 schematic, PmodTMP2 reference manual, ADT7420 (±0.25°C ACCURATE, 16-BIT DIGITAL I2C TEMPERATURE SENSOR).
  • Establish communication with the pModTMP, via I2C (ProTip: Use Arduino-style + {I2C}examples) (TMP2 PMOD code example)
  • Write code functionality to report the the temperature over USB Serial to the host PC

SPI Interfacing: Digital to Analog Converter (DAC)

Similar to the task above, we will be interfacing with a pMod. This time the connection protocol is Serial Peripheral Interface (SPI) and the pMod is a 16-bit digital to analog converter called pModDAC3.

  • Establish SPI communication with the DAC using the Arduino-style SPI library
  • Produce a full resolution ramp wave with the DAC. Increase the frequency of the ramp wave to 1kHz
  • Produce a full resolution sine wave output. Verify, record and save your data. Compare the DAC ramp wave with the {expected} same output from your function generator (FG)
  • Download this file and Produce a 1kHz sine wave. Compare to FG output at same rate, and make note about any digitization.
  • Use Marina to capture both this waveform and a sinewave at the same frequency from the waveform generator (Tektronix or Rigol). Compare the power spectra (Fourier transform) of these two signals, and explain any differences.