Open jamieboyd opened 8 years ago
I changed the clock divisor in ppm.c from 50 to 45, and re-installed. 49.38 Hz, and pulse timing is much more accurate. In pwm.c: clk_reg[PWMCLCK_DIV]=0x5A000000 | (50<<12); //set pwm div to 50, giving 10 MHz change the 50 to 45. I think the problem is the line above that: clk_reg[PWM_CLCK_CNTL] = 0x5A000006; // source = PLLD (500 MHZ) and the constant referred to has changed between Pi versions, so that is selecting a different frequency than previously (450 vs 500). The better fix would be to change the 0x5A000006 to actually select 500Mhz, but where that info is, I don't know.
I think this is too small a thing to do fork and a pull request. So I'll just leave this here.
I got RPIO.PWM working on the Pi 2 with v2 branch. Thanks for the the update code. One thing I noticed is that the timing is a bit off. With the 20000 microseconds default period, I should get 50 Hz, but I get 44.45 Hz, so the period is off by a factor of 1.25. The pulse widths are similarly longer than they should be.