CSE585 Laboratory Assignment #3


Building a Simple System: an Ultrasonic Range-finder

Reading:


1. Setup

Do these things in this order to avoid damaging the StrongArm boards. They have proven to be fragile.

1. Handler of boards must put on the anti-static wrist strap. This ties you to ground so that you cannot build up a static charge.

2. Unplug the power supply from the wall if it isn't already. 

3. Plug P9 and P8 from the power supply into J16 of the power supply. The headers are keyed so they only go in one way

4. Plug the small power conditioning unit (the PCB with lots of caps) into the PCI backplane

5. Plug the MDB into the PCI backplane (any slot, its just for power).

6. Plug each pin on the gray ribbon cable into a different hole in your proto-board (make sure there are no pins in the same row). Place them in order so that you can easily access them by position. Pin 1 has a red line. Note that two of the strands are clipped out of the ribbon cable.

7. Plug the connector on the end of the ribbon cable onto the MDB so that it covers J21 and J28. Pin 1 (red wire) should be aligned with the white triangle next to J21 (indicates pin-1). Make sure to get both rows on.  The gray ribbon cable pinout are shown below, note that some of the LCD pins are controlled by the GPIO registers, and some are controlled by the Peripherial Pin Control (PPC) registers.

Even Pins on Ribbon Cable

1 3 5 7 9 11 13 15
GND LCD9 LCD10 LCD11 LCD12 LCD13 LCD14 LCD15

Odd Pins on Ribbon Cable

0 2 4 6 8 10 12 14 16
LCD0 LCD1 LCD2 LCD3 LCD4 LCD5 LCD6 LCD7 LCD8

8. Plug gray ribbon pin number number 1 (red line) into ground on your proto-board. This is very important!

9. Plug sonar connector into the proto-board and connect as followes. The number below is the numbering of the pins on the small connector, you have to map these to the DIP socket yourself.

Name GND BLNK INIT ECHO BINH VDD
Pin 1 * 2 4 7 8 9
Connect to 0 V 0 V input output 0 V 5 V
* Pin 1 is the pin closest to J1

10. Power up the PCI backplane and the Proto-board. The rest is software. The LEDs on the MDB should contain '10' after successful powerup.

11. Any time you have to rewire something POWER OFF FIRST

12. Connect the serial cable from the MDB to the PC.

The Sonar 

The sonar device sends out 16 pulses at 49.5 kHz that travel from the disk and reflect off of the objects in front of it. The first echo to return (from the closest object) is used to raise the output signal. The range finder is started by raising the INIT signal. When the echo returns the ECHO signal goes high. INIT has to stay high at least until ECHO goes high. The sonar board operates this way in the mode you will using. You should ignore the ECHO line for 500us after INIT is asserted to avoid electrical noise due to the firing of the sonar.

Make sure to be careful in handling the sonar board and transducer head. The device generates high voltages on the controller board and at the transducer leads (in the range of 200 to 400 volts). Touching the sonar circuit board while it is powered up and/or operating may result in a burn.

The sonar transducer head should be connected to the range finder board as follows:

E1 on the range finder board --> (+) brass tap on black disk
E2 on the range finder board --> (-) black tap on black disk

The ECHO output should be connected to a 4.7 Kohm pull-up resistor (i.e. connected to 5 V). Pin 7 is the output.

Try the following procedure to make sure that your sonar is working properly. Connect INIT to high to start the range finding operation. You should hear a scratching, which is the transducer sending off the 16 pulses. In addition, ECHO goes high immediately. Reset the sonar range finder by making INIT low and ECHO should go low as well.

Your can find more documentation about the sonar range finder at the Acroname and Wirz web sites.


Part 2: Hook Up the Sonar

You will now connect the sonar to the StrongARM board. Using the board schematics (You'll need only Page 2 and Page 14),  pick two pins that are available on J21 that correspond to either LCD pins controlled by either the PPC or GPIO pins on the sa1100. Connect INIT to one of these pins and connect ECHO to the other. NOTE the following: J21 pin 1 is pin 2 on the Gray Ribbon and vice-versa and so-on. Keep this in mind as you hook up your sonar. The most likely source of bugs is wiring error and bit position mistakes. Note also that programming the PPC is a little different then the GPIO's.

Launch the ARM SDT project manager application. Load your project these project files. Under the Debug hierarchy browser, edit main.c to fill in the function readSonar that asserts INIT and polls the ECHO response. In readSonar, count the number of times you need to poll the ECHO signal before it comes back (this should correlate to distance), and return this value. Once the ECHO is received, readSonar should de-assert (clear) INIT and return. Main should run in an infinite loop that calls readSonar, prints the result (use printf to send to debugger console window), then waits (busy-wait) for at least 1 second. Consult the documentation we gave you last week, and look at the as1100.h file for structure definition and base addresses. If you are brave and want to try to use timer and signal interrupts, here is a skeleton system that uses timer interrupts which can be extended to respond to ECHO as well. Everything you need to know to do this is in the handout under interrupt controller, or in the sa1100.h and sa1100.c files.

When you are ready to try your code follow this procedure:

If you are curious, we can set up a scope to look at INIT and ECHO signals.

 

Good Luck.