Does anyone have an example of how to use the PRU_ICSSG0_PR1_ICSS_ECAP0_ECAP_SLV at 0x0b030000 in the APWM mode. The technical manuals say this is available at P8_15, Ball A29, MODE 4. I have added a overlay referred to as “MotorControl.dts” with a section that I used SysConfig as follows.
&main_pmx0 {
mypru_icssg0_ecap1_pins_default: mypru_icssg0_ecap1_pins_default {
pinctrl-single,pins = <
J721E_IOPAD(0xf8, PIN_INPUT, 4) /* (AB29) PRG0_PRU0_GPO18.PRG0_ECAP0_IN_APWM_OUT */
>;
};
};
The code I am using which I have successfully run on a SK-AM64B where I used the “pru-software-support-package/am64x/pru_ecap,h” file.
#define PRU_ECAP_LOC 0x0b030000 // Address from sprul1c,pdf page 136
volatile far ecap *CT_ECAP_PTR = (volatile ecap *)(PRU_ECAP_LOC);
CT_ECAP_PTR->CAP1 = 10000; // 20 Khz
CT_ECAP_PTR->CAP2 = 5000; // Duty Cycle
CT_ECAP_PTR->CNTPHS = 0;
/* Enable APWM mode and enable asynchronous operation; set polarity to active high */
// CT_ECAP_PTR->ECCTL2_ECCTL1 = 0x02C00000;
CT_ECAP_PTR->ECCTL2_ECCTL1 = 0; // Clear ECCTL2 and ECCTL1
CT_ECAP_PTR->ECCTL2_ECCTL1_bit.CAP_APWM = 1; // ECAP operates in APWM mode
CT_ECAP_PTR->ECCTL2_ECCTL1_bit.APWMPOL = 0; // Active high
CT_ECAP_PTR->ECCTL2_ECCTL1_bit.SYNCO_SEL = 3; // Disable sync out
CT_ECAP_PTR->ECCTL2_ECCTL1_bit.TSCNTSTP = 1; // Start counter ECAP PWM Free running
// CT_ECAP_PTR->ECCTL2_ECCTL1|= 0x00100000;