Detonation is a problem caused by competing flame fronts in an internal combustion engine. Only one of them is created by the spark plug, the other is undesired. When the air/fuel charge is ignited out of time and elsewhere in the chamber, a separate and undesired flame front is created after the spark plug fires. These competing flame fronts create a loud knock in the engine when they collide. It can result in serious engine damage like bent rods and damaged pistons.
There is a difference. Mostly about when the flame front started and how it propagates through the chamber. Pre-ignition is when a flame is ignited in the combustion chamber before the spark plug fires. It’s usually caused by hotspots, and reveals itself as a slight knocking heard during acceleration. Knock occurs when the peak of the ignition process does not or no longer occurs at the optimal moment in the engine's timing.
Most engines have a knock sensor that retards the engine’s timing to prevent this harmful condition. This condition raises cylinder pressures. The competing fronts collide creating this audible knock that resonates down the piston, through the bearings, and onto the crankshaft. Ouch!
There are several causes for these conditions. Most have to do with temperature and timing. There are also other factors to think about: has the engine been modified or have there been any changes to the ignition timing recently. Has the customer used a different fuel, fuels octane rating has a lot to do with its ability to resist early or pre-ignition. Check for TSB's in case of any inherent issues with the make and model you are diagnosing.