What are the QEI registers on the LPC1769?

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

What are the QEI registers on the LPC1769?

Jump to solution
1,416 Views
asiertapiazulai
Contributor III

Hi there:

I am using LPC17xx/40xx Quadrature Encoder Interface driver from LPCOpen library v2.10 for LPC1769 board to write functions for a rotary switch.

However, there are divergences between the documentation and the library: more registers are defined in the library than are specified in the documentation.

Specifically, in the LPC_QEI_T structure of the library, the FILTERPHB, FILTERINX, FILTERINX, INXCMP1 and INXCMP2 registers are defined that are not mentioned in LPC176x/5x User Manual (UM10360, Rev. 4.1 - 19 December 2016). What should I stick to?

To specify the question (so that it does not seem like a philosophical question):
In section 26.4.1.2 of the user guide (Digital input filtering, page 557) you can read: << All three encoder inputs (PhA, PhB, and index) require digital filtering. The number of sample clocks is user programmable from 1 to 4,294,967,295 (0xFFFF FFFF). In order for a transition to be accepted, the input signal must remain in new state for the programmed number of sample clocks. >>

In the user guide only one digital filter register is specified, the one corresponding to the address 0x400BC03C (which in the library would correspond to the FILTERPHA register). Reading the guide it is deduced that the value written in that register applies to the three digital inputs.

However, a filter is defined for each entry in the library. It could be due to compatibility reasons with other mics of the family, but, if so, it surprises me that they are not protected with #ifdef statements.

The specific question would be:

If I write a value in the address 0x400BC03C, does this digital filter apply to all the encoder inputs (as specified in the user guide)?

Or on the contrary

Should I specify a filter value for each input (how could it be deduced from the three records defined in the library)?

I remember I am referring to LPC1769.

Thank you very much.

Asier.

0 Kudos
Reply
1 Solution
1,404 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Asier,

Regarding your question, I think the QEI driver is a generic driver, which adapts to all the QEI module for different LPC family.

But the QEI module itself is a slightly different, for the LPC1769, there is only one QEI Digital Filter register (FILTER - address 0x400B C03C), which applies for the PHA/PHB/INdex signals.

But for the LPC408x/LPC407x, there are three digital filter register as the following fig, which is described in UM10562.pdf, which can be downloaded from the link:

https://www.nxp.com.cn/docs/en/user-guide/UM10562.pdf

 

So if you use the QEI driver, you have to modify it to adapts to the LPC1769.

 

 

xiangjun_rong_0-1612494586026.png

 

xiangjun_rong_1-1612494635604.png

Hope it can help you

BR

Xiangjun rong

 

View solution in original post

0 Kudos
Reply
2 Replies
1,405 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Asier,

Regarding your question, I think the QEI driver is a generic driver, which adapts to all the QEI module for different LPC family.

But the QEI module itself is a slightly different, for the LPC1769, there is only one QEI Digital Filter register (FILTER - address 0x400B C03C), which applies for the PHA/PHB/INdex signals.

But for the LPC408x/LPC407x, there are three digital filter register as the following fig, which is described in UM10562.pdf, which can be downloaded from the link:

https://www.nxp.com.cn/docs/en/user-guide/UM10562.pdf

 

So if you use the QEI driver, you have to modify it to adapts to the LPC1769.

 

 

xiangjun_rong_0-1612494586026.png

 

xiangjun_rong_1-1612494635604.png

Hope it can help you

BR

Xiangjun rong

 

0 Kudos
Reply
1,393 Views
asiertapiazulai
Contributor III

It does help me, @xiangjun_rong . Indeed, that was my question. The most logical thing was to think that it was a general library, but I was surprised that it was not adapted to the differences in the family. I mean, the structure of the RIT timer is as follows, for example:

/**
 * @brief Repetitive Interrupt Timer register block structure
 */
typedef struct {				/*!< RITIMER Structure      */
	__IO uint32_t  COMPVAL;		/*!< Compare register       */
	__IO uint32_t  MASK;		/*!< Mask register. This register holds the 32-bit mask value. A 1 written to any bit will force a compare on the corresponding bit of the counter and compare register. */
	__IO uint32_t  CTRL;		/*!< Control register.      */
	__IO uint32_t  COUNTER;		/*!< 32-bit counter         */
#if defined(CHIP_LPC1347)
	__IO uint32_t  COMPVAL_H;	/*!< Compare upper register */
	__IO uint32_t  MASK_H;		/*!< Mask upper register    */
	__I  uint32_t  RESERVED0[1];
	__IO uint32_t  COUNTER_H;	/*!< Counter upper register */
#endif
} LPC_RITIMER_T;

My experience with the libraries that I have used so far has been that, that the differences between micros or families are "protected" with commands for the preprocessor. That was what confused me in this case, the absence of conditionals in the definition of the structure.

Once this is verified, absolutely nothing needs to be modified. The addresses of all registers are correct. Just ignore the registers that the LPC1769 lacks: FILTERPHB, FILTERINX, FILTERINX, INXCMP1 and INXCMP2.

The only "problem" would be that the general filter for all three inputs is called FILTERPHA. "Problem", if it is, easily solved, changing the name in the structure or with a new #define.

Once it is clear that it is the same filter for the three inputs, the name it has is not a problem for me. So problem solved.

Thank you very much for dedicating your time and for the prompt response.

Asier.

0 Kudos
Reply