View previous topic :: View next topic |
Author |
Message |
kd5uzz
Joined: 28 May 2006 Posts: 56
|
Serial via MAX232/NTE7142 is gibberish |
Posted: Mon Feb 04, 2008 10:12 pm |
|
|
I've always had problems using MAX232 chips, and I don't understand why. I've milled a board that is to be a 4 channel serial servo controller. I can't find any shorts on the board. I'm using a 16F88 @ 20mhz. The board has an onboard 7805, but I'm powering the board via a PicKit2 clone (using a 6pin header on the board). Compiler version 3.222.
When I use a brainstem brand ttl<->rs232 adaptor board I get clean serial data from the PIC. When I insert the NTE7142 (a clone of the MAX232) I get gibberish and the LED that the PIC is blinking changes speed and eventually stops blinking. I'm using dipped tantalum capacitors (all 10uf) on the NTE part, as well as a dipped tantalum capacitor (10uf) and a .47uf cap on the 7805 output.
Thoughts?
I know its a mess, but here is the schematic:
(the max232 DOES have power, its just not in the schematic)
In the schematic it looks like the (-) of each cap is marked...that's actually the (+), it's a quirk of Eagle.
Code: | #include <16F88.h>
#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=57600, xmit=PIN_B5, rcv=PIN_B2, errors)
#define HeartBeatOn output_high(PIN_A1);
#define HeartBeatOff output_low(PIN_A1);
void main(){
while(true){
printf("Hello World!\n\r");
HeartBeatOn;
delay_ms(100);
HeartBeatOff;
delay_ms(100);
}
} |
|
|
|
Guest
|
|
Posted: Mon Feb 04, 2008 11:40 pm |
|
|
kd5uzz,
You need to connect C4 to ground and NOT 5V.
You are also missing a 5th capacitor from pin 16 (Vcc) to ground.
Good luck,
Noam |
|
|
Ttelmah Guest
|
|
Posted: Tue Feb 05, 2008 4:15 am |
|
|
You can connect C4 to +5v. This is a 'trick' commonly used on small boards, to reduce the voltage rating needed for this part. However doing this, makes the pin16 capacitor much more essential, and increases the value needed for this part....
Best Wishes |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
|
Posted: Wed Feb 06, 2008 1:19 pm |
|
|
Guest,
What value should I use for the VCC cap? 10uf like all the others? Is that simply a decoupling cap?
Ttelmah, would I be better off connecting C4 to GND?
I used a pinout I found on google searching for 'MAX232 schematic' |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
|
Posted: Wed Feb 06, 2008 1:27 pm |
|
|
I get the gibberish, not from the output of the NTE part, but from the TTL level output from the PIC. I.e. leaving the TTL level adaptor board from brainstem connected to the board, when I remove power from the board, insert the NTE part and re-apply power (changing no connections) I get gibberish and the LED blinks randomly, instead of at a steady pace. The LED eventually stops blinking alltogether. Without removing power, simply resetting the PIC via MCLR and it starts blinking again (still randomly). |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
|
Posted: Wed Feb 06, 2008 1:35 pm |
|
|
It seems the PIC is actually restarting, over and over.
With this code:
Code: | #include <16F88.h>
#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=57600, xmit=PIN_B5, rcv=PIN_B2, errors)
#define HeartBeatOn output_high(PIN_A1);
#define HeartBeatOff output_low(PIN_A1);
void main(){
int counter;
printf("ADC2ESC Hardware diagnostics v1.0\n\r");
while(true){
printf("Hello World! Counter:%u\n\r",counter++);
HeartBeatOn;
delay_ms(100);
HeartBeatOff;
delay_ms(100);
}
}
|
I get this:
ADC2ESC Hardware diagnostics v1.0\0A
Hello World! Counter:255\0A \0D
ADC2ESC Hardware diagnostics v1.0\0A
Helll World! Counter:ADC2ESCCHardware diagnostics v1.
0\0A
ADC2ECC Hardware diagnostics v1.0\0A
Hello World! Counterñ\0A \0D
ADC2ESC Hardware diagnostics v1.0\0A
Hello World! Counter:ADC2ESC Hardwrre diagnostics v1.
0\0A
Hello World! CounADC2ESC HHello World! Counter \
ADC2ESC Hardware diagnostics v1.0\0A
Hello World! C0unter:6ADC2ESC Hardware diagmostics v1
.0\0A
Hello World! Counter:7ADC2ESC Hardware diagnostics v1
.0\0A
ADC2ESC Hardware diagnostis v1.0\0A
Maybe it has something to do with Guest's comment about connecting C4 to GND instead of V+? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 06, 2008 1:58 pm |
|
|
1. Post your compiler version. It's a 4-digit number in this format:
3.249, 4.013, 4.066, etc. It's at the top of the .LST file, which will
be in your project directory after you compile a program.
2. Download the MAX232 data sheet. Look at Figure 5 (on page 17):
http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf
Make sure you have the correct polarity and connections for the
capacitors. Your schematic is ambiguous. It's tough for me to tell
whether the markings are a "+" or a "-". Normally, the polarity
markings on a schematic should not be placed on top of a wire. |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
Recap |
Posted: Wed Feb 06, 2008 1:59 pm |
|
|
Ok, just a recap. The NTE7142 seems to be working. As shown in my last post I get valid data from it, its just that the PIC is rebooting a few times a second. This only happens when the NTE part is in it's socket. I'm not sure if my caps are the problem (not having one between 15 and 16 of the NTE part) or the wrong value (I just looked at the datasheet for a MAX232 and it says to use a 1.0uF, I'm using 10uf. When I watch the TTL level serial data via a Brainstem everything works fine. The most logical (to me, and therefore mostly likely wrong) is that is it related to power for the NTE part. |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
|
Posted: Wed Feb 06, 2008 2:20 pm |
|
|
3.222
The polarity of the caps are correct. But I'm using different values (I'm using 10uf with my NTE part, maxim says to use 1uf for a MAX232. I've got to head to class, and I won't be back until tomorrow, but I'm going to try to switch to 1uf caps and add a cap between GND and V+ then. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 06, 2008 4:42 pm |
|
|
I installed vs. 3.222 and ran it on a 16F88 in a PicDem2-Plus board.
It worked OK. You probably have a hardware problem.
1. Do you have a pull-up resistor on MCLR ?
(Use 10K for ICD2 or 47K for CCS ICD-U40).
2. Check all connections, including power, ground, and the crystal. |
|
|
kd5uzz
Joined: 28 May 2006 Posts: 56
|
|
Posted: Wed Feb 06, 2008 6:04 pm |
|
|
I swapped out caps, no change. I swapped the NTE7142 for a Sipex SP232ACP that I thought was dead. It seems to work fine. ugh. I hate these chips. I've always had problems. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 06, 2008 6:05 pm |
|
|
I don't trust NTE. You don't know what chips really are. They wipe off
the label and paint on their own label. |
|
|
|