This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MCU-PLUS-SDK-AM243X: eQEP interface with LP

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: SYSCONFIG

Hi Team,
Hope you are doing well.

I am using AM243x-LP and programming the eQEP interface for motor speed calculation (position data is not required). 
With reference to the velocity calculation in TRM(page 7825) I have the following lines of code.

  1. Setting GPIO1_28 high                          // select eQEP2 function 
  2. HW_WR_REG32 (0x0322020, 1250);   // EQUEP_QUPRD register; 100kHz switching frequency and 25MHz clock frequency configured in sysconfig.
  3. HW_RD_REG32 (0x30220018)             // EQUEP_QPOSLAT register; To read incremental position value (delta X)

I am able to see the QEPA, QEPB and QEPI signals on the encoder terminals but when I insert it in J21 of LP, I am unable to read the 'x(k+1) - x(k)' value in EQEP_QPOSLAT Register (0x03220018).  
Ideally after sysconfig configuration of eQEP and J21 LP connection, I should be able to see some nonzero value in the 0x03220018 register.

Am I missing some important configuration here? Can you please let me know your thoughts on this?

I am using the Teknic motor (https://www.ti.com/tool/LVSERVOMTR)

Please let me know if you need any further information in this regard and wish you a pleasant day ahead.
Thanks and Regards,
Vaidehi Anil Deoskar

  • Hi Team,
    Hope you are doing well.

    Can you please share an update on my open question?
    Alternatively can you kindly share an example code for AM243x which calculates the motor speed using eQEP module latched at the interrupt generated by the PWM?

    Thanks in advance and wish you a pleasant week ahead.
    Thanks and Regards,
    Vaidehi Anil Deoskar

  • Hi Vaidehi,

    I suggest using SysConfig to configure eQEP module. 

    You can enable eQEP with "EQEP_enableModule(CONFIG_EQEP2_BASE_ADDR)" and then use "EQEP_getPosition(CONFIG_EQEP2_BASE_ADDR)" to get position (both located MCU-PLS-SDK -->> eqep.h).

    if you using eQEP2, the base address is:

    #define CONFIG_EQEP2_BASE_ADDR (CSL_EQEP2_REG_BASE)

    #define CSL_EQEP2_REG_BASE (0x23220000UL)

    Best,

  • Hi Masoud,
    Thank you for your reply.

    Can you please share a sample code for the AM243x-LP which uses the PWM interrupt for speed calculation? The present SDK example uses eQEP interrupt which shows isolated application of this module. But in motor control it would be beneficial to latch this module with the PWM interrupts.

    Thanks and Regards,
    Vaidehi Anil Deoskar

  • The current version MCU PLUS SDK supports speed calculation based on the unit timeout event method which is good for high-speed applications. In this example, the EQEP signal is generated using GPIO pin toggling. You can use this code to develop your own code.

     

    Best Regards,

    Masoud

  • Hi Masoud,
    Thank you for your response.

    The current example which generates the signal using GPIO is certainly a good example but it uses its own interrupt. I already have the motor spinning in the open loop code using the PWM ISR and I would like to use this interrupt to latch the speed data. 
    Can you please help me here?

    We can also discuss over a call if you prefer. Unfortunately I could not find you on webex but please feel free to write me a message.

    Thanks in advance and wish you a pleasant day ahead.
    Thanks and Regards,
    Vaidehi Anil Deoskar

  • Vaidehi,

    You just need to initialize the eQEP as in the driver example. Then you can simply call eQEP functions in any ISR in your case PWM ISR.

    (In a very high-speed application, you may need to use DMA to write the eQEP values in TCM to make sure you're reading eQEP in exact instant of the cycle.)

    Best,

    Masoud