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.

TMS320F28P650DK: HRCAP config

Part Number: TMS320F28P650DK
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hi,

I would like to use HRCAP in my project. I saw the "Example_2803xHRCap_Capture_Pwm" example project, but I don't know how to migrate the following config function to the f28p65x target:

void
HRCAP1_Config(void)
{
    EALLOW;
    HRCap1Regs.HCCTL.bit.SOFTRESET = 1;
    HRCap1Regs.HCCTL.bit.HCCAPCLKSEL = 1;  // HCCAPCLK = PLLCLK = SYSCLK x 2
    
    //
    // Enable Rising Edge Capture Event Interrupt
    //
    HRCap1Regs.HCCTL.bit.RISEINTE = 1;     
    
    //
    // Disable Falling Edge Capture Event Interrupt
    //
    HRCap1Regs.HCCTL.bit.FALLINTE = 0;
    
    //
    // Disable Interrupt on 16-bit Counter Overflow Event
    //
    HRCap1Regs.HCCTL.bit.OVFINTE = 0;
}

I saw in the f28p65x datasheet that the available HRCAP channels are eCAP6 and eCAP7, but I don't see the corresponding bits in HRCap6Regs.

Thanks a lot in advance for your support.

Best regards,

David

  • In the API web page file:///C:/ti/c2000/C2000Ware_MotorControl_SDK_5_01_00_00/c2000ware/device_support/f28p65x/docs/html/modules/hrcap.html I only see calibration registers

  • Hi David,

    Have you taken a look at the following from our C2000WARE SDK?

    C:\ti\c2000\C2000Ware_5_02_00_00\device_support\f28p65x\headers\include\f28p65x_ecap.h and the C:\ti\c2000\C2000Ware_5_02_00_00\device_support\f28p65x\headers\source\f28p65x_globalvariabledefs.c?

    In the global varaible defs you can see that HRCAP6 and HRCAP7 exist.

    Best,

    Ryan Ma

  • Hi Ryan,

    Thank you for your reply.

    Indeed I have already found HRCAP6 and HRCAP7 in the global variable defs file and I had a look on the C:\ti\c2000\C2000Ware_5_02_00_00\device_support\f28p65x\headers\include\f28p65x_ecap.h file too, my issue is that I only found calibration registers in the HRCAP_REGS structure:

    struct HRCAP_REGS {
        union   HRCTL_REG                        HRCTL;                        // High-Res Control Register
        Uint16                                   rsvd1[2];                     // Reserved
        union   HRINTEN_REG                      HRINTEN;                      // High-Res Calibration Interrupt Enable Register
        union   HRFLG_REG                        HRFLG;                        // High-Res Calibration Interrupt Flag Register
        union   HRCLR_REG                        HRCLR;                        // High-Res Calibration Interrupt Clear Register
        union   HRFRC_REG                        HRFRC;                        // High-Res Calibration Interrupt Force Register
        Uint32                                   HRCALPRD;                     // High-Res Calibration Period Register
        Uint32                                   HRSYSCLKCTR;                  // High-Res Calibration SYSCLK Counter Register
        Uint32                                   HRSYSCLKCAP;                  // High-Res Calibration SYSCLK Capture Register
        Uint32                                   HRCLKCTR;                     // High-Res Calibration HRCLK Counter Register
        Uint32                                   HRCLKCAP;                     // High-Res Calibration HRCLK Capture Register
    };

    struct HRCTL_BITS {                     // bits description
        Uint16 HRE:1;                       // 0 High Resolution Enable
        Uint16 HRCLKE:1;                    // 1 High Resolution Clock Enable
        Uint16 PRDSEL:1;                    // 2 Calibration Period Match
        Uint16 CALIBSTART:1;                // 3 Calibration start
        Uint16 CALIBSTS:1;                  // 4 Calibration status
        Uint16 CALIBCONT:1;                 // 5 Continuous mode Calibration Select
        Uint16 rsvd1:10;                    // 15:6 Reserved
        Uint16 rsvd2:16;                    // 31:16 Reserved
    };

    union HRCTL_REG {
        Uint32  all;
        struct  HRCTL_BITS  bit;
    };

    I need to found where are the f28p65x equivalence of the f2803x following bits:

     - SOFTRESET

     - HCCAPCLKSEL

     - RISEINTE

     - FALLINTE

     - OVFINTE

     - RISEOVF

    I didn't find any f28p65x example of HRCap nor eCap capture in the C2000Ware. Do you have an example to recommend ?

    Best regards

  • Hi David,

    I will need to look into this and provide an appropriate response by tomorrow. Apologize for the delay.

    Best,

    Ryan Ma

  • Hi Ryan,

    I found yesterday the ecap_ex2_capture_pwm example project in C:\ti\c2000\C2000Ware_MotorControl_SDK_5_02_00_00\c2000ware\driverlib\f28p65x\examples\c28x\ecap

    I restared from it, adapted it to my project and now it works well.