Hi nRF support team,
What do I need to do if I want to use the precise delay of NS, now the delay error is very large.
thanks
Hi nRF support team,
What do I need to do if I want to use the precise delay of NS, now the delay error is very large.
thanks
Hi
You get the most accurate timing by running a TIMER peripheral with prescaler 0. Then you get a timer frequency of 16MHz, which equals an interval of 62.5ns.
What kind of accuracy do you need?
If you are triggering a measurement from the software keep in mind that your code might be interrupted by other parts of the system.
If you want to measure hardware events you can use the PPI controller to connect the hardware events to the timer directly, which ensures much more consistent timing.
Best regards
Torbjørn
Hi,Torbjørn
Thank you for your reply
I need the software to measure, and the delay accuracy is around 1us. Do you have the peripheral example of Timer? I am a novice, and I don't know how to configure it
thanks
Hi
1. You could have a look at the clocks_start(..) function from the ESB example:
https://github.com/nrfconnect/sdk-nrf/blob/master/samples/esb/ptx/src/main.c#L58
2. Do you happen to have a description of how the IO pulses are generated?
The PWM module is quite flexible, and can be configured in a way where both the duty cycle and frequency can change dynamically, so it is possible that there is a way to do this using PWM.
Best regards
Torbjørn
Hi,Torbjørn
Thank you for your reply
1.I tested the clock at 32M and the exception did not improve.
2.Is there such a variable cycle PWM driver routine?
Looking forward to your reply
Hi
2. Yes, please read the Decoder with EasyDMA chapter available here.
Essentially, when you set the DECODER.LOAD mode to WaveForm, you can have the PWM interval/frequency updated dynamically based on values in RAM.
Values 0, 1 and 2 in the PWM buffer will set the duty cycle for up to 3 GPIO outputs, while value 3 sets the common countertop value for the three output channels. The PWM frequency is defined by the PWM base frequency (configurable through the PRESCALER register) divided by the countertop value, and in this mode you can have the frequency change for every single pulse.
For an example of how to use the nrfx_pwm driver in NCS you can have a look at this example.
It doesn't use the WaveForm LOAD setting, but you can change the example to test this out.
Best regards
Torbjørn
Hi,Torbjørn
Thank you for your reply
I'm going to test it out
thank you very much
Hi
Good luck. If you have any issues with it just let me know
Best regards
Torbjørn
Hi
Good luck. If you have any issues with it just let me know
Best regards
Torbjørn
Hi,
Torbjørn
thank you very much