计算机代写 ECE 2035 Homework 3: Mbed Setup

ECE 2035 Homework 3: Mbed Setup
The goal of this exercise is to prepare the infrastructure necessary to build an embedded system using the mbed LPC1768 development board (http://developer.mbed.org/). This will be used in a project that involves interfacing to the mbed, programming, testing and deploying it in an embedded application.
The mbed is an ARM-based microcontroller manufactured by NXP Semiconductors. ARM is a RISC instruction set architecture originally developed by Acorn Computers in the early 1980s. It has become the most widely used 32-bit architecture in terms of number manufactured. There is at least one ARM processor in 99% of all smartphones and tablets. The mbed’s ARM Cortex-M3 core runs at 96MHz with 512KB flash memory and 64KB RAM, and several communication interfaces, including Ethernet, USB Device, CAN, SPI, I2C, and others.
Task 1: Setup: USB connection and Account Activation

Copyright By PowCoder代写 加微信 powcoder

Follow the instructions in the Setup Guide found on the sheet included in the mbed box. Connect your mbed to your laptop/PC via the USB cable. Click the mbed.html link on the flash drive that appears. Click signup and note the last few digits of the serial number of your board on the web page (lower right) as you might need it later (e.g., for serial I/O driver installation). Set up your account, which will allow you to use the cloud compiler to develop, compile, and download code for the mbed to execute.
Task 2: Learn proper insertion/removal of mbed
Your kit probably came with two separate, small breadboards. This is the best time to join them into a single breadboard (see Figure 2) by sliding the mating connections together. Alternately, you may choose to assemble them as a long, narrow breadboard instead of this squarish one in the figure, but this example does seem to work well for the application. You may need to peel away, or even cut away, a small area of the double-sided foam tape that can block the insertion. But try not to leave any adhesive exposed – at some future time, you may find it useful to actually use that adhesive to mount the entire board to a rigid surface.
The mbed microcontroller is fragile, and inserting it into a breadboard will require some force. (Consider placing it exactly as shown in Figure 2, occupying rows 1-20 of the breadboard, since you can then copy the same placement of other components, knowing they will work well there.) Ensure you line up the holes, then press evenly until it goes into the board fully. If you are not careful, the pins will break.
Never try to remove the mbed by pulling on the USB lead or USB connector. Do not push down on the USB connector when pulling out the USB cable. These actions may pull off the USB connector itself.
It is best to leave the mbed microcontroller in the board whenever possible. If you do need to remove it, patiently and carefully use a small jewelers screwdriver or similar, and lever it a bit at a time evenly from each of the four corners in turn, ensuring you pull up with the screwdriver so you are pressing against the breadboard with the tip and the edge of the microcontroller with the shaft, rather than the tip touching the bottom of the mbed (which might damage the components on the underside).
The mbed box contains a small plastic card that shows the pinout diagram for the mbed (also shown below). This gives pin names that you will use to read or send data values to the pins. Note that power (3.3V and 5V up to 460MA) is available for the breadboard from the upper pins. On- chip power circuits produce this voltage using power from the USB cable (500MA max). Vin is

ECE 2035 Homework 3: Mbed Setup
for an external power source like a battery – don’t connect anything to it while using the USB cable. There are four blue user LEDs at the bottom of the board (LED1– LED4). They are useful for providing status information. The LEDs will flash if you ever have a run-time error.
Note that if you have a new PC or MAC that only has USB C ports, to use the mbed, you will need a USB C to USB 3.0 adapter or cable. For example, a pack of 3 is ~$9 on amazon:
Amazon.com: AUKEY USB C Adapter, [3 Pack] USB C to USB 3.0 Adapter Compatible with MacBook Pro 2017/2016 , Google Chromebook Pixelbook , Samsung Galaxy S9 S8 S8+ Note8, Google Pixel 2/2XL – Black: Computers & Accessories
Turning power off: Pushing the button on the mbed causes it to reboot, but to turn power off on the mbed, disconnect the USB cable. The small USB connector on the mbed module is fragile, so disconnect the larger USB connector that plugs into the PC. If the blue LED is on, you have power to the mbed. Always turn off power when changing wiring on the breadboard!
If you have never used a breadboard before or if you need to review its underlying connection patterns, please go to https://mbed.org/handbook/Breadboard for a summary.
LPC1768 Pinout Diagram
Task 3: Download and run a program
After you activate your account, go to the quick start guide for the Arm mbed OS https://os.mbed.com/docs/mbed-os/v6.8/quick-start/build-with-the-online-compiler.html and step through the tasks: run the example on the mbed board by saving the program to the mbed flash drive and pushing the blue button on the mbed board to reset. The mbed will always start running the most recently downloaded program. To go directly to the compiler from the http://developer.mbed.org/ website, select Compiler in the upper right.
Note that the libraries we use to interface the MBED with peripherals are written in C++, but for the purpose of this class, the game engine and related code are implemented strictly in C.
Task 4: Build the circuit and run test programs
In this task, you will create an embedded system in which the mbed microcontroller interfaces with a color micro-LCD display, an accelerometer, a microSD card reader, push-buttons and a

ECE 2035 Homework 3: Mbed Setup
small audio speaker. Then, you will download a few test programs to ensure that your system is wired correctly.
Figure 1: Wiring Diagram
Note the difference between VO and VU. Also be careful to properly orient the BJT transistor (see Fig. 3). You can omit the Speaker, the transistor/resistor, the SDown button, and the microSD Breakout, unless you need them for optional features.
Figure 2: Completed Circuit, omitting only the SDown button. The uLCD is resting on its side, and is not actually mounted there.
Please note the proper orientation of the BJT transistor.
Figure 3: BJT Transistor
Task 4A: The first step is to wire up the components that are provided with the mbed. Follow the diagram in Figure 1 to wire the mbed microcontroller to each of the components that we will be

ECE 2035 Homework 3: Mbed Setup
using in this project. First, read ahead and note that you do NOT need to install and wire the speaker, the BJT transistor with its resistor, and the microSD breakout, but you CAN if you want to try them and possibly use them for optional features of your project. Also, one of the switches (the one connected to mbed pin 24) is optional.
Some important points:
• Use the vertical outside columns marked with a blue “-” as ground, connecting them to each other and to the mbed ground pin. Use redundant (extra) connections to be safe.
• Use half of the vertical outside columns marked with a “+” as 5V, and the other half as 3.3V. Connect the 3.3V to each other more than once (and to the mbed VOUT), and connect the 5V to each other more than once (and to the mbed VU), but do not connect 5V to 3.3V anywhere.
• Once you have these convenient power and ground columns, use them to keep power and ground wires shorter.
• If you have access to a kit of breadboard wires cut to shorter lengths, you can keep this much neater than it would be using only the long jumper wires in the Sparkfun kit. You can make your own with wire strippers and cutters, but make sure you use quality solid (not stranded) wire of 22 gauge.
An example of the completed circuit is shown in Figure 2.
Note: the transmit (TX) pin of the mbed (pin 9) connects to the receive (RX) pin of the uLCD and the RX pin of the mbed (pin 10) connects to the TX pin of the uLCD. The ribbon cable that is used to connect the mbed to the uLCD has labels (RX and TX) that refer to the mbed’s RX and TX pins, not the uLCD’s pins. The ribbon cable is plugged into the bottom row of pins on the uLCD (the row closest to the edge). It also doesn’t help any that the printing on the uLCD cable connector is slightly offset and too close together.
Figure 4: mbed to uLCD connection
Please see http://developer.mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/ for close up views of the uLCD pins and the ribbon cable with details of the proper wiring. After following the instructions above as best as you can, if you have a multimeter, it doesn’t hurt to reference Figure 4 and double-check that the middle pin on the uLCD outer edge (TX, orange in Figure 4) is shorted to P9 on the mbed. And likewise, check the neighboring RX to be sure it is connected to P10 on the mbed.
Before connecting to power and running programs, if you have a multimeter, check to make sure that AT LEAST the following are correct:
• All of the 5V pins are connected to each other
• All of the 3.3V pins are connected to each other

ECE 2035 Homework 3: Mbed Setup
• All of the ground pins (the three-bar symbols) are connected to each other
• There is no short between 5V & ground, or between 3.3V & ground, or between 5V and
3.3V (although the resistance may be as low as 500 ohms or so)
The checks above won’t guarantee that nothing will be damaged upon powerup, so you should at least check the other connections one more time.
Task 4B. Run the following test programs. They are found in a zip file on the HW3 assignment page on Canvas, and the references below are simply for additional information. Each program is run by copying it into the flash drive that appears when the mbed is connected. (To avoid confusion, delete any compiled programs on the flash drive other than the one you are trying to run.)
1. 2035_P2_PB_LED: This test program uses the existing 4 LED lights on mbed, and 3 pushbuttons to create runway light effects.
Figure 5: Pushbuttons (left: internal wiring; right: connections to mbed and ground)
p23: increase the frequency of lights p22: pause the runway lights
p21: decrease the frequency of lights
Reference: https://os.mbed.com/users/4180_1/notebook/led-lighting-effects-for-modelers/ 2. 2035_P2_LCD: This test program displays a bouncing red ball through uLCD display.
Reference: https://os.mbed.com/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/
3. 2035_P2_Accelerometer_LCD: The test program displays a red ball on the uLCD screen. Different from 2035_P2_LCD demo, the red ball moves on uLCD screen based on accelerometer readings. LCD and accelerometer connections should be the same as illustrated in the reference.
Figure 6: Accelerometer
References: https://os.mbed.com/components/MMA8452Q-Triple-Axis-Accelerometer/

ECE 2035 Homework 3: Mbed Setup
https://learn.sparkfun.com/tutorials/mbed-starter-kit-experiment-guide/experiment-4- accelerometer
4. OPTIONAL 2035_P2_Speaker_PWM:
It is not necessary to use the speaker or audio for P2-2. This test is optional and checks one of the ways of using the speaker if you are interested in doing so. The test program uses mbed’s PWM hardware output to play 3 different tones triggered by pushbuttons. The speaker should be set up according to the reference. Note: it requires one change to your circuit: the speaker is connected to pin 18 in the schematic (via a BJT). Change the wire connect to pin 18 to pin 26 to use PWM audio in this audio test.
p21: 100Hz tone p22: 300Hz tone p23: 500Hz tone
Reference: https://os.mbed.com/users/4180_1/notebook/using-a-speaker-for-audio-output/
Another way to play audio is playing a sound file from your SD card. We have left the SD card in the circuit schematic in case you wish to use it to store sound files, but you do not need to wire it in or test it unless you actually use it in P2-2. In that case, you would need to use pin 18 for audio as shown in the schematic.
Homework 3 Check-off
Once you have successfully created the circuit in Figure 1, and can successfully run the three required test programs (LED, LCD, Accelerometer), demo your working system to a teaching assistant by the deadline to get Homework 3 checked off for a grade.

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com