Digilent Basys MX3 Basys MX3 enables designers to quickly begin developing and debugging an embedded application. With an exhaustive set of peripherals plus Pmod expansion headers, you can create a wide range of embedded systems applications. The board also provides an easy and cost-effective introduction to the PIC32 microcontroller and MPLAB X Integrated Development Environment (IDE).
The most exciting feature is the in-depth that comes with it. This coursework, titled “Embedded Systems with the Basys MX3 and PIC32MX370,” is completely free, open-source, and completes a full walk-around of the board. With a total of 7 theoretical teaching units and 15 labs, “Embedded Systems with the Basys MX3 and PIC32MX370” is meaty enough to teach every enthusiast all that they need about embedded systems.Below you’ll find a breakdown of the coursework and the concepts and skills each unit/lab targets.
Unit 1 - Microprocessor IO
Example data flow diagram from Unit 1.
Right from the get-go, you will start getting familiar with the PIC32MX370 hardware by programming registers and creating a hardware configuration file. Data flow and control flow diagrams are used as part of project planning and to teach best design practices, including when and how to test. If you aren’t familiar with the MPLAB X software or need to brush up on programming in C, links to various tutorials are included. Some key takeaways for the creators are:
- Understand best practices for creating dependable and sustainable software.
- Know how to generate a microprocessor development project using MPLAB X.
- Know how to generate a config_bits file for the PIC32MX370 processor.
- Know how to configure the Microchip PIC32 processor pins as either digital inputs or outputs.
- Understand the drive capability of a processor digital output.
- Know how to write a C program for a specific application using an embedded system.
- Know how to make speed performance measure on a processor-based system.
Lab 1a
The concepts discussed in Unit 1 are put into practice here by requiring you to write a program that uses the onboard switches to control the onboard RGB LED according to specified design requirements. As a student, you become familiar with read-modify-write operations to control the PIC32MX370 registers.
Lab 1b
The skills acquired in Lab 1a are extended to require you to create a simple calculator using the onboard switches, buttons and seven-segment display (SSD). You are introduced to timing through the use of software delay to achieve persistence of vision on the SSD, as well as atomic bit manipulation and bit-banging techniques.
Unit 2 - Elements of Real-time Systems
PIC32 interrupt handler block diagram from Unit 2.
Through the classic example application of controlling the rotor speed of a stepper motor, this unit investigates the concepts of multi-threaded process time management for a real-time dynamic system, using foreground-background task scheduling. Counter/timer hardware is discussed in some detail. Some of the key takeaways are:
- How to implement task management based on polling PIC32 timers.
- How to implement task management based on PIC32 timer interrupts.
- How to set the period of a PIC32 timer.
- How to write a software state machine.
- How to allocate tasks to either foreground or background scheduling.
- Understanding of stepper motor operations and applications.
Lab 2a
Adapting the code previously used in Lab 1a and 1b, you are required to display the state of the onboard push buttons on the onboard LEDs using debouncing techniques, change notification interrupts and polling.
Lab 2b
Extending the skills acquired in Lab 2a, you need to control the mode and direction of a stepper motor using the pushbuttons, control the speed of the stepper motor using the slide switches, and display the speed of the motor on the SSD.
Unit 3 - Parallel IO and Handshaking for LCD Control
Example timing diagram for four-phase handshaking from Unit 3.
In Unit 3, you will be introduced to digital communication by displaying static and dynamic data on the onboard parallel LCD. You will learn to translate timing diagrams provided by target equipment data sheets into timed sequences of program instructions, how to use ASCII encoded data, as well as experiment with the mechanisms required to synchronize asynchronous systems using hardware and software handshaking. Some of the key takeaways are:
- How to use control flow diagrams to generate program code.
- How to implement a bi-directional parallel IO interface.
- How to use software delay to write control commands at specified intervals.
- How to use software code to generate a minimum setup and hold times.
- How to implement one form of handshaking.
- How to read and interpret timing software modeling diagrams.
Lab 3a
Using direct IO control through bit-banging, you will develop and test a library of functions that allow text to be placed at any position on the onboard parallel I/O character LCD, following the data flow and control flow diagram models presented in Unit 3.
Lab 3b
Using IO control through the parallel master port (PMP), you will develop and test a library of functions that allow text to be placed at any position on the onboard parallel I/O character LCD, following the data flow and control flow diagram models presented in Unit 3.
Unit 4 - Communications – Synchronous and Asynchronous Serial Protocols
Example parallel multiple slave SPI bus configuration with individual device select signals from lab 4c.
Unit 4 consists of two parts. Part 1 contains an overview that addresses different high-level views of digital communications including synchronous vs asynchronous and networking. Part 2 further addresses asynchronous communications protocols, specifically the Universal Asynchronous Receiver Transmitter (UART) protocol. Some key takeaways from Part 1 and Part 2 combined are:
- Understanding of the basics of telecommunications.
- Understanding of requirements and implementations of asynchronous and synchronous communications.
- Application of asynchronous communications.
- Knowledge of a PC terminal emulation program.
- How to develop a library of PIC32 software to provide bi-directional communications of single characters and strings of characters.
- How to use the UART for diagnostics and as a human-machine interface (HMI).
- How to recognize the handshaking methods used in a communications protocol.
- How to set up the Analog Discovery 2 to display communication signal waveforms.
Lab 4a
You will call on your experience with controlling a stepper motor from Lab 2a, only this time the motor will be controlled from a PC terminal via UART. Serial communications will be displayed on both the PC terminal using a terminal emulation program and the LCD onboard the Basys MX3Basys MX3.
Lab 4b
Lab 4b requires all of the elements of software code developed and hardware used in previous labs. The learner will extend the knowledge gained in Lab 4a by specifying a system that is capable of two independent control and monitoring locations, which is common to many industrial applications.
Lab 4c
You will develop a software system that allows the PIC32MX370 to write an arbitrary number of 8-bit bytes to an arbitrary address location in the SPI flash memory device. The stored data must also be read back to determine if the data read matches the data written.
Lab 4d
Using I2C communications, you will be able to program the PIC32MX370 processor to periodically read the physical orientation data from the onboard 3-Axis accelerometer and display the information on a character LCD and send a text stream to a computer terminal.
Unit 5 - IrDA Communications Protocols
Schematic diagram of PIC32 connection to the onboard infrared module.
This unit demonstrates how to use interrupts and the core timer to decode two IrDA protocols, in an effort to teach approaches for decoding different IrDA protocols used for remote device control. The IrDA is the only implementation of wireless communications included in this coursework, as well as the only unit requiring the use of the Analog Discovery 2 (or similar instrument). Some of the key takeaways are:
- Understanding of the basics of IrDA protocols.
- Using instrumentation to characterize data streams.
- Use processor external interrupts to decode signal timing patterns.
- Approaches to using state machines to process data.
Lab 5a
The format of this lab differs from the rest in this series in that the hardware is not entirely specified. You are intended to use an IR remote control device of your own choosing and to analyze the IrDA signal to generate an application that can exchange IrDA messages with that device.
Unit 6 - Analog IO and Process Control
Example motor and tachometer wiring for Unit 6 (use of the Analog Discovery 2 is recommended but not required).
Unit 6 will teach you how to work with analog signals. The purpose of this unit is to investigate applications of embedded controllers to real-time control algorithms that employ analog inputs and analog outputs. You will use a computer algorithm to implement a closed-loop processor for motor speed control and see how feedback can be used to linearize an inherently nonlinear process and result in zero steady-state control error. Some of the key takeaways are:
- How to read analog voltage with a PIC32 processor.
- How to use the PIC32 Output Compare to implement a PWM analog output.
- How to use the PIC32 Input Capture period measurement to implement a tachometer.
- The advantages of using period measurements as opposed to frequency measurements and vice versa.
- Fundamental digital filtering concepts for data smoothing.
- Open-loop and closed-loop process control.
Lab 6a
This lab focuses on open-loop control. You will use the potentiometer labeled Analog Control Input onboard the Basys MX3Basys MX3 to set the percent PWM to operate the speed of the motor from 0 rpm to the maximum the motor can achieve given the motor performance and the supply voltage.
Lab 6b
Building upon Lab 6a, Lab 6b introduces closed-loop control by implementing a digital PI controller. The tachometer frequency will be measured by using the Input Capture of the PIC32 to determine the signal period which is then inverted to yield the frequency.
Unit 7 - Digital signal processing (DSP)
Plot of outputs of the four example filters to a 1 kHz input sine wave used in Unit 7.
This unit focuses on processing signals in the audio frequency range using digital signal processing (DSP) concepts with the PIC32MX370 microprocessor. Both a method of generating multiple frequency signals without using transcendental functions or lookup tables and Discrete Fourier Transforms (DFT) to detect the presence of signals will be used. It is not the purpose of this unit to teach you the theory of digital filtering, but rather to teach how to implement digital filtering using a conventional microprocessor in lieu of specialized digital signal processors. Some of the key takeaways are:
- How to implement digital filters in C using a PIC32 microprocessor.
- How to create analog output using pulse-width modulation.
- How to sample an analog input at a specified rate.
- How to use the PIC32 processor to make a signal generator.
- How to use the PIC32 processor to make a real-time frequency spectrum analyzer.
Lab 7a
This lab requires much of the code written for previously labs and adds use of the onboard speaker and microphone. You will be able to create a digital sine wave generator capable of synthesizing eight constant amplitude signals at specified frequencies. The frequency of the sine waves will be selected by setting one of the eight slide switches. The audible output will be enabled and the frequency displayed on the 4-digit 7-segment display for five seconds when BTND is pressed. The LCD will display the frequency of the selected sine wave.
Lab 7b
Adding to Lab 7a, the lab series culminates in creating a spectrum analyzer using the Discrete Fourier Transform. You will experience how to use of the Fast Fourier Transform and MIPS DSP library greatly reduces execution time.