EE444 Embedded Systems Design - Student Projects: Burkes

Disclaimer: This page was created by R. Burkes.

All opinions expressed here are those of their author(s) and not of D. Raskovic

Interfacing with USB Device using MSP430F449 & μALFAT Chipset

USB2USB

Randall Burkes

Department of Electrical and Computer Engineering

University of Alaska, Fairbanks

Fairbanks, Alaska 99775, USA

The goal of this project was to develop a method for USB to USB communication using MSP430 as control device. In addition the capability to map directories, create new directories in real time, and write files to a drive formatted with Microsoft’s FAT file system were also implemented.

A. Overview of Components

1) MSP430F449: The Texas Instruments MSP430F449 is a 16bit reduced instruction set microcontroller with an operating range of 1-8MHz. In addition to the microcontroller itself there are many onboard peripherals such as a12-bit analog to digital converter and a pair of universal asynchronous transceivers.

2) μALFAT: The GHI Electronics μALFAT is a hardware implementation of Microsoft’s FAT32 file system, it operates at 10MHz and is controlled using serial communication and 8bit commands from a microcontroller.

3) Max3421: The Maxim IC MAX3421 operates at 10MHz and acts as a USB transceiver which allows low powered devices such as the MSP430F449 and μALFAT to communicate with USB devices which operate at a higher voltage.

4) SBLCDA2: The Softbaugh SBLCDA2 is a seven digit 14 segment display, with additional four digit seven segment section for clock, counting, or other general purpose output. The display is designed for indoor use and has a 180 viewing angle.

B. Design Goals

1) USB to USB Communication: Using the MSP430 to control communication between a pair of connected USB devices over UART1, and UART0.

2) Map Directory Tree: Include the capability of traversing the directory of a connected USB device as well as modifying the working directory of the drive.

3) Create New Directories: Capability to create new directories run time, including the ability to name and make the new directory the working directory.

4) Create/Write to Files: Ability to create new files run time, including the ability to name and write 8-512 Bytes of user-entered data.

C. Project Outline

1) Data Flow Diagram: In order to allow user controlled I/O in the project a very basic flow control diagram had to be drafted. Appendix 1-1 shows the outline used when planning the design for the software used in the device. The operating system was kept very simple due to the I/O being controlled by only two momentary buttons.

2) Project Block Diagram: After laying out the design for the software it was necessary to decide how the hardware would be used to accomplish the design goals. Appendix 1-2 shows the block diagram for the project. In reality there are no multiplexers used in hardware, rather the communication with the two μALFAT is controlled in a similar fashion in software. A Softbaugh SBLCDA2 functions as an output for user entered I/O. User control is implemented via a pair of buttons, which function as Yes/No controls.

Figure 1. Data Flow Diagram

Figure 2. Block Diagram Schematic for Design

D.Universal Asynchronous Communication

Communication with microcontrollers is often controlled using some form of serial peripheral interface; one such option is using a universal asynchronous transmitter/receiver, or UART. By defining a set of guidelines for transmission, the UART module is capable of transmitting data fed from a buffer in a serial bit fashion one byte at a time. Assuming each end of the communication link has been identically initialized the receiver will reassemble the bits as they arrive and pass the data on to a microcontroller for processing. In order to interface with the μALFAT over UART 8bit characters with one stop bit and no parity must be used. As shown in Figure 3 communication is performed least significant bit first with a preceding start bit, and one stop bit.

Figure 3: Communication over UART

In order to perform simultaneous communication between two devices using one MSP430 it is necessary to setup a second channel on the UART module because internally the transmit and receive buffers are common to each device connected to the serial peripheral interface An important point in designing any serial communication is the inherent processing delay by the module that is receiving commands. Figure 4 shows the delay in communication between the MSP430 and μALFAT chipset, it takes about 8.5ms to process the command and return a result.

Figure 4: Processing Delay between MSP430 and μALFAT

This delay makes it possible to send independent commands over both UART1 and UART0 before either response arrives. However handling the responses is difficult because the receive buffer will only be available to one channel at a time and the two responses are stacked with minimal delay. Fortunately the clock speed of the MSP430 is significantly faster than that of the UART transmission rate. For each bit transferred at 9600 Baud the MSP430 can perform 100 operations, within a 8.5ms delay 8500 operations occur. Using the high clock speed of the MSP430, results are quickly parsed upon arrival and appropriate actions are taken to ensure no data is missed.

E. Directory Mapping/Creation

It is necessary to map the directory of the drive in order to locate and select working directories that differ from the root. Each USB device is mapped using a top down traversal, with the user selecting the desired path to a specific directory. Working with the limited I/O and LCD space makes it challenging to provide a rich experience when locating a specific directory. However the final implementation makes it possible to not only traverse but also select a specific directory to make it the working directory. After each new directory is entered it is necessary to remap the drive with the working directory as the new root, this process is repeated until reaching the end of the directory tree.

Figure 5. From left to right: Example going from root to end of directory tree.

F.User Input Output

In order to achieve user I/O there are two buttons and an accompanying LCD screen. Using interrupts makes implementing a button very simple. After being interrupted the MSP430 sets a variable, which is waiting to be changed, and as a result the program continues to the next section of the operating system. One button acts as a Yes or Continue button, while the other acts as a No or Next button. In order to map characters and numbers to the LCD screen a simple driver was written which accepts a character and location and changes the memory location associated with the character and digit.

Figure 6. Example of a 14 segment display digit.

G. Final Thoughts

While the final design meets all design requirements, some functions of the device would need to be improved before continuing with the project. Ideally the operating frequency of the MSP430 would be increased to 8MHz, and communication would be at 256KBaud to provide quicker overall flow of the device. Some programmatic changes need to be implemented to allow large read, and writes to be accomplished. However the foundations are implemented. Overall the device is proven to be capable of reading/writing to USB, and mapping, creating, and changing directories. The design process has proven to be a lengthy and challenging process, but little rewards are as satisfying as getting the device to perform as designed.

References

[1] Texas Instruments, “SLAS344D”, MSP430x43x, MSP430x44x Mixed Signal Microcontroller Data Sheet, Jan. 2002, Rev 8/04

[2] SoftBaugh, “SBLCDA2/T Data Sheet”, ver. 1, January 2003

[3] GHI Electronics, “µALFAT User Manual”, Rev. 3.11, Oct. 2009

[4] GHI Electronics, “µALFAT-USB”, Device Schematic, ver. 1.0, July 2007

[5] GHI Electronics, “µALFAT Library Manual”, Rev. 1.04, July 2008

[6] MAXIM IC, “USB Peripheral/Host Controller with SPI Interface”, Rev. 3, July 2007