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

Fast encoder sampling rate for nRF52xx

We need to sample two digital inputs GPIOs at rate of 100khz-1mhz. How can we do that? The QDEC is only good for up to 128us (~7khz) which is too slow for us. Is there a way to sample GPIO with DMA? If not, is there a way to do that without using interrupt every 10us?

Parents
  • Hi,

    You should be able to do this using GPIOTE, PPI and a TIMER in counter mode. See this post for some more information.

  • thanks you for the response. we need to sample 2 gpios that are inputs of a stepper motor encoder. We there for need to know per every rising or falling edge of each io compared to the other io. In other words we need a repeated pattern like this: io0 rise, io1 rise, io0 fall, io1 fall. We thus cannot sample count of events in 1 second. We need to sample the combination of BOTH io's every time each toggles. This is exactly what the QDEC does, but the QDEC is too slow for us. what i did is attached both to GPIOE interrupt and sample the data to a buffer in the interrupt context. This is working but very waste full in real time. Can i still use the link you added for these purposes some how?

Reply
  • thanks you for the response. we need to sample 2 gpios that are inputs of a stepper motor encoder. We there for need to know per every rising or falling edge of each io compared to the other io. In other words we need a repeated pattern like this: io0 rise, io1 rise, io0 fall, io1 fall. We thus cannot sample count of events in 1 second. We need to sample the combination of BOTH io's every time each toggles. This is exactly what the QDEC does, but the QDEC is too slow for us. what i did is attached both to GPIOE interrupt and sample the data to a buffer in the interrupt context. This is working but very waste full in real time. Can i still use the link you added for these purposes some how?

Children
No Data
Related