No QEI drivers in lpcopen_208_c

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

No QEI drivers in lpcopen_208_c

1,006 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Harrzack on Wed Aug 13 14:02:06 MST 2014
I've been pouring over the Users Manual (UM 10736) for the 1549 and starting to get the connections from the register descriptions there and the lpcopen library. 

I have not been able to find any reference or entries for the Quadrature Encoder Interface (QEI) as detailed in chapter 22 of the UM in the lpcopen library.  Has this been left out as it is (possibly) more 'motor' oriented, and is to be added as needed?

If so - where can it be found?    :quest:

=Alan R.
Labels (1)
6 Replies

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Harrzack on Fri Dec 19 06:54:04 MST 2014
Well - yeah!  I guess one could write software for pretty much anything.  Point is - NXP touts the QEI capabilites, has software for pretty much all other features so was wondering why this particular one was ignored.  From what you've presented, I'd much prefer to have a factory produced TESTED libary so I can get on with learning this fairly complex board/chip    ;-)

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Fri Dec 19 04:43:21 MST 2014

Quote: YOZHik
...but haven't tested...
typedef struct {
__O  uint32_t  CON;
__I  uint32_t  STAT;
__IO uint32_t  CONF;
__I  uint32_t  POS;
__IO uint32_t  MAXPOS;
__IO uint32_t  CMPOS0;
__IO uint32_t  CMPOS1;
__IO uint32_t  CMPOS2;
__I  uint32_t  INXCNT;
__IO uint32_t  INXCMP0;
        __IO uint32_t  LOAD;
        __I  uint32_t  TIME;
        __I  uint32_t  VEL;
        __I  uint32_t  CAP;
        __IO uint32_t  VELCOMP;
        __IO uint32_t  FILTERPHA;
        __IO uint32_t  FILTERPHB;
        __IO uint32_t  FILTERINX;
        __IO uint32_t  WINDOW;
        __IO uint32_t  INXCMP1;
        __IO uint32_t  INXCMP2;
        __O  uint32_t  IEC;
        __O  uint32_t  IES;
        __I  uint32_t  INTSTAT;
        __I  uint32_t  IE;
        __O  uint32_t  CLR;
        __O  uint32_t  SET;
} LPC_QEI_T;

#define LPC_QEI ((LPC_QEI_T*) LPC_QEI_BASE)




Working version (with gap...) 

/**
 * @brief Quadrature Encoder Interface register block structure
 */
typedef struct {/*!< QEI Structure          */
__O  uint32_t  CON;/*!< Control register       */
__I  uint32_t  STAT;/*!< Encoder status register */
__IO uint32_t  CONF;/*!< Configuration register */
__I  uint32_t  POS;/*!< Position register      */
__IO uint32_t  MAXPOS;/*!< Maximum position register */
__IO uint32_t  CMPOS0;/*!< position compare register 0 */
__IO uint32_t  CMPOS1;/*!< position compare register 1 */
__IO uint32_t  CMPOS2;/*!< position compare register 2 */
__I  uint32_t  INXCNT;/*!< Index count register   */
__IO uint32_t  INXCMP0;/*!< Index compare register 0 */
__IO uint32_t  LOAD;/*!< Velocity timer reload register */
__I  uint32_t  TIME;/*!< Velocity timer register */
__I  uint32_t  VEL;/*!< Velocity counter register */
__I  uint32_t  CAP;/*!< Velocity capture register */
__IO uint32_t  VELCOMP;/*!< Velocity compare register */
__IO uint32_t  FILTERPHA;/*!< Digital filter register on input phase A (QEI_A) */
__IO uint32_t  FILTERPHB;/*!< Digital filter register on input phase B (QEI_B) */
__IO uint32_t  FILTERINX;/*!< Digital filter register on input index (QEI_IDX) */
__IO uint32_t  WINDOW;/*!< Index acceptance window register */
__IO uint32_t  INXCMP1;/*!< Index compare register 1 */
__IO uint32_t  INXCMP2;/*!< Index compare register 2 */
[color=#f00]__I  uint32_t  RESERVED0[0x3E1];//933 int gap;[/color]
__O  uint32_t  IEC;/*!< Interrupt enable clear register */
__O  uint32_t  IES;/*!< Interrupt enable set register */
__I  uint32_t  INTSTAT;/*!< Interrupt status register */
__I  uint32_t  IE;/*!< Interrupt enable register */
__O  uint32_t  CLR;/*!< Interrupt status clear register */
__O  uint32_t  SET;/*!< Interrupt status set register */
} LPC_QEI_T;

#define LPC_QEI ((LPC_QEI_T*) LPC_QEI_BASE)

0 Kudos

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by YOZHik on Mon Aug 18 11:53:08 MST 2014
QEI is pretty simple. Just define a structure by yourself and write functions you need. Started to do for myself but haven't tested yet due to changed priorities. Here is something to start with.
typedef struct {
__O  uint32_t  CON;
__I  uint32_t  STAT;
__IO uint32_t  CONF;
__I  uint32_t  POS;
__IO uint32_t  MAXPOS;
__IO uint32_t  CMPOS0;
__IO uint32_t  CMPOS1;
__IO uint32_t  CMPOS2;
__I  uint32_t  INXCNT;
__IO uint32_t  INXCMP0;
        __IO uint32_t  LOAD;
        __I  uint32_t  TIME;
        __I  uint32_t  VEL;
        __I  uint32_t  CAP;
        __IO uint32_t  VELCOMP;
        __IO uint32_t  FILTERPHA;
        __IO uint32_t  FILTERPHB;
        __IO uint32_t  FILTERINX;
        __IO uint32_t  WINDOW;
        __IO uint32_t  INXCMP1;
        __IO uint32_t  INXCMP2;
        __O  uint32_t  IEC;
        __O  uint32_t  IES;
        __I  uint32_t  INTSTAT;
        __I  uint32_t  IE;
        __O  uint32_t  CLR;
        __O  uint32_t  SET;
} LPC_QEI_T;

#define LPC_QEI ((LPC_QEI_T*) LPC_QEI_BASE)

// Define your most needed functions here
// ...
0 Kudos

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Harrzack on Thu Aug 14 17:47:49 MST 2014
I have found the QEI entry in LPCOpen lib v3 for the NXP 1768....   Wonder why it was left out of v2.08 for the 15xx series.  Perhaps the 15xx stuff is so new, "the paint is still wet"
0 Kudos

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Harrzack on Wed Aug 13 18:14:00 MST 2014
labrat - thanks for that link, but things are still looking pretty obscure. Nothing in that area seems to mention a library addition or include file for QEI

I was hoping to find a simple addition to the lpcopen_2_08 library... 

Still wondering why it just isn't in the standard 2.08 lib since they advertise the chip/board as having Quadrature control.  What is the point of leaving it out?    :~
0 Kudos

891 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Aug 13 17:33:57 MST 2014

Quote: Harrzack
If so - where can it be found?    :quest:



Somewhere in:

http://www.lpcware.com/motor_control
0 Kudos