This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

QDEC SAMPLEPER and REPORTPER relationship

Does anyone have additional information on the relationship between SAMPLEPER and REPORTPER in the nRF QDEC?

I understand that the SAMPLEPER sets the base sample period such that the QDEC will sample the inputs every SAMPLEPER time. Will this also generate the SAMPLERDY event every sample period, or only if there was a change in the inputs?

I see the REPORTPER register is used to set the number of samples to be accumulated before the REPORTRDY event is generated. However, the REPORTRDY event is only generated if the accumulator value is not 0. My question is, if the accumulator is 0 after REPORTPER samples, does the sample count get reset such that another REPORTPER samples must be taken before REPORTRDY gets generated? Or will the next sample that changes the accumulator trigger the REPORTRDY event?

For example, assume we're using REPORTPER = 10 samples/report and starting with a cleared accumulator (ACC = 0). After 10 samples, no motion has been detected, the accumulator is still 0, so the REPORTRDY event is not generated. Now assume sample 12 detects "forward" motion and increments the accumulator (ACC = 1). Is the REPORTRDY event generated immediately after sample 12, or does the REPORTRDY event not get generated until sample 20?

Thanks in advance for everyone's help with these questions.

Parents
  • If it occurs after 12SAMPLEPER, the event will not be generated before the 20'th. So all events reported back to the CPU will be in the next multiple of REPORTPERSAMPLEPER. If you see the attached image, the lowest line is the EVENTS_SAMPLERDY, while the above is EVENTS_REPORTRDY. It's around 5.1 ms between those two samples, which is 5100/1280 = ~4. Theoretically, it should be 5120 us, but I guess there is some jitter in my cursors.

    Are you seeing something else?

    Best regards Håkon

    WP_20130905_001.jpg

    WP_20130905_005.jpg

    WP_20130905_003.jpg

  • I haven't measured via oscilloscope, so I can't say for sure, but I had seen some behavior that caused me to think the REPORTRDY event was firing sooner than I expected. If possible, could you add your encoder inputs to the screen shot above so that I can understand the timing relative to when the inputs change? Also, please confirm, I assume you're clearing the accumulator on every REPORTRDY event. Thanks!!!

Reply Children
No Data
Related