Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Hi,
I need to drive P8_8 ~ gpio2_3 of the BeagleBone Black using a PRU. I am following the setup from the first example "3.5.2.1.2. LAB 1: Toggle LED with PRU GPO" in the 08_02_00_24 version of the SDK. I have added the following CONTROL_MODULE register changes to configure the pinmux to Mode 7 in PRU_PINMUX_Config() of GEL script. I have scoped and proved that the pull up changes are effective when running the GEL script on the Cortex-A8.
// CONTROL_MODULE register address is 0x44E1000, pin offset for P8_8 is 0x894 *((unsigned int*) 0x44E10894) = AM335X_PIN_OUTPUT | 7; *((unsigned int*) 0x44E10894) = AM335X_PIN_OUTPUT_PULLUP | AM335X_PULL_UP;
Below is the code loaded onto PRU0 which is not able to toggle P8_8 if using Code Composer Studio to debug. I have also tried using the full beagleboneblack.gel to initialize everything by starting AM335x_BeagleBlack_Initialization() and then starting PRU_ICSS_Init() again to apply the new pinmux settings on top and halt the PRUs so I can disconnect from the Cortex-A8 and connect to PRU0 and load the compiled code below.
Could someone please help with understanding what is missing to allow the PRU to control this GPIO via the OCP if I want to debug with the IDE like in the SDK example above?
Thank you in advance!
#include <stdint.h> #include <pru_cfg.h> #define GPIO2 0x481AC000 #define GPIO_CLEARDATAOUT 0x190/4 // Write 1 here to set a given bit #define GPIO_SETDATAOUT 0x194/4 // A 1 here clears the corresponding bit void main(void) { // Clear SYSCFG[STANDBY_INIT] to enable OCP master port CT_CFG.SYSCFG_bit.STANDBY_INIT = 0; /* No effect * // unlock the BOOT_CFG space kick mechanism * *(volatile unsigned int *)(0x02620038) = 0x83E70B13; // BOOTCFG_KICK0 * *(volatile unsigned int *)(0x0262003C) = 0x95A4F1E0; // BOOTCFG_KICK1 */ uint32_t *gpio2 = (uint32_t *)GPIO2; while(1) { gpio2[GPIO_CLEARDATAOUT] = (0x1<<3); __delay_cycles(10000); gpio2[GPIO_SETDATAOUT] = (0x1<<3); __delay_cycles(10000); } // Halt the PRU core __halt(); }