Ok, time for results (from the bench)!
Here is a characterization of the analog filter (schematic above), compared with a few configurations of digital filter implemented in software on the stm32.

- image.png (52.31 KiB) Viewed 91853 times
Blue is the response of the hardware itself - and it performs exactly as designed. The passband is very flat in the middle where we expect to hear useful engine noises, the -3dB bandwidth is from around 2khz to around 28khz. The main purpose of the analog filter is to filter out noise outside of the band of interest that could "trick" the ADC in to
hearing frequencies that aren't there.
Then in orange, grey, and yellow are three possible digital filters, applied in software to the signal sampled from the ADC.
The filter in use is configured with a center frequency (ie, the information we care about), and a quality factor that picks how selective the filter should be. The bandwidth of the filter is roughly the center frequency divided by the quality factor: a filter with 10khz center frequency and quality factor of 5 will have a bandwidth of 2khz.
In the context of knock sensing, a higher quality factor will more strongly reject noise that's outside of the knock frequency, but will require more precise selection of the knock frequency so as to not accidentally filter it out. That said, good results are possible even with a relatively low Q: the TPIC8101 knock detection ASIC uses a similar architecture to what I've implemented on the stm32, and it uses Q = 2.3.
With Q=5, suppose there's valvetrain noise we want to suppress at 7khz, and our knock occurs at 10khz. If those two signals have similar magnitude, without a filter we would have trouble distinguishing if knock was occurring or not. With the filter, the 7khz signal will be attenuated by 11.7db, which will cut the amplitude of the valvetrain noise by a factor of 3.8. Now, the knock is 4x louder than the noise - much easier to detect!