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.

PROCESSOR-SDK-AM64X: Trouble toggling PRU GPO pins

Part Number: PROCESSOR-SDK-AM64X

Does anyone know of a simple CCS program for the the AM64x to toggle the PRU GPO pins?  The only programs I see are for BeagleBone. I have tried to convert a couple of the to the AM64x, but I am having trouble getting the pin-mux set up and I don't get any output. Thanks.

  • Hello Gene,

    The AM335x GPO toggle project is probably the easiest one to start with. I'll be using the PRU Software Support Package for these discussions (in your AM64x Linux Processor SDK under example-applications/pru-icss-x.x.x, or at the git repo https://git.ti.com/cgit/pru-software-support-package/pru-software-support-package/

    1) Start with an AM64x PRU_Halt example (examples/am64x/PRU_Halt)

    2) copy over the AM335x PRU_gpioToggle firmware code (examples/am335x/PRU_gpioToggle)

    Note that AM64x does not have to worry about an OCP port (and the OCP port enable is not technically needed in the AM335x example since the AM335x example is not reading or writing to memory space outside of the AM335x PRU-ICSS). So your PRU firmware might look like this:

    #include <stdint.h>
    
    volatile register uint32_t __R30;
    volatile register uint32_t __R31;
    
    int main(void)
    {
    	volatile uint32_t gpio;
    
    	/* Toggle GPO pins */
    	/* Note: 0xFFFF_FFFF toggles all GPO pins */
    	gpio = 0xFFFFFFFF;
    
    	/* TODO: Create stop condition, else it will toggle indefinitely */
    	while (1) {
    		__R30 ^= gpio;
    		__delay_cycles(100000000);
    	}
    }

    3) BAM. The PRU firmware is done. All PRU GPO signals are toggling as soon as the firmware gets loaded. You still need to update the pinmux settings so that those PRU GPO signals are actually muxed out to the processor pins, but the PRU core itself does not have the permissions to adjust pinmux settings. If you are having trouble updating the AM64x pinmux settings, let us know how you are trying to set them (e.g., Linux device tree, CCS GEL files, etc) and we'll route your thread appropriately.

    Regards,

    Nick