It is generally accepted that knocking combustion influences the heat transfer in SI engines. However, the effects of heat transfer on the onset of knock is still not clear due to lack of experimental data of the thermal boundary layer close to the combustion chamber wall. This paper presents measurements of the temperature in the thermal boundary layer under knocking and non-knocking conditions. The temperature was measured using dual-broadband rotational Coherent anti-Stokes Raman Spectroscopy (CARS). Simultaneous time-resolved measurements of the cylinder pressure, at three different locations, and the heat flux to the wall were carried out. Optical access to the region near the combustion chamber wall was achieved by using a horseshoe-shaped combustion chamber with windows installed in the rectangular part of the chamber. This arrangement made CARS temperature measurements close to the wall possible and results are presented in the range 0.1-5 mm from the wall. The engine was run with constant fuel flow under near stoichiometric conditions. Knocking and non-knocking conditions were achieved by using different mixtures of n-heptane and iso-octane.