PLU for Quadrature encoding

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PLU for Quadrature encoding

2,039 Views
wim_vandersteeg
Contributor II

Is it possible to use the PLU of the LPC55xx devices as quadrature encoder? I need two quadrature encoders and want to implement these by using the PLU? Is there any example available how to do this?

Labels (2)
0 Kudos
4 Replies

1,897 Views
olikraus
Contributor II

Hi

For those who come along here, I have created a PLU configuration which includes two quadrature decoder blocks for two rotary encoder in one PLU Setup. Setup (XML inside zip) and C file are attached.

The full project is available here:

https://github.com/olikraus/lpc804_plu/tree/master/lpc804/2x_rot_enc_with_nxp_plu_tool 

The implementation is based on the state machine below. The states of the state machine had been compressed to four states so that one decoder only requires two flip flops. The attached PLU schematic includes two of these state machines to decode two rotary encoders in parallel.

Notes:

  • "dir" and "cnt" outputs can be connected to GPIO pins which are not available on the uC package
  • Attach a pin interrupt to "cnt" GPIO to detect rotary encoder movements. Check the "dir" GPIO inside this interrupt for increment or decrement.
  • The source output of the NXP PLU Config Tool does not setup the pin connection and also does not setup the PLU clock.
  • It might be worth to consider "pluc" as an alternative solution to derive the PLU Configuration (https://github.com/olikraus/lpc804_plu/tree/master/lpc804/plu_rot_enc_usart )

Greetings, Oliver

Simple Quadrature Decoder State MachineSimple Quadrature Decoder State Machine

 

 

1,929 Views
wim_vandersteeg
Contributor II

Hi Oliver,

Thanks, I will first have a look in to the rotenc example.

Wim

0 Kudos

1,929 Views
olikraus
Contributor II

Do you want to decode a rotary encoder like described here: rotenc · olikraus/m2tklib Wiki · GitHub 

The V2 state machine on the above page includes 12 states, so without further analysis I think only one decoder will fit into the PLU (because of the  four FF as Sabrina mentioned).

If we would derive the KISS file description from the above state diagrams, then we could use "pluc" (pluc · olikraus/lpc804_plu Wiki · GitHub ) to generate the PLU setup code (at least for the LPC804, but I think the code should be similar for the LPC55xx).

I can derive the KISS file if you are interested.

Oliver

0 Kudos

1,929 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello,

The PLU allows you to create custom waveforms. However, we don't have examples that show an implementation of the quadrature encoder. The examples that we have available can be found in the following document:
Creative ways to leverage the LPC804 MCU’s integrated programmable logic feature

The above document was made for the LPC804, but the PLU feature is essentially the same. 

The tool provided with our MCUXpresso IDE is the PLU tool and the step by step guide of how to use it can be downloaded:

PLU Lab Guide

My primary assumption would be that if your logic design fits within the following parameters of the LPC5S6x, then you should be ok.

  • The PLU is comprised of an array of 26 inter-connectable, 5-input Look-up Table (LUT) elements, and four flip-flops.
  • Eight primary outputs can be selected using a multiplexer from among all of the LUT outputs and the four flip-flops.

Best Regards,

Sabina

0 Kudos