I want to drive a device that needs to output a fixed frequency (409khz) to give it the clock frequency. i use nrf52832, sdk15.0.0,
How can I use PWM?
I want to drive a device that needs to output a fixed frequency (409khz) to give it the clock frequency. i use nrf52832, sdk15.0.0,
How can I use PWM?
Hello,
I am terribly sorry for the late reply.
If you need a steady pulse (PWM) I suggest that you use the PPI. This way, you will not have to wake up the CPU to change the value of the output GPIO.
The problem, as I see it, is that you have to use a timer, which uses the 32MHz. This means that you have a tick rate of 32.5ns, which means that you would need (1 / 409 000) / 32.5e-9 ~= 39.11 tics in order to have 409kHz. If you use 39 ticks, it will give you a frequency of 410.2564kHz. Alternatively, 40 ticks will give you a frequency of 400kHz.
Depending on what accuracy you need on the frequency, 410kHz might work, but it is not possible to get exactly 409kHz.
Best regards,
Edvin
Hello,
I am terribly sorry for the late reply.
If you need a steady pulse (PWM) I suggest that you use the PPI. This way, you will not have to wake up the CPU to change the value of the output GPIO.
The problem, as I see it, is that you have to use a timer, which uses the 32MHz. This means that you have a tick rate of 32.5ns, which means that you would need (1 / 409 000) / 32.5e-9 ~= 39.11 tics in order to have 409kHz. If you use 39 ticks, it will give you a frequency of 410.2564kHz. Alternatively, 40 ticks will give you a frequency of 400kHz.
Depending on what accuracy you need on the frequency, 410kHz might work, but it is not possible to get exactly 409kHz.
Best regards,
Edvin