The ECU is the brains of the engine control system, so when the brain isn't functioning correctly neither is the engine or anything else that the microprocessor controls - which may include the charging system, transmission, various emission controls and communications with other onboard control modules. Once a diagnosis has been made — then and only then should the ECU be replaced.
All too often, the blame falls on what is least understood. If an engine isn’t running right and the cause isn’t obvious, blame the computer. Throwing parts at a problem in an attempt to solve it may be good for the parts business, but attempting to return a replacement ECU because it didn’t fix the problem isn’t good for anyone. Warranty returns on complicated and expensive components like powertrain control modules can be tricky and are a no-win situation for everyone.

Over 50 percent of ECUs that are returned under warranty have nothing wrong with them! So it’s obvious a lot of people are swapping computers to see if a different ECU will fix their problem.
The trouble with returns is if the ECU has been on the car, you have no way of knowing if it is still "good" or not. Somebody may have crossed up some wires, zapped the ECU with too much voltage or who knows what? The computer needs to be tested and verified before it can go back on the shelf and be sold to somebody else.
Unfortunately, there’s no easy way of doing that in a parts store. The ECU has to be hooked up to a sophisticated simulator that exercises all of the computer’s input and output circuits to make sure it works correctly - which means the ECU has to go back to the supplier, be retested, and if no fault is found, repackaged and put back into stock. You can understand then why many parts stores have a policy of "no returns or refunds on electronic components."
So - don't even think about replacing that ECU until you're confident that you've properly diagnosed the problem.

One way to reduce the risk of ECU warranty problems is to find out why the old ECU died. Determining the cause of death may not always be possible, but it may be essential to prevent the same thing from damaging the replacement ECU in some cases.
ECUs typically fail for one of two reasons: voltage overloads (often due to a short in a solenoid or actuator circuit) or environmental factors (corrosion, thermal stress or vibration). If the shorted solenoid or actuator isn’t found and repaired, the voltage overload it creates may damage the replacement ECU, too.
As for environmental factors, water is the main thing to avoid. If water gets inside a ECU, it can short circuits and set up irreversible corrosion that ruins electronic connections. Most remanufacturers won’t even attempt to repair a ECU if the vehicle it came out of was submerged in a flood. Replacement is the only option. Thermal stress and vibration can form microcracks in circuit boards (which are repairable). This often has more to due with the ruggedness of the circuit design than operation factors in the vehicle itself.

Because there are so many different ECUs, accurate identification of the ECU and its correct replacement is absolutely essential to prevent unnecessary returns. Many ECUs appear to be exactly the same on the outside (same sized box and connectors) but may be wired or calibrated differently inside. If the wrong ECU is installed in a vehicle, it may run but probably won’t run well. Close enough isn’t good enough when it comes to replacing ECUs. It must be the correct replacement for the application.
Accurately identifying the ECU requires not only the vehicle year, make, model and engine size, but also the OEM part number on the ECU itself. Most supplier’s catalogs list replacement ECUs both ways. So if in doubt, always refer to the OEM number on the ECU and look it up in the suppliers cross reference index to find their replacement part number.
The calibration chip and PROM contains the programming instructions for the vehicle application. That’s why it usually doesn’t come with the replacement ECU. There are too many different possibilities. On many newer vehicles, flash memory or "EEPROMs" (Electronically Erasable Program Read Only Memory) are used. If the replacement PROM is not properly programmed for the application, it must be reprogrammed after it has been installed.
Unfortunately, the ability to do this type of reprogramming is not readily available to the aftermarket. The car makers don’t want aftermarket technicians messing around with the calibration of their onboard computers because they’re afraid doing so may alter emissions or performance. But that’s another issue. One such example is Chrysler transmission modules. They must be reset with the factory DRB scan tool and dealer codes to set the "pinion factor," which controls the operation of the speedometer.

Because ECUs are fairly expensive, almost all aftermarket replacement ECUs are "remanufactured" units. ECUs are not rebuilt in the same way that alternators and water pumps because there are no mechanical parts that wear out. Remanufacturing in this case usually means testing the computer, isolating and repairing any faults that may be found, then retesting the computer to make sure everything works correctly.
Remanufactured ECUs are typically sold one of two ways: on an exchange basis from stock, or on a custom rebuild basis. If a particular ECU is not in stock or is unavailable, you can often send the old ECU to a remanufacturer for repair. Turn around time is typically a few days and the cost is the same as selling him an exchange unit from stock (except there’s no core charge). Some ECUs, though, may not be repairable. As we said earlier, most remanufacturers will not even touch a ECU if it came out of a flooded vehicle.

Replacing a ECU is essentially a matter of swapping boxes. Accessibility can be a problem on some vehicles because the ECU is often buried under or behind other components in the instrument panel, climate control system or console. Some are located under a seat and require removing the seat.
Regardless of the ECU’s location, though, one thing every installer should do (but many don’t) prior to removing the old ECU and installing the replacement ECU is disconnect the battery.
Once the ECU has been installed and reconnected, the battery can be reconnected, too. But the job isn’t done yet. Many ECUs have to undergo a "relearning" procedure after they’ve been installed or if they’ve been disconnected from the battery.
On some applications, there may be a specific procedure for establishing the base idle speed. On others, it may be necessary to take the vehicle for a short test drive so the computer can adjust itself. The exact requirements will be spelled out in the vehicle’s service manual, but that doesn’t mean the installer has access to a manual or will use it. So the best advice here is to test drive the vehicle after the computer has been installed. A short drive cycle that includes going over 35 mph will usually reset most computers so they run properly.
Most ECUs will also continue to learn and make small adjustments to the fuel mixture and other functions over time as the vehicle accumulates miles. If the ECU also controls the transmission, it may take awhile to relearn the driver’s habits so the transmission may not shift exactly the same as before until this occurs.
Finally, if the Malfunction Indicator or Check Engine light comes back on after the ECU has been replaced, it means there’s still a problem with the vehicle - not the ECU (assuming the code is not one for an internal ECU fault, in which case the ECU would be saying it is faulty). The presence of fault codes means something else is wrong that needs to be diagnosed and repaired. So until the real problem is found and fixed, the ECU may not function normally.
If the engine control system is not going into closed loop, chances are the coolant sensor or oxygen sensor are not working properly. If spark timing seems to be over advanced or retarded, the problem may be a faulty MAP sensor, misadjusted throttle position sensor or overly sensitive knock sensor. And if nothing seems to work right, low charging voltage due to a weak alternator or poor battery connections may be the fault.
Remember, the ECU needs all its sensor inputs, proper battery voltage, a good ground and the ability to send out control signals to function normally.