Hi Jacopo,
I am wondering if you could use the linux pwm sysfs to control the pwm signal and see the correctness.
https://www.kernel.org/doc/Documentation/pwm.txt
Some example to enable one pwm on pwmchip0.
# cd /sys/class/pwm/pwmchip0
# echo 0 > export
# cd pwm0
# echo 20000 > period (20us is the total time period of the pulse)
# echo 10000 > duty_cycle (50% duty cycle)
# echo 1 > enable