Processing GPIO interrupts at 4MHz.

Good Afternoon,

Currently, I am developing a project where I need to get scanner readings to 4MHz. The program is simple, every time that I get a signal from the clock, I should check the value of a pixel in another signal.

The problem is that I was unable to work with the GPIO interrupts at 4MHz, I tested with Adafruit_BBIO, java, c++ and linux. Even if I try to generate a pulse train, the maximum frequency that I get in the GPIO is about 5KHz. I increased the BBB operation speed at 1GHz and increased the priority of my process to the fullest without getting the expected results.

In this sense, anyone know how can I do to work with the GPIO Interruptions at 4 MHZ?

I remain attentive to your comments

Regards

Good Afternoon,

Currently, I am developing a project where I need to get scanner readings to 4MHz. The program is simple, every time that I get a signal from the clock, I should check the value of a pixel in another signal.

The problem is that I was unable to work with the GPIO interrupts at 4MHz, I tested with Adafruit_BBIO, java, c++ and linux. Even if I try to generate a pulse train, the maximum frequency that I get in the GPIO is about 5KHz. I increased the BBB operation speed at 1GHz and increased the priority of my process to the fullest without getting the expected results.

In this sense, anyone know how can I do to work with the GPIO Interruptions at 4 MHZ?

No way to do this in Linux because of the interrupt latency which in the standard kernel is about 1ms. Even with Xenomai, the interrupt latency is about 50uS. You might be able to do this with the PRU as a front end and then pass on the info to Linux as required.

Regards,
John

This should be possible with assembler code running on PRU-1. You can use about 10 input and output pins in a fast manner. The clock is 200 MHz, so you’ll have 50 cycles for your operations. The PRUSS can also generate an external clock signal for you.

The solution I’m using works at that speed: https://github.com/VegetableAvenger/BBBIOlib

Not a 100% complete solution, but 99% and adapting to your needs in C is easy.