Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[General] Communication failure with MAX232

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
857
Helped
23
Reputation
46
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,017
I've been making a product since 2014 which is good in service and over 5000 copies are running till this year. All function is ok without only one common problem.

In the circuit, I used PIC16F76 as the MCU and MAX232CPE for RS232 communication. This product needs communication with a PC all the time (24/7) to maintain the service. Problem is, almost every circuit works fine when tested and installed for the first time. After a few days(a few months in some cases) of running, it simply can not communicate with the PC. Only and only if the control card is replaced or the MAX232 IC is replaced with a new one, communication can be reestablished. Otherwise, no way to establish communication back with that PC.

But, that faulty card works fine with another PC. No need to repair anything. It simply works fine at another location with another PC. But if we replace again where it was having trouble, it doesn't work again. As these products are being installed all over the country, there is a discrete distance from each other. Sometimes this simple problem takes a few hundred KM of the journey. This is why the problem is becoming a pain day by day.

The primary circuit diagram was very simple:
max.PNG

In this configuration, the capacitors C1, C2, C3, C4 was used 0.1uF for the first time, then 1uF then 10uF. Finally, we were having a better result with 10uF. Another change was made periodically after the MAX232 heating issue, we added resistors with series in COM port lines.

max2.PNG

Physically MCU and MAX are closely placed.

IMG_20181106_143300.jpg

This update was done in 2015. After that time, there is only one problem which is still having. The problem is already described on the top. Again I'm repeating the problem.

Each circuit works fine at the beginning. Communication is ok between the control circuit and the PC. But after a few days (or a few months for some cases) there is no communication between the circuit and the PC. But if this faulty card is replaced with a new (or used at another place) one, communication works fine again. Even this faulty card works fine with other PC. Also, if the MAX232 is replaced, it works again. All I noticed that problem is with associated this MAX232 IC. But can not find any solution to this. There is no coding issue. If so, restarting would solve the problem.

I tried MAX232CPE, MAX232A. Both the same result. Baud rate: 9600 and 115200 both the same result. Is there any suggestion that I can try to solve this problem? Note that those PCs are not replaceable. Thanks in advance.
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

According your description you did no measurement to debug the problem...
This is the first thing for me.
Power supply voltage, power supply current, signal voltages, TTL as well as RS232 of both paths.
Use DVM and scope.
Compare all signals with the good working circuits.

Why don't you show the true (complete) schematic...including all power supplies, all GND connections, XTAL...

Also show the true PCB layout. Tell us about the cable type and length,
Tell us about noise sources, HF sources... nearby.
Tell us about grounding system including PC, possible ground loops, power supply and it's grounding...

Klaus
 

stenzer

Full Member level 6
Joined
Oct 1, 2012
Messages
359
Helped
68
Reputation
136
Reaction score
71
Trophy points
1,308
Activity points
4,167
Hi,

I tried MAX232CPE, MAX232A. Both the same result. Baud rate: 9600 and 115200 both the same result.
according to the datasheet the output voltage decreases for datarates higher than 120 kbps. With 9600 baud and each symbol consisting of 11 bits you are already operating the MAX232 at 105.6 kbps. By increasing the baud rate to 11520 (not 115200?!) you are operating the MAX232 at 126720 bps. So the output voltage might be already decreased, further the IC might get warm depending on your cabling. Have a look in the datasheet, the supply current increases with incrasing datarates as well as capacitive loads. Have you tried to reduce the baude rate?

In which environment is the circutry operated by means of temperaure, moisture, vibrations,.... ?.

How does the MAX232 supply connection looks like?

BR
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

I don't understand your calculations. 9600 baud are 9600 bps (bits per second)

Klaus
 

stenzer

Full Member level 6
Joined
Oct 1, 2012
Messages
359
Helped
68
Reputation
136
Reaction score
71
Trophy points
1,308
Activity points
4,167
Hi Klaus,

baud rate means symbol per second. So for an RS232 communication a symbol consists of 1 start bit, 1 stop bit, 1 parity bit (which is optional) and 8 data/word bits. So the actual datarate is BAUDE-Rate x Bits per Symbol.

BR
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
No,
Baudrate is bit per second.


Klaus
--- Updated ---

Hi,

I just reviewd the definition of "baud"...
Did I really used "baud" the wrong way all the years?

Klaus
 
Last edited:

stenzer

Full Member level 6
Joined
Oct 1, 2012
Messages
359
Helped
68
Reputation
136
Reaction score
71
Trophy points
1,308
Activity points
4,167
Hi,

it seems so, happens to the best of us :) . But at least that point has been clarified so far.

BR
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
It seems there is a general confusion.
Some sources talk that baud is the symbol rate.

I always used baud rate as bit rate.
ATMEL dataheets says "The baud rate is defined to be the transfer rate in bit per second (bps)".

Wikipedia says it's the symbol rate...but also says:
Example of use and misuse of "baud rate": It is correct to write "the baud rate of my COM port is 9,600" if we mean that the bit rate is 9,600 bit/s, since there is one bit per symbol in this case. It is not correct to write "the baud rate of Ethernet is 100 megabaud" or "the baud rate of my modem is 56,000" if we mean bit rate. See below for more details on these techniques.

So the OP's given baud rate of 9,600 to 115,200 means bits/second.


Klaus
 
Last edited:

stenzer

Full Member level 6
Joined
Oct 1, 2012
Messages
359
Helped
68
Reputation
136
Reaction score
71
Trophy points
1,308
Activity points
4,167
Hi,

I only knew the definition symbol per second so far.

Unfortunatly the wiki entry confuses me more than it claryfies. For me it seems the baude rate is only equal to the bitrate iff

one bit per symbol
holds.

But as it seems that also large manufacturers as Atmel use the definition bps = baude I'm not sure at all. Maybe the PO contacts the IC manufacturer to clarify how they define baud. Or even better, measuring the bit rate for a given baudrate. I think otherwise we will not come to a consensus.

BR
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

Back to the setup of UARTs:
When you setup a microcontroller UART to 9600 baud it defintely is 9600 bits/s or 104us/bit ... idependent of bits/symbol.
The same applies to PC UARTs.
Here I can't remember any other definition. I very often used a scope to determine the baudrate by the bit timing fir debugging circuits.

Otherwise the timing of one bit is different for 8N1 or 8N2 or 8E1 for the same baudrate (symbol rate)

Klaus
 

stenzer

Full Member level 6
Joined
Oct 1, 2012
Messages
359
Helped
68
Reputation
136
Reaction score
71
Trophy points
1,308
Activity points
4,167
Yes I agree, by setting up the MCU communication the register settings are defined by the desired baudrate and MCU frequency only, independent of the symbol “length“.

Sorry for any confusion (including myself) and missleading the PO and you Klaus.

BR
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
47,455
Helped
14,041
Reputation
28,335
Reaction score
12,692
Trophy points
1,393
Location
Bochum, Germany
Activity points
275,993
A difference between bit and symbol rate occurs for moduation schemes using multi-bit symbols, e.g. QAM16, QAM 256. RS-232 is simple digital interface, 1 bit per "symbol".
--- Updated ---

But basically, the bit rate discussion doesn't seem relevant for the original question. The OP reports communication problems even at 9600 bps.

There's obviously a hardware issue, and I support the suggestion to make signal level and quality measurements. It would be e.g. interesting if the communication problem occurs at RX, TX or both.

Desktop problems are tying logic ground to case and mains PE. In an enviroment which strong mains interferences, e.g. switching contactors, surge voltages may run down the RS-232 line. Overvoltage suppressors, e.g. bidirectional TVS diodes for RX and TX line can protect the RS-232 interface. You have e.g. a good chance to damage the level converter if you drive the TX line beyond V+/V-. Respectively a current limiting series resistor can be helpful.
 
Last edited:

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
857
Helped
23
Reputation
46
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,017
Hi,

According to your description, you did no measurement to debug the problem...
This is the first thing for me.
Power supply voltage, power supply current, signal voltages, TTL as well as RS232 of both paths.
Use DVM and scope.
Compare all signals with the good working circuits.

Why don't you show the true (complete) schematic...including all power supplies, all GND connections, XTAL...

Also, show the true PCB layout. Tell us about the cable type and length,
Tell us about noise sources, HF sources... nearby.
Tell us about the grounding system including PC, possible ground loops, power supply and it's grounding...

Klaus
Power supply issue: The device is powered by DC12V/5A[SMPS] with less than 100mV ripple voltage. Then filtered and regulated to 5V DC using a 78M05 voltage regulator. Again filtered with multiple capacitors.
The device consumes 66mA at 12V supply without any operation. A motor is driven through a relay that is separated from the MCU power supply. Only GND common. Signal voltage: 0-5V TTL. Did not measured voltage on the RS232 cable side. Serial Cable is used for the connection. PC to circuit distance is less than 50cm.

All signals and voltage of both faulty and new circuit is the same. I replaced a new one today (just before 15 min when I'm writing this)which was supplied only 3 days ago. A new circuit. But communication missing. I just exchange the MAX232 from another circuit (faulty too) and both of the circuits work.

I never drew the schematic diagram for this product (or most of the products). Designed the PCB and tested in hardware directly.

X-Tal: 8MHz with a 2X22pF ceramic(SMD) capacitor. PCB layer: 2. Most of the unoccupied spaces are covered by GND lines.

This product is fitted inside the CDM (Cash deposit machine). The machine body is made of cast iron and the body is grounded.
cdm.jpeg

High-frequency sources: SMPS power supply. But we install that SMPS inside a metal shield with the body.

PCB:

pcb.PNG
Note in PCB design: Recently I've added some pulling up and pulling down resistors as MAX232CPE do not have any. And reduced the series resistors in between the MAX & COM port. This design is not printed yet. Just added in design.

Cable:
00065-02-L.jpg

We use industrial mini PC inside: Brand varies m/c to m/c and touch screen type.
612v3082GOL._AC_SX466_.jpg

SMPS: 12V/10A(for PC) & 12V 5A (for control card)
s-l400.jpg
Both are fitted inside a metal encloser and screed with the body.

Motor:
12V Gear Motor, 100rpm.

Earthing voltage is less than 0.8V at peak load.
--- Updated ---

Hi,



according to the datasheet the output voltage decreases for datarates higher than 120 kbps. With 9600 baud and each symbol consisting of 11 bits you are already operating the MAX232 at 105.6 kbps. By increasing the baud rate to 11520 (not 115200?!) you are operating the MAX232 at 126720 bps. So the output voltage might be already decreased, further the IC might get warm depending on your cabling. Have a look in the datasheet, the supply current increases with incrasing datarates as well as capacitive loads. Have you tried to reduce the baude rate?

In which environment is the circutry operated by means of temperaure, moisture, vibrations,.... ?.

How does the MAX232 supply connection looks like?

BR
We checked with 115200 but use 9600 in all of the systems. Changing this baud rate is almost impossible. Because around 5000 systems is running now a days all over the country. We are unable to reinstall the PC software for each system. At our production house, we can test and change to new ones. But changing the supplied ones one by one is almost impossible now.

The machine is always kept at 22.5'C in Air-conditioned rooms. Moisture: Never measured. Vibration: Never measured.
--- Updated ---


--- Updated ---

Communication failure report:

* The PC to control card works, but the control card to PC is missing: 60%
* Both way communication missing: 40%

That means, PC to control card data receiving problems is found in most of the circuits.

In both of these cases, replacing the MAX232 IC resolves the problem.
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

I've just read the MAXIM datasheet.

In my eyes it lacks some informations.
... while they mention +/-30V abs. max RS232 input voltage
* there is no information about ESD (other Maxim RS232 datasheets specify ESD)
* nothing about capacitor selection (other Maxim RS232 datasheets mention at least "ceramics")
* no switching frequency of the voltage inverters
* and a doubtful typ. "Transmitter Output Resistance" of 10M Ohms. (Neither 10M nor 10m makes sense..)

For a develper this means: Things that are not specified are not guaranteed.
When there is no internal ESD protection, then one needs to add one externally.

Klaus
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

Wow, good and almost complete information..

RS232: Missing ESD protection shouldn´t be a problem in a closed metal case.

But how about ESD protection during production? ESD problems may cause long time fails ... after days or weeks. (This is what you see)
(In your case I´d avoid to assemble/connect/disconnect the RS232 cable when one or both SMPS are powered)
Here I see two SMPS (PC and the 10V one).
Please do some tests:
* use the 12V one. apply power, but don´t connect the outputs. Now use a DVM in AC mode and measure the voltage between ERATH_GND and output_GND.
* do the same with the PC power supply.
* use a working DCM: disconnect the RS-232 cable and measure the AC voltage between PC_GND and controller_GND. Do the same in DC mode.
if you measure voltages (in any case) above 15V, then install resistors / or RC to keep them low.

So far that´s all to measure for now.

*********************

Some general questions / informations.
* Inside the DCM, is there any star_GND?
* Motor and relay is always a source of noise / pulses.
* you say "multiple capacitors". But you need to choose the correct ones. Standard electrolytics often are slow and can´t suppress fast (ESD) pulses. Ceramics are fast..and maybe a ceramics in parallel to an electrolytics is a suitable workaround.
* The PCB layout is not bad, but may be optimized regarding EMV, EMI and ESD protection.
* for my taste the isolation between relay_contact_side and coil_side is low. I don´t know wheter there is any protection against overvoltage pulses when the relay swtiches (OFF).

Klaus
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
13,643
Helped
2,700
Reputation
5,396
Reaction score
2,618
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
101,880
Not that I know anything specific, but could a borderline component in the sending unit meet up with a borderline component in the receiving unit, thus one pushes the other into malfunction? From then on those two units no longer communicate with each other.

Yet either unit communicates okay when paired with a new partner. (Or a new MAX232 IC)

But not okay when the first two partners meet up again at any time in the future.

Another question: Is there any form of security (firewall) coming into play? A regional setting (similar to DVD players)?
Does it need renewal every few days? Or detects an intrusion of some kind after a few days? Etc.
 

Mithun_K_Das

Advanced Member level 3
Joined
Apr 24, 2010
Messages
857
Helped
23
Reputation
46
Reaction score
23
Trophy points
1,308
Location
Dhaka, Bangladesh, Bangladesh
Activity points
8,017
Hi,

Wow, good and almost complete information..

RS232: Missing ESD protection shouldn´t be a problem in a closed metal case.

But how about ESD protection during production? ESD problems may cause long time fails ... after days or weeks. (This is what you see)
(In your case I´d avoid to assemble/connect/disconnect the RS232 cable when one or both SMPS are powered)
Here I see two SMPS (PC and the 10V one).
Please do some tests:
* use the 12V one. apply power, but don´t connect the outputs. Now use a DVM in AC mode and measure the voltage between ERATH_GND and output_GND.
* do the same with the PC power supply.
* use a working DCM: disconnect the RS-232 cable and measure the AC voltage between PC_GND and controller_GND. Do the same in DC mode.
if you measure voltages (in any case) above 15V, then install resistors / or RC to keep them low.

So far that´s all to measure for now.

*********************

Some general questions / informations.
* Inside the DCM, is there any star_GND?
* Motor and relay is always a source of noise / pulses.
* you say "multiple capacitors". But you need to choose the correct ones. Standard electrolytics often are slow and can´t suppress fast (ESD) pulses. Ceramics are fast..and maybe a ceramics in parallel to an electrolytics is a suitable workaround.
* The PCB layout is not bad, but may be optimized regarding EMV, EMI and ESD protection.
* for my taste the isolation between relay_contact_side and coil_side is low. I don´t know wheter there is any protection against overvoltage pulses when the relay swtiches (OFF).

Klaus
ESD in production: We always try to keep this problem as low as possible when workers assemble the PCB. And the final check is also done carefully. But I'm not sure if still there is an ESD problem.

Voltage measurement: Ok, I will measure both of the SMPS.

Grounding: Yes, there is a star GND inside. All earth cables come to a point. A nut-bolt is connecting these terminals and also connecting the body and the outside earth point on the outer side. I mean, that single nut-bolt is placed through the CDM body. On both sides, the earth cables are connected.

Motor & Relay: Freewheeling diode is connected across the relay coil. And to reduce spark, a capacitor is used across the motor. No more protection here. Do you suggest any snubber circuit here?

Capacitor issue: total 3 electrolytic capacitor of 10uF, 1 ceramic TH capacitor and 3 SMD ceramic capacitor of 100nF X 2 & 10nFX1 is used after 78M05.

Isolation issue: Still no such isolation protection is used rather than using the relay and a freewheeling diode. Using Op-Coupler for relay switching may be introduced rather than using Transistor directly. For overvoltage spike, A reverse diode is used with LM317 which is supplying the power to the Motor coil through relay contact. Any suggestions here?
--- Updated ---

Not that I know anything specific, but could a borderline component in the sending unit meet up with a borderline component in the receiving unit, thus one pushes the other into malfunction? From then on those two units no longer communicate with each other.

Yet either unit communicates okay when paired with a new partner. (Or a new MAX232 IC)

But not okay when the first two partners meet up again at any time in the future.

Another question: Is there any form of security (firewall) coming into play? A regional setting (similar to DVD players)?
Does it need renewal every few days? Or detects an intrusion of some kind after a few days? Etc.
I'm guessing something like this. When a circuit is missing the communication, the same circuit never works again with that previous PC until the MAX232 is replaced. Even this faulty circuit works fine with other PCs. Even if I replace the MAX232 IC from another faulty circuit to this one, it works.

There may be security in PC software. But we still not sure what type of security is used here as the person who created this PC software is no longer in our company now. Some renewal is done remotely but that is not in the communication section. Only the adds and some instructions are renewed from the bank server.

I do not know any more information about the PC software as I take care of the hardware (circuit side) and relevant programmings only.
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
18,037
Helped
4,047
Reputation
8,094
Reaction score
3,960
Trophy points
113
Activity points
119,071
Hi,

O. K. So far.

ESD is not only caused by a human. I call differenly "charged" (w.r.t. Earth GND) SMPS also ESD, lower voltage, but lower series impedance, too. Often in the 100V ... 150V AC region = surely above +/-25V of MAX232 spec.

Grounding: (if not ESD) I don't think the RS232 problem comes from outside the CDM case. Maybe ground loops...

Motor capacitor: A capacitor without series resistor causes high current peaks. This causes noise and may cause early relay contact fail. Thus I'd add a resistor. Proper voltage rating with headroom, proper pulse current rating, no wire wound, somewhere 10ohms ... 100Ohms.

Capacitors: Are the electrolytics standard 50...120Hz rated or >=100kHz?
My rule is: one 100nF ceramics at every supply pin of every IC.... connected to a true GND plane. Others do it differently.

Isolation: The relay itself is an isolating device, thus there really is no need for an optocoupler. In 99% where an optocoupler is used to drive a relay it is useless...
But you need to care about creepage distance and clearance between "isolated" circuits ... this is what I miss.

Security device: I call a MAX232 as simple, dumb device. Unable to differ between one ir the other PC.
I rather think the RS232 levels drop with time and one PC is more sensitive than the other...
Voltage level measurements should show...

Klaus
 

Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top