So
the serial comms aren't working to your
microcontroller eh?
Step 0: Does the power supply
work?
- Make sure your circuit is getting proper power, between pins 15
and 16 should be 5V. DONT USE BATTERIES WHEN TESTING A CIRCUIT.
batteries tend to die when you least expect it. Use a 'wall wart' or
other plug in supply for building and testing your circuit.
Step 1: Does the computer work?
- Open up a terminal program on the computer
- Set it for 2400 baud rate with no handshaking at all
- Type something, note if it prints out what you type (this is
called local echo, probably off, in which case you wont see anything,
if its on, just remember that for step 5)
- Jumper (short) togethor pins 2 and 3 of the computers serial
connector in any way you like (this loops back the data)
- Jumper pins 7 and 8 of the serial connector. (this is hardware
handshaking if the hardware insists on it)
- Type something, you should see it printed back on the screen to
you
If this didn't work, you must have the wrong port, or a dead comm port,
or the handshaking is not really turned off. You need that step to
work, really, really you really do.
Step 2: Does the microcontrollers
buffer work?
- Connect your circuit to the computer.
- Remove the microcontroller, if you cant remove it, set both of
the serial pins to be inputs.
- Short the recieve serial and the transmitt serial of the
microcontroller.
- Type something as in step 1, you should see the characters echoed
back to you.
If this step dosn't work,
- Try lowering the baud rate on the computer to 2400, any buffer
should be able to work at that rate. If this fixed it, the buffer
cannot handle the baud rate you were using. Bring up the baud rate
until characters start to get mauled, then bring it down 2 notches.
- If you are using a MAX232 or equivilent, go to step 10
- Your on your own.
Step 3: What REALLY is the baud
rate of my microntroller?
- Set the computer for the baud rate that you expect the
microcontroller is using
- Set up the controller with a program that continiously sends the
character U to the computer (needs to be upper case)
- Watch the terminal program, depending on teh characters you get
back, you can tell is there is a buad rate problem.
Step
10: Is the max232 wired right and working properly?
- If your serial connector
is a db9, make sure the voltage from ground to pin 5 of the db9
is 0V and that the voltage from pin 5 of the db9 to Vcc is about 5V, if
it isn't make sure pin 5 is properly grounded.
If your serial connector is
a db25, make sure the voltage from ground to
pin 7 of the db9 is 0V and that the voltage from pin 7 of the db9
to
Vcc is about 5V, if it isn't make sure pin 7 is properly grounded.
-- The following pins
references refer to the max232 or equiv --
- The voltage from ground to pin 15 should be 0V, if its not check
that this pin is properly wired to ground.
- The voltage from ground to pin 16 should be from 4.5V to 5.5V, if
it isn't make sure this pin is wired to your 5V supply, and that the
supply is working properly (no dead batteries etc)
- The voltage from ground to pin 2 should be about 10V, if it isn't be sure the
polarity of the capacitors conntected to pins 1 and 3, 4 and 5, 2, and
6 is right. Negitive of the capacitors should be on pin 1, pin 5, PIN 6
(this is not a typo) and on the capacitor from 5V to pin 2, the
negitive should be on 5V (this is not a typo)
- The voltage from ground to pin 6 should be about negitive 10V, if it isn't be
sure the polarity of the capacitors conntected to pins 1 and 3, 4 and
5, 2, and 6 is right. Negitive of the capacitors should be on pin 1,
pin 5, PIN 6 (this is not a typo) and on the capacitor from 5V to pin
2, the negitive should be on 5V (this is not a typo)
- The voltage from pin 3 to pin 1 should be 5V or a little less, if
its not, be sure the capacitors polarity is correct.
- The voltage from pin 5 to pin 4 should be 10V or a little less,
if its not, be sure the capacitors polarity is correct.
If the capacitors are all definitly the right way around and these
voltages are not right, the chip is not working, only you may have a
clue as to wh. Check for shorted solder joints, or shorted wires,
possibly try ONE more chip.
DO NOT TRY ALL YOUR CHIPS AS YOU MAY HAVE A
WIRING ERROR THATS BURNING THEM OUT THAT YOU HAVN'T NOTICED YET!!!
The computer should be connected to pins 7, 8, 13 or 14 only.
The microcontroller should be connected to pins 9, 10, 11, 12 only.
If your here from step 2.2, your voltages are good, but it still wont
echo back data, you most likley have the rs232 pins 2 and 3 reversed.
If you have all this working, go back to the step you were working on.