PRU IEP timers non-responsive

38 views
Skip to first unread message

Fred Frey

unread,
Jun 15, 2020, 11:47:30 AM6/15/20
to BeagleBoard
Hello

I'm trying to write a simple program to test the IEP timers. Ideally I'd like to be able to poll the timer and get an unsigned long value back, but for this test, I followed what I read in this post:


With a few minor changes -- I provide a different GPIO pin, made it loop forever, and made the frequency for the square wave ~2kHz.

I also have a different way of configuring the IEP/INTC. I manually defined the addresses:

#define IEP_HOME                        ((volatile unsigned long*)0x2E000)
#define TMR_GLOBAL_CFG         (*(IEP_HOME+0x00))
#define TMR_GLOBAL_STATUS   (*(IEP_HOME+0x04))
#define TMR_COMPEN                 (*(IEP_HOME+0x08))
#define TMR_COUNT                    (*(IEP_HOME+0x0C))
#define TMR_CMP0                       (*(IEP_HOME+0x48))
#define TMR_CMP_STATUS         (*(IEP_HOME+0x44))
#define TMR_CMP_CFG               (*(IEP_HOME+0x40))

...

#define INTC_HOME           ((volatile unsigned long*)(0x20000))

#define INTC_SECR0          (*(INTC_HOME+0x280))
#define INTC_SECR1          (*(INTC_HOME+0x284))


And I configured them like so:

    TMR_GLOBAL_CFG &= 0xfffffffe; // disable timer

    TMR_COUNT = 0x0; // reset timer

    TMR_CMP_STATUS = 0xff; // clear compare status

    TMR_CMP0 = 100000; // 0.0025 SEC @ 200 MHz

    TMR_COMPEN &= 0xff000000;  // set compensation to 0

    TMR_CMP_CFG &= 0x03; // enable cmp0 and reset on event

    INTC_SECR0 = 0xffffffff;
    INTC_SECR1 = 0xffffffff;

    TMR_GLOBAL_CFG = 0x11; // enable counter


When I read from TMR_COUNT, it's always 0, and the interrupt never fires. What am I missing?

Thanks,
Fred

Fred Frey

unread,
Jun 24, 2020, 10:33:22 AM6/24/20
to BeagleBoard
Ok I figured it out lol. 

I was adding the actual byte-size offsets to pointers to longs, so it was being offset by 4x as much as I would have expected.

The program works fine otherwise.
Reply all
Reply to author
Forward
0 new messages