Hello All,
I'm trying to run PRU_gpioToggle example from PRU package for AM437x. Please advise what I miss - see the code below:
#include <stdint.h>
#include <pru_cfg.h>
#include "resource_table_empty.h"
volatile register uint32_t __R30;
volatile register uint32_t __R31;
void main(){
volatile uint32_t gpio;
/* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
CT_CFG.GPCFG0_bit.PRU0_GPO_MODE = 0;
CT_CFG.GPCFG0 = 0x0;
/* Toggle GPO pins TODO: Figure out which to use */
gpio = 0x000F;
/* TODO: Create stop condition, else it will toggle indefinitely */
while(1){
__R30 ^= gpio;
__delay_cycles(100000000);
}
/* Halt the PRU core */
__halt();
}
I want to have one of leds (U1 or U2) blinking, but with the code it doesn't work. Probably I miss something in configuration.
As far as I understand, those LEDS are connected to following lines for PRU0 of ICSS1:
AM437X_LCD_PCLK U1 - RED - corresponds to pr0_pru1_gpo8
AM437X_LCD_AC_BIAS_EN U1 - Green - corresponds to pr0_pru1_gpo9
AM437X_LCD_VSYNC U1 - Yellow - corresponds to pr0_pru1_gpo6
AM437X_LCD_HSYNC U2 - Red - corresponds to pr0_pru1_gpo7
AM437X_CAM1_WEN U2 – Green - not connected with PRU GPIO
AM437X_CAM1_DATA2 U2 - Yellow - corresponds to pr0_pru1_gpo10
So I configure GPIOs for Direct control (via PRU0_GPO_MODE) and then write to R30.
During debug I see that the content of R30 is changing (inverted in a cycle), but evidently I miss some HW config.
Please help me to figure out.
Best regards,
Ilya