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.

Using Timer4 capture input on BeagleBone

Other Parts Discussed in Thread: AM3359

I have made a data acquisition cape for my BeagleBone that digitizes analog signals and receives 10 MHz and 1PPS timing inputs. The 1PPS input is wired to the TIMER4 pin and is intended to be captured by timer4 on the rising edge. I have enabled this pin to mode 2, Rx enabled, and enabled capture on rising edge. However, the pin is being driven as an output by the processor, so my input signal is not getting into the timer.  

Section 20.2.1.4 of the AM3359 TRM has a semi-useful description of PORGPOCFG bit, but fails to say whether it should be 0 or 1 for capture input mode. It also implies that it's an output bit.

A schematic diagram of the timer I/O pin wiring with mode control bit values called out would be very helpful at this time. Short of that, what bits must be set to what values to get the TIMER4 pin's capture input to work?

  • Still waiting for a response!

    I took some time to play with both settings of the PORGPOCFG bit. The pin still acts as an output. I verified that when in GPIO mode 7, the pin can be set to an input and receives my PPS signal correctly.

    I would really like to be able to use this feature of the CPU, but without any support from TI, I'll have to change my plans.

  • David

    For the PORGPOCFG bit, 0=enable driver, 1= disable driver.

    The pinmux should be setup with the mux mode to select the TIMER4 mode (mode 2 on beaglebone) and the input enabled. I also enabled the pullup on my example.

     I attached a quick StarterWare based demo to show this working. All you need to do is ground the timer4 input and the capture register contents will be shown on the serial port..

      Paul

     

  • Paul,

    Thank you for the helpful answer. I was able to run your code and verify that the TIMER4 pin is an input.

    However, I still don't have success using this pin as an input when I configure timer4's clock source to use TCLKIN.

    What I see is that using the following code, the TIMER4 pin is driven low by the processor.

    The particular line of code that causes this to happen is the setting of CM_DPLL_CLKSEL_TIMER4_CLK) to CM_DPLL_CLKSEL_TIMER4_CLK_CLKSEL_SEL1.

    When I set it instead to CM_DPLL_CLKSEL_TIMER4_CLK_CLKSEL_CLK_M_OSC (the default), then the TIMER4 pin behaves as an input.

    I do not understand why the reconfiguration of the timer's clock source causes the I/O pin to change its configuration.

    I am driving a 10 MHz clock into the TCLKIN pin for the purpose of having an accurate timestamp clock, as my application requires accurate timing to steer a telescope.

    Is a 10 MHz clock fast enough for the resyncing circuits to work properly?


    /* Do this to initialize the timers. */
    void myDMTimerInit(void)
    {
        /* set the xdma_event_intr1 TCLKIN pin to mode 2 */
        HWREG(SOC_CONTROL_REGS + CONTROL_CONF_XDMA_EVENT_INTR(1)) =
            (CONTROL_CONF_RXACTIVE |
            (CONTROL_CONF_MUXMODE(2))    /* mode 2 is TCLKIN*/
            );

        /* set both timer 2 and timer 4 to use TClkIn */
        selectTimerClk(CM_DPLL_CLKSEL_TIMER2_CLK, CM_DPLL_CLKSEL_TIMER2_CLK_CLKSEL_SEL1);

        /* ***** The timer4 select below causes the TIMER4 pin to be always output !!! */
        HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER4_CLK) &= ~(CM_DPLL_CLKSEL_TIMER4_CLK_CLKSEL);
        HWREG(SOC_CM_DPLL_REGS + CM_DPLL_CLKSEL_TIMER4_CLK) |= CM_DPLL_CLKSEL_TIMER4_CLK_CLKSEL_SEL1;

        /* Load the counter with the initial count value */
        DMTimerCounterSet(SOC_DMTIMER_4_REGS, TIMER4_INITIAL_COUNT);

        /* Load the load register with the reload count value */
        DMTimerReloadSet(SOC_DMTIMER_4_REGS, TIMER4_RLD_COUNT);


        /* Reset the TCLR */
        HWREG(SOC_DMTIMER_4_REGS + DMTIMER_TCLR) = 0x0;
        HWREG(SOC_DMTIMER_4_REGS + DMTIMER_TCLR) = (DMTIMER_TCLR_CAPT_MODE_SINGLE << DMTIMER_TCLR_CAPT_MODE_SHIFT)
                                                 + (DMTIMER_TCLR_AR_AUTO << DMTIMER_TCLR_AR_SHIFT)
                                                 + (DMTIMER_TCLR_TCM_HIGHLOW << DMTIMER_TCLR_TCM_SHIFT);
        // Currently no support in StarterWare for Capture mode so need to "hardcode"

        DMTimerModeConfigure(SOC_DMTIMER_4_REGS, DMTIMER_AUTORLD_NOCMP_ENABLE);

        /* set the TIMER4 pin to use 1PPS input */
        /* Disable the output */
        DMTimerGPOConfigure(SOC_DMTIMER_4_REGS, DMTIMER_GPO_CFG_1); // 0 = output enabled, 1 = output disabled

        /* Setup up pinmux for Timer 4 as input capture. Input enabled, pull-up enabled, muxmode 2*/
        HWREG(SOC_CONTROL_REGS + CONTROL_CONF_GPMC_ADVN_ALE) =
                  (2 << CONTROL_CONF_GPMC_ADVN_ALE_CONF_GPMC_ADVN_ALE_MMODE_SHIFT)    |
                  (0 << CONTROL_CONF_GPMC_ADVN_ALE_CONF_GPMC_ADVN_ALE_PUDEN_SHIFT)    |
                  (1 << CONTROL_CONF_GPMC_ADVN_ALE_CONF_GPMC_ADVN_ALE_PUTYPESEL_SHIFT)|
                  (1 << CONTROL_CONF_GPMC_ADVN_ALE_CONF_GPMC_ADVN_ALE_RXACTIVE_SHIFT) |
                  (0 << CONTROL_CONF_GPMC_ADVN_ALE_CONF_GPMC_ADVN_ALE_SLEWCTRL_SHIFT);
    }

  • David

    Changing the input source should not change the I/O state of the timer pin.

    I've modified the previous program to use TCLK as the clock source for timer4.

    TCLK is driven by the output of timer7 by connecting P8.8 with P9.41.

    Timer7 generates a 3KHz clock.

    As in the prvious example, shorting P8.7 to GND will generate a capture event on timer4 and print the current counter value to the serial terminal.

      Paul

     

  • David

    Did thsi help resolve the issue?

    Paul

  • Paul,

    Hi. I was away from this problem for a few weeks as other tasks came up.

    I have taken the code you provided and inserted it into my application. The TIMER4 input now behaves as an input.

    I have no idea what I was doing wrong, but that's the nature of this beast, I suppose.

    Thanks for the help!

  • Hello Sir,

    Is it possible to show me how to configure HW_EVT_CAPT with an input event (timer pin) for triggering

    the ADC? And how to configure the Pinmux  mode for timer function, because the kernel does not have these

    mux functions on beaglebone pad (P8.7 , P8.8, P8.9, P8.10) after checking.

    Thanks in advance for the help!

    Geoff