PWM frequency on photon, 10KHz MAX?

@makerken thanks for your answer, I have been trying to get it working, and at the end after a lot of tests (and with the help of an oscilloscope) I’ve been able to realize what was going on.

The Photon is not the problem, it works very nice and the PWM freq and resolution can be changed easy and as expected. The problem I’m facing is in the interface hardware that i’m using to achieve a power PWM, looks like I’m losing the switching capabilities at some point… I know this is not the best place to continue debugging this problem, but I’m going to explain my problem just in case it can help anyone (or anyone can help me :wink:

Let’s take a look, I have a circuit connected to A4 as shown in figure 1, A4 PWM output is connected to a 2n2222 transistor that interfaces a power MOSFET PSMN4R8-100BSE
to drive a PTC heating element.

I took some screenshots with the oscilloscope in different points of the circuit while A4 was outputting a PWM freq of 25Khz.

The wave in the first point is correct a pwm output at 25Khz

In point 2, after the resistor the wave is still square.

At point 3, after the transistor the wave looks like a saw shape, and from here i don’t understand what is going on or what to do to fix it (I’m not an electronics engineer but a software developer…) I did the calculations to characterize the switching max freq of the components and it looks enough.

Nothing… at least nothing until the duty cycle is almost maximun where some wave shows up may be for the last 1% of the duty cycle.

Does anyone have any advice or can point me in the right direction to fix the problem?