PRU_ICSS vs PRU_ICSSG wrt GPIO and bi-directional communications

I have gotten P8_7 to bit bang a square wave.

#include <sys_gpio.h>
GPIO0.DIR01_bit.OE_bit15 = 0; // P8_7 bit15
GPIO0.OUT_DATA01_bit.DO_bit15 = 1;
gpio = 0x00090000; // BBAI-64 P8_12, P8_15. P8_16, for b19, b16
puseWidth = 500;
__R30 = gpio;
while(1)
{
__R30 = gpio; // Set HI
GPIO0.OUT_DATA01_bit.DO_bit15 = 1; // P8_7 HI
for(i = 0; i<pulseWidth; i++)
__delay_cycles(PW_CLK_CYCLES);
__R30 = 0;
GPIO0.OUT_DATA01_bit.DO_bit15 = 0; // P8_7 LO
for(i = 0; i<pulseWidth; i++)
__delay_cycles(PW_CLK_CYCLES);
}

I created a overlay “MotorControl.dts” and added P8_7 as follows

// SPDX-License-Identifier: GPL-2.0
/*

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/k3.h>
#include <dt-bindings/board/k3-j721e-bone-pins.h>
#include <dt-bindings/soc/ti,sci_pm_domain.h>
#include <dt-bindings/input/linux-event-codes.h>
&{/chosen} {
overlays {
MotorControl.kernel = TIMESTAMP;
};
};

&cape_header {
pinctrl-names = “default”;
pinctrl-0 = <
&P8_07_gpio_pin /* GPIO_bit15 /
&P8_12_pruout_pin /
Direction bit PRU0 /
&P8_16_pruout_pin /
Scope debug pin /
&P8_33_qep_pin /
QEP2_B - EQEP1_B /
&P8_35_qep_pin /
QEP2_A - EQEP1_A /
&P8_14_pruout_pin /
Scope debug pin PRU1 */
>;
};

sys_gpio.h (29.2 KB)

Have you had any luck with the PRU_ICSSG APWM output mode. The BBAI-64 ball AB29, 0xf8 maps to P8_15. I think I am stuck with getting an overlay to work configuring the pin to work with the APWM.

#include <pru_ecap.h> // Ported from "~/ti/pru-software-support-package/include/arm64x/"
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 = 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