Other Parts Discussed in Thread: CONTROLSUITE
I am using HRCAP_Cal() and int the TRM: TMS320x2806x Microcontrollers Technical Reference Manual (Rev. I) (ti.com)
Page: 414, it is mentioned that in the function: Uint16 HRCAP_Cal(Uint16 HRCAPModule, Uint16 PLLClk, volatile struct EPWM_REGS *ePWMModule)
HRCAPModule is The HRCAP module number as an integer value (that is, “1” for HRCAP1 and “2” for HRCAP2). This HRCAP module will be dedicated to calibration only and cannot be used functionally to capture pulse widths.
But when I am trying the calibrate the HRCAP in the background in my code, I always get the values of Period, On, and OFF as 69905077, 34948553, and 34948553 irrespective of the input.
I observed that using 0-based indexing for unused HRCAP Module meaning “0” for HRCAP1 and “1” for HRCAP2 gives me the correct values, and on comparing my code with the TI example for HR 2806x, I found a difference in the definition of the HRCAP_REGS struct, in TI example it is defined as "volatile struct HRCAP_REGS *HRCAP[NUM_HRCAP] = {0, &HRCap1Regs, &HRCap2Regs,
&HRCap3Regs, &HRCap4Regs};"
and I defined it as "volatile struct HRCAP_REGS *HRCAP[4] = { &HRCap1Regs, &HRCap2Regs, &HRCap3Regs, &HRCap4Regs};"
when I redefined the struct for the HRCAP as "volatile struct HRCAP_REGS *HRCAP[NUM_HRCAP] = {0, &HRCap1Regs, &HRCap2Regs,
&HRCap3Regs, &HRCap4Regs};" then I could also get the correct answers for '1' based indexing.
TRM doesn't give information about using unused HRCAP Module based on struct for HRCAPRegs,it simply says "HRCAPModule is The HRCAP module number as an integer value (that is, “1” for HRCAP1 and “2” for HRCAP2). This HRCAP module will be dedicated to calibration only and cannot be used functionally to capture pulse widths." since HRCAP_Cal() function is not disclosed by TI, I wanted to know if unused HRCAP indexing in HRCAP calibration user dependent.