Compression ratio too high. If the compression ratio is too high the combustion pressure will reach a point where a second flame front spontaneously ignites. As these two flame fronts collide the combustion pressure is abnormally high resulting in the pinging noise. The noise itself is not the problem , it is the resultant damage to rings ,pistons and bearings that warrants the removal of the cause.
Octane rating of fuel too low. Again if the octane rating is too low the ignited flame front burns too fast causing the maximum combustion pressure to be reached at a position where a second spontaneous flame front occurs. As these two flame fronts collide, pinging is evident.