Hardware Interrupt Trigger to PRU

I am currently working on a project, where I have to count pulses on a GPIO pin. Since the pulses are very fast (60pulses per milisecond) and I don’t want to miss a pulse I want to use an external triggerd interrupt (rising) to increase a variable of the PRU. So far so good, but how exactly do I accomplish this?
I am vey familiar with AVR Atmel µCs, but the AM335x is way more complicated than that!

So far I managed to use TI’s C-Compiler to set up and programm one of the PRUs and mapping the Pins via Device Tree overlay.
Reading from and writing to a pin is no problem …

I tried to understand the AM335x TRM and the PRU reference guide so I know that I have to proceed like this

  • map pin to PRU (eg P9_28 to PRU0 ← 0x19c 0x26, P9_28 should be GPIO 113)

  • enable the Interrupts first in the GPIO_IRQSTATUS_SET_1 register by writing 0x1 to it

  • then select the trigger, for example GPIO_RISING_DETECT by writing 0x1 to it

What I do not understand is:

  • how to I tell my beaglebone that GPIO 113 (P9_28) is supposed to be the trigger source?
  • how do I configure my PRU to wait for that interrupt
  • how do I implement the interrupt service routine in the PRU code?

Thank you guys so much for your help!!!

Hi Frank!

Are you sure that triggering a PRUSS by an GPIO interrupt is the best way to count pulses? Have a look at this post.



thanks for your answer!
I saw that post already while searching for my problem. Unfortunately I can’t use the eQEP functionality because for all the available eQEPs at least one pin is already occupied. These pins are fixed and are not changeable.

But you’re right, eQEP would definitely be very neat!