I also had a problem with knocking & pinging. Tried higher octane but didn't work. The only thing that worked was when I cleaned the upper and lower intake manifolds, throtle body and EGR passages. You wouldn't believe the amount of carbon and sludge that builds up in the lower intake manifold. This job is time consuming but well worth the effort.
FRANK