I need to divide a 10 MHz clock by 100 to produce a 100 kHz clock. I can produce a 100kHz clock using RP2040_PWM but I need to use an external 10 MHz clock rather than the internal clock.
The RP2040 does support an external clock on Pin B but I can't find any code that supports this. Is it possible to use RP2040_PWM code to do this please?
That's not a very crucial line. All it does is verify whether the pin you've passed to the function is indeed a B pin for a PWM channel. If you verify that otherwise (e.g. manually), you can simply leave it out.
I think you need to pass the correct mode to the pwm_config_set_clkdiv_mode function. In the example I linked you to, it seems to be setup to have the timer run free while the input is high. There's also a one-shot trigger mode that increments the counter by 1 with every high- or low-going edge on the input. You'll have to root around in the documentation a little to figure out how they named the mode you want to use.
I've been able to write some C code that uses the Pico PWM components to divide an external clock by 100. I've written this by including pwm.h, using both Visual Studio Code and Arduino IDE V2.3.2. I've checked the quality of the divided clock using a spectrum analyzer and comparing its divided clock with the input clock divided by 100 using a 74HC390. There is no degradation using the Pico.
Next I need to incorporate the C code into the main Thonny Micropython code and so far I've not found a simple way to do that. If anyone is aware how to do that I would appreciate a reply.