Skip to main content

作为drature decoder interrupts not working properly

2 months ago

作为drature decoder interrupts not working properly

Posted by1user35 points 8 replies
0 upvotes

I connected a rotary encoder to the dev kit pro and tested it with the quadrature_decoder example. In polling mode it does work perfectly and the X value changes every "click" of the rotary encoder. The ISR reports on the other hand are very irregular and usually show up every 3-5 "clicks" of the rotary encoder.

Do you have an idea what the issue could be?

2 months ago

PM_Dialog

Hi There,

Thanks for posting your question on our new forums. I have escalated this internally, so I'll get back to you ASAP.

Thanks, PM_Dialog

2 months ago

PM_Dialog

Hi There,

According to our Team internally, the event counter isn't cleared in the interrupt. Please try to clear the event in the quad_decoder_user_callback_function as follow :

SetBits16(QDEC_CTRL_REG, QDEC_EVENT_CNT_CLR, 1);// Clear event count

Let us know if this helps to fix that issue.

Thanks, PM_Dialog

2 months ago

PM_Dialog

Hi There,

Could you please let us know if this resolution solved the issue?

Thanks, PM_Dialog

2 months ago

1user 35 points

Now the Interrupts fire way more often but still irregularly. Usually about 2-6 ISR reports are sent every "click". And sometimes but rarely 0.

2 months ago

PM_Dialog

Hi There,

This sounds like contact bounce – Our setup had some issues with that too. Adding a debouncing circuitry fixed it.

Thanks, PM_Dialog

2 months ago

PM_Dialog

Hi There,

Could you please let us know if adding a debouncing circuitry fixed it in your case?

Thanks, PM_Dialog

1 month ago

1user 35 points

Ok, I tried it with the debounce circuit attached below and it made it much better but still not perfect.

Could you let me know what debouncing cicuitry you used?

Attachment 大小
debounce circuit 126.17 KB
accepted answer!

1 month ago

PM_Dialog

Hi There,

We used 2x 100nF capacitors between the outputs from the quadrature encoder to ground.

Thanks, PM_Dialog