How to set the PWM clock to 148Mhz

I’m working on a project and I just can’t seem to make the default 100Mhz clock work for what I’m trying to do. I’m controling the PWM through registers. Anyway I’ve tried to dial in the PWM for the pulses in need to drive WS2812 LED and I just can’t HLPERIOD to anything less than 1 without that I’m just can’t get the on period long enough to send 1 and short enough for a 0. I’m about ready the throw in the towell and say it can’t be done, but I have one last thing to try and thats using 148.5MHz pwm clock. I’m not sure how to go about switching the clock for the PWM. It doesn’t say anything in the spec sheet under PWM and in the clock functions it has a div_clk_pwm_src_0 register but I’m not sure how to set it. I’m not sure what the divider means in this context. There is also a bit in clk_en_1 that sets clk_apb_pwm for enable or gate, not sure what gate is. I’m just getting my feet wet with low level embeded systems so this is all pretty new to me.

1 Like

In case anyone is interested I put my code up on GitHub - taspenwall/PWM-test: Working on driveing ws2812 with the duo

1 Like

I manged to get the PWM to work with the 100Mhz PWM clock. You can check out the code http://git.hub/taspenwall/PWM-test

1 Like

have you make any progress on this?

1 Like