Quadrature decoder at PSoC 4

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello. Sorry for my english, I'm using a Google translator.

   

I want to use the quadrature decoder module to connect the mechanical encoder to the PSoC 4 (CY8CKIT-049-4200). When I add the module and collect the project, I get a message "E2071: Unable to pack the design into 4 UDBs." See the Digital Placement section of the report file for details. "
I watched in datashit that the component of the quadrature decoder (8 bits) takes 6 PLDs, if the filter is off, and 7 PLDs if the filter is turned on. By default, the filter is enabled. I turned off the filter, and was able to assemble the project. Why does not the default component allow me to build a project? Is there not enough macrocells in CY8CKIT-049-4200 4 for this?
I do not want to put external capacitors, I need this filter. I tried to add 1 external filter such as "Glitch Filter", and the project again refused to assemble with the same wording of the problem.

   

I was able to assemble the project by adding 2 elements such as "Debouncer". Will this element be used as a simple alternative to "Glitch Filter"?

0 Likes
15 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

You have exceeded the resources of your device you need a larger Psoc device. Check the resource monitor on the extreme right side of the Psoc Creator screen when you are in the Topdesign.cysch. As you can see your device only has 4 UDB resources.

   

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Please Post your code and attach it to a new comment.

0 Likes
Anonymous
Not applicable

I attached a table with the used cell resources in my first message.
It shows that the resource of this PSoC is far from full. I even recompiled the project for a larger chip, and made sure that the number of cells used does not exceed the allowable number for CY8CKIT-049-4200.
But after a more careful study of the datasheet on the component, almost at the very end I found a very interesting phrase: "Note The PSoC 4200 family can support 8-, 16-, or 32-bit counter size with glitch filtering disabled." Other configurations are too large For this family ". It turns out, it is not always possible to be guided only by the table of resources used.

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

CypressFan, What kind of encoder you are using? Is this a simple 20/turn shaft encoder for front panel like one on the picture?

   

   

0 Likes
Anonymous
Not applicable

Yes, simple mechanical encoder, like one on the picture.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You could easily do the encoding in software using a programmed state-machine and a (large) switch{} block.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks, I already used this method (in assembler, in another project). I just wanted to make the most of the hardware capabilities of PSoC.

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Found a rather old project, not so well documented and the names are in German language...

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

As you have already noted, it is not useful for resources to use the UDB component for this purpose.
It is better to use the TCPWM component. A glitch filter is not really necessary, but can be used separately (Page 16).
However, a simple software solution like Bob is recommended may have been more flexible. (On page 20).
Thus, for example, a dynamic can also be easily realized.
It is also possible to use several encoders in multiplex mode. 
The attached document is an excerpt from a manuscript. Maybe it can help.
If necessary, I can provide the sample projects from the manuscript.

   

Reiner

   

​The manuscript is in german language - sorry.

0 Likes
Anonymous
Not applicable

Thank you, excellent document showing many ways to solve one task. I ask you to lay out the samples of the projects, if it is not difficult.

0 Likes
Anonymous
Not applicable

Give me some hours, I'm not in the workplace.

0 Likes
lock attach
Attachments are accessible only for community members.
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

CypressFan,

   

Attached below is a custom QuadDecoder component intended for use with simple mechanical roraty encoders. It was developed entirely in software (no hardware used) for PSoC4/5 projects with limited resources. Component realizes a state machine and can be used in two modes: (i) using pins ISR, (ii) using pins polling technique. In isr mode component currently allows only one encoder per port, with polling there are no restrictions on number of encoders and pin locations (but more CPU clocks are being wasted)

   

Component was tested using P4200 (Pioneer Board) and P5LP (KIT-059). Attached are component library, two demos, some documentation (sorry - no datasheet) and screenshots.

   

   

   

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

@CypressFan

   

​Here are the examples from the document "CY8CKIT-049-4xxx PSoC 4 Rotary Encoder - Excerpt.pdf".
Unfortunately, I can not guarantee that these examples are 100% correct. 
These examples are still with an older one Creator version developed and tested.
The examples also include (actually superfluous) debug material (Analyzer Pins and code).
I hope they are helpful. If there are problems with concrete examples, I can safely help.

   

Part 1:

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

@CypressFan

   

​Part 2:

0 Likes
Anonymous
Not applicable

Thank you very much ! Having so many examples, I must definitely get it.

0 Likes