Dear XiangJun,
That is correct, it is a very sensible suggestion but whatever the quality of the incoming signal is or whether or not it oscillates I would expect to get both rising and falling interrupt flags.
In reality I more often than not got multiple falling edge interrupts without any rising edge ones.
The final solution is that, after setting everything up, use a flag and a delay of 10 ms to make things work as follows:
1) Configure the CMP block.
2) Set a flag to block full handling of incoming CMP interrupts.
3) Activate CMP interrupts.
4) Limited interrupt handling means a call to the same callback function but then it just clears the rising/falling flags.
5) Wait for 10 ms.
6) Then clear the limited interrupt handling flag.
Then everything works as expected: when I put a signal that goes from high to low and back again on the CMP unit's compare pin I get one recorded falling edge and one recorded rising edge.
I have not got the faintest idea why it freaks out just after setup but with the delay it works fine now.