If it is a genuine fault, then it will be a sensor fault.
Knock sensors do detect knock often, that's what they do and is used as feedback to the ecu to adjust the timing (typically).
What happens when the ECU cannot adjust the timing/fueling enough to get rid of the knock?
Say a cylinder is misfiring due to a duff plug or a compression leak, there's no other sensor to pick up that problem.
No amount of adjustment is going to sort that, so the cylinder knocks and the knock sensor reports it.
You could replace the knock sensor, but that wouldn't solve the knock as you've not fixed what is causing the knock.
Generally most sensors can generate various codes.
Some will be open or grounded circuit codes, these usually point to faulty sensors or broken wiring.
Other codes will be related to above and below threshold that the ECU just can't rectify or relate to in a drivecycle.
The first type of fault is usually self detected when the ignition or engine is switched on. The ECU powers the sensor with a 5v signal and gets nothing or 5v back so it knows there's an issue pretty much straight away as most sensors take a 5v feed, alter it and return the altered signal back to the ECU.
Even a working sensor with no input from what it's reading will return a small voltage back to the ECU (that's how it knows it's circuit is complete or broken)
The threshold related fault codes often have to occur 3 or so times in a single drivecycle, depending on what type of sensor it is.
It might "pend" a code the first couple of times but if the issue continues in that drivecycle it will often light the EML when out driving or running the engine for a while.
What's needed is a tool to read the ECU properly and be able to understand it.
Knock sensors usually come within the generic codes that all manufacturers use so basic diagnostic tools usually don't have difficulty reading that.
Shame you haven't the actual code as it would make identifying what's going on a lot more simple.