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.

RTOS/PROCESSOR-SDK-AM437X: Partial PR1_PRU0 pins cannot be directly input and output

Part Number: PROCESSOR-SDK-AM437X
Other Parts Discussed in Thread: AM4376

Tool/software: TI-RTOS

My project need to use the PRU pins directly input and output, CPU AM4376, processor_sdk_rtos_am437x_4_03_00_05, CCS7.4.0, pinmux configuration as follow:

static pinmuxPerCfg_t gPru_icss1PinCfg[] =
{
    {
       /* MyPRU_PRUSS12 -> pr1_pru0_gpo[10] -> E11 */
       PIN_GPMC_AD12, (uint16_t)PINMUX_SS_PRU_ICSS_PRU0, \
       ( \
           PIN_MODE(9) | \
           ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
           (~PIN_RX_ACTIVE & ~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
       ) \
    },
    {
       /* MyPRU_PRUSS12 -> pr1_pru0_gpo[11] -> C11 */
       PIN_GPMC_AD13, (uint16_t)PINMUX_SS_PRU_ICSS_PRU0, \
       ( \
           PIN_MODE(9) | \
           ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
           (~PIN_RX_ACTIVE & ~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
       ) \
    },
    {
       /* MyPRU_PRUSS12 -> pr1_pru0_gpi[16] -> B11 */
       PIN_GPMC_AD14, (uint16_t)PINMUX_SS_PRU_ICSS_PRU0, \
       ( \
           PIN_MODE(6) | \
           ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_RX_ACTIVE | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
           (~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
       ) \
    },
    {
       /* MyUART_PRUSS12 -> pr1_uart0_rxd -> K21 */
       PIN_UART1_RXD, (uint16_t)PINMUX_SS_PRU_ICSS_UART0, \
       ( \
           PIN_MODE(5) | \
           ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_RX_ACTIVE | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
           (~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
       ) \
    },
    {
       /* MyUART_PRUSS12 -> pr1_uart0_txd -> L21 */
       PIN_UART1_TXD, (uint16_t)PINMUX_SS_PRU_ICSS_UART0, \
       ( \
           PIN_MODE(5) | \
           ((PIN_PULL_UD_DIS | PIN_PULL_UP_EN | PIN_DS_VALUE_OVERRIDE_EN | PIN_DS_OP_DIS | PIN_DS_PULL_UP_EN) & \
           (~PIN_RX_ACTIVE & ~PIN_DS_OP_VAL_1 & ~PIN_DS_PULL_UD_EN & ~PIN_WAKE_UP_EN))
       ) \
    },
    {PINMUX_INVALID_PIN}
};

and when the program running, I get the register value in ARM as follow:

CONTROL_MODULE_CTRL_CONF_GPMC_AD12 = 0x13030009
CONTROL_MODULE_CTRL_CONF_GPMC_AD13 = 0x13030009
CONTROL_MODULE_CTRL_CONF_GPMC_AD14 = 0x13070006

I get the register value in PRU as follow:

PRU_ICSS1_CFG_PRU_ICSS_CFG_GPCFG0 = 0x00000000
PRU_ICSS1_CFG_PRU_ICSS_CFG_GPCFG1 = 0x02000000

the program in PRU_ICSS1_PRU0(example PRU_gpioToggle, pru-addon-v4.0) as follow:

    volatile uint32_t gpio;
    uint32_t i;

    gpio = 0xFFFF;
    __R30 = gpio;

    i = __R31;

now, pr1_pru0_gpo[10] and pri_pru0_gpo[11] are always 0. and pri_pru0_gpi[16] can work orderly.

when I change pinmux pr1_pru0_gpo[10] and pri_pru0_gpo[11] to pr1_pru0_gpi[10] and pri_pru0_gpi[11], this two pins can not get the input value.

what's wrong with me? may I lost something?

  • Hi Zhuangbin,

    When you change the pinmuxing to GPI mode, make sure to also set the RXACTIVE bit in the CTRL_CONF_GPMC_AD* register.

    In your PRU firmware, are you declaring __R30 and __R31 as follows?

    volatile register uint32_t __R30;

    volatile register uint32_t __R31;

    Regards,

    Melissa

  • Hello, can you share how you test the GPO output? I don't see a problem with your mux mode or GPCFG0 register values. I agree with Melissa, please use "volatile uint32_t" for reading the __R31 register and make sure RXACTIVE bit is set when reading GPIO.
  • Hi,

    I am sure, when testing the GPI, I had set the RXACTIVE. my program is based on the example PRU_gpioToggle from pru-software-support-package. R30 and R31 define as follow:

    volatile register uint32_t __R30;
    volatile register uint32_t __R31;

    and ouput test code as follow:

        /* GPI Mode 0, GPO Mode 0 */
        CT_CFG.GPCFG0 = 0;
        /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
        CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;

        __R30 = 0xFFFFFFFF;
        i = __R31;
        __R30 = 0;
       i = __R31;

    I use the emulator to  step into each instruction line.

    now, I have confirmed that pr1_pru0_gpi[9] read and pr1_pru0_gpo[9] write is ok, pr1_pru0_gpi[16] read is ok.

                                              pr1_pru0_gpo[10] and pr1_pru0_gpo[11] can not write. pr1_pru0_gpi[10] and pr1_pru0_gpi[11] can not read.

    the arm pinmux file as follow, I hope you can confirm it in practice.

    2677.am43xx_evmsk_pinmux_data.c

  • Hi Zhuangbin,

    I don't see any issues with your PRU GPO pinmuxing in the file you attached.

    Are you using a custom board? What is connected to pin E11 (pr1_pru0_gpo[10]) and C11 (pr1_pru0_gpo[11])?

    Regards,
    Melissa
  • Hi,

    Yes,I am using a custom board. E11 and C11 is connected to a high level(3.3V).

    and pr1_pru0_gpo[9](F10) is ok under the same conditions.

  • Hi Zhuangbin,

    Can you put these pins in the standard GPIO mode (i.e. using gpio1_12 and gpio1_13 instead of the PRU GPIOs) and toggle the pin?

    Regards,
    Melissa
  • 6076.am43xx_evmsk_pinmux_data.cHi Melissa,

    the GPIO1[12] and GPIO1[13] is OK.

    in ARM it initialize the pinmux with attached files, and in the pru it executes the codes as follow:

    /* LED port address */
    #define GPIO1_BASE_ADDR 0x4804C000
    #define GPIO_OE_OFFSET         0x134
    #define GPIO_CLRDATAOUT_OFFSET 0x190
    #define GPIO_SETDATAOUT_OFFSET 0x194   

        uint32_t led_set_addr;
        uint32_t led_clr_addr;
        uint32_t led_oe_addr;
        led_set_addr = GPIO1_BASE_ADDR + GPIO_SETDATAOUT_OFFSET;
        led_clr_addr = GPIO1_BASE_ADDR + GPIO_CLRDATAOUT_OFFSET;
        led_oe_addr = GPIO1_BASE_ADDR + GPIO_OE_OFFSET;
        /* GPI Mode 0, GPO Mode 0 */
        CT_CFG.GPCFG0 = 0;
        /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port */
        CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;


        *(uint32_t*)led_clr_addr = 3<<12; //turn off
        *(uint32_t*)led_oe_addr = 0xFFFFCFFF;  // output enable
        *(uint32_t*)led_set_addr = 3<<12; //turn on

  • Hi Zhuangbin,

    That’s good to see that the standard GPIOs work.

    In your original code using the PRU GPI/Os, can you read back R30 after you’ve written to it? Do you see the expected value?

    What voltages do you see on the C11 and E11 pins as you step through your code?

    Also, you mentioned that “E11 and C11 is connected to a high level (3.3V).” Are these pins connected to 3.3V through a pull-up resistor? Do you have a schematic snapshot you could share of the C11 and E11 connections?

    Regards,
    Melissa
  • Hi,

    The manual does not seem to say that __R30 can read back the GPO value, so I did not try to read it. 

    I used 3.3V power supply cathode directly to the input terminal, the other input pins are all right. 

    I'm 80% sure that these two pins are not available as GPIO in PRU. I hope you can confirm it in practice. 

  • Hi zhuangbin,

    You can use the PRU_ICSS_DBG_GPREG30 register within the PRU to read back the R30 or GPO value.  Alternatively, if you're connected to CCS, then you could also use the Register window to view R30.

    I am able to see both pr1_pru0_gpo[10:11] toggle on the AM437x IDK.  The IDK brings C11 and E11 to a header, so this test was done with nothing connected to the pins.

    Below is a description of my test, which was implemented using the CCS debugger:

    1. Powered up the AM437x IDK and connected to the CortxA9

    2. Opened a memory browser to the CTRL_CONF_GPMC_AD[12:13] registers (address 0x44E10830 and 0x44E10834)

    3. Programmed 0x9 into both of these registers to configure the mux mode to pr1_pru0_gpo mode

    4. Connected to PRU-ICSS1 PRU0

    5. Opened the CCS Register window associated with the PRU-ICSS1 PRU0 core, expanded the Core Register section in this window, and scrolled down to R30

    6. Wrote 0x400 into R30, and saw GPO10 = 1, GPO11 = 0 on logic analyzer

    7. Wrote 0x800 into R30, and saw GPO10 =0, GPO11 = 1 on logic analyzer

    Note, the default GPCFG0 register setting is 0x0, so direct output mode is selected for this test. 

    Regards,

    Melissa

  • Hi,

    My IDE can not connect the PRU directly, it must execute an initialization code in ARM before. 

    But I can operate the registers and R30 like your description. but can not get the expected output.

    Are you sure the CPU is same as my AM4376?

  • Zhuangbin,

    Yes, the CPU is the same with respect to basic PRU functionality and pin out.

    A few suggestions to continue debugging:

    1. After writing to R30's bit 10/11, check the R30 register content either in the CCS Register window or PRU_ICSS_DBG_GPREG30 register.  Do you see the expected value stored in this register?
    2. After toggling R30's bit 10/11, check that the device pinmuxing and PRU-ICSS's CFG_GPCFG0 register still read the expected value.
    3. Check the voltage on the GPO10 and GPO11 pins, both after setting and clearing the R30 bits.  What voltages do you see?  
    4. Disconnect everything that's connected to the GPO10 and GPO11 pins on your board.  Can you now toggle the pins with the PRU GPOs?

    Also, how are checking that GPO10 and GPO11 are toggling on your board?

    Regards,

    Melissa

  • Hi,
    1. I can see that R30 register value is what I set it.
    2. the CFG_GPCFG0 register value is always 0x0.
    3. the voltage on the GPO10 and GPO11 pins is always 0 level, whatever value I write to it.
    4. During all the debugging, the two pins did not connect anything.
  • Hi zhuangbin,

    3. the voltage on the GPO10 and GPO11 pins is always 0 level, whatever value I write to it.

    Do you see ANY change in the voltage when you set the pin in software?   Even if it only changes by a small amount (i.e.100 mV), that could help give us an idea of what's happening on the pin.  

    Regards,

    Melissa

  • Hi Melissa,
    I don't see any difference between us.
    I am feeling strange.Whether other settings have an impact?I configurated the 16 bits asynchronous non-multiplexing bus.
  • Zhuangbin,

    The only software settings influencing this signal are the device-level pinmuxing, the PRU-ICSS internal mux setting with the GPCFG register, and the value programmed into R30. It seems you are programming these correctly. Another common hardware influence is external contention on the board.

    1. Do you see this PRU GPI/GPI[10:11] behavior on multiple boards?
    2. You previously said that “E11 and C11 is connected to a high level (3.3V).” However, in a more recent post, you said “During all the debugging, the two pins did not connect anything.” These seem to be in contradiction. Can you send me a schematic snapshot of these of pins? Also, please describe if anything has been changed for debug purposes.
    3. How are you determining that the voltage on GPO10 and GPO11 is always 0? For example, are you using a oscilloscope, logic analyzer, or multi meter?
    4. What do you mean by “I configured the 16 bits asynchronous non-multiplexing bus”? Are you configuring the GPMC in this mode? Is this something new you’re doing, or have you always been using this configuration?

    Regards,
    Melissa
  • 1.I will try another board.
    2.sorry,I mean that I did not connect any components except high level(power supply positive)and low level (power supply negative) .
    3. I used the multimeter, and beforehand I confirmed its quality by measuring the positive and negative power supply .
    4. I am always using this configuration, you can see the pinmux file I sent before.
  • Hi Zhuangbin,

    What about the power supply rails VDDSHV9 and VDDSHV10? Are they supplied from the same source?

    E11 gpmc_ad12 (pr1_pru0_gpo10) is supplied by VDDSHV9 - not working
    C11 gpmc_ad13 (pr1_pru0_gpo11) is supplied by VDDSHV9 - not working
    F10 gpmc_csn2 (pr1_pru0_gpo9) is supplied by VDDSHV10 - working

    You mentioned that pr1_pru0_gpi16 is working properly, but I do not see it configured in the pin mux output.
    B11 gpmc_ad14 (pr1_pru0_gpi16) is supplied by VDDSHV9 - working

    Regards,
    Mark

  • Hi Mark,

    the power supply rails VDDSHV9 should be ok, because that if setting the 16 bits data / 16 bits address non multiplexing bus, it work orderly. 

    I had tested the output function of pr1_pru0_gpi16 by another pinmux file.

  • Hi Zhuangbin,

    It's been a while since I've heard from you. Have you been able to reproduce this issue on another board?

    Regards,
    Melissa
  • Hi Melissa,

    I am sorry, I get another board with the same hard configuration, but it's also no OK.

    and I don't have any available boards to test it anymore.

    I don't think the problem could last too long, so I click the This resolved my issue.

    Thank you very much!