25kHz PWM signal to analog voltage (DC) using low-pass filter: Weird output

Be aware that a signal generator might have a different output
impedance from an Arduino pin, but even that doesn't explain non-linear
response - there must be some non-linear element in the circuit.