External Triggered Measurements using the GPIO port

Hello! Have anyone tried this? I’m trying to do some triggered measurements (like an oscilloscope) with the LimeSDR.
Using the gpio examples in C++ in LimeSuite and wrote an extremely simple code:

Using GPIO0 in input mode:
// Device setting etc..

while(!(gpio_val&1)) { if (LMS_GPIORead(device, &gpio_val, 1)!=0) error(); } std::cout << "Triggered!" << std::endl;}

// Read samples and DSP....

The trigger signal is a square pulse of amplitude 3.3V and has a duration of 10 uS.
The system works…sometimes. I can make some triggered measurements but two or more trigger pulses with a time span < 1s must be sended to the LimeSDR. And I don’t know if this can be improved.

I know the code is very simple and maybe there’s a better aproach to resolve this. But the fact that many pulses must be sended to the GPIO0 port makes me think that there is a hardware issue. Maybe an impedance mismatch between the trigger source and the GPIO impedance? Pulse Duration? Parameters in the FPGA to be controlled?

Thanks in advance.

Anyone? =(
@Zack, @IgnasJ, @andrewback, @ricardas

LMS_GPIORead() reads the current state of the GPIO pins. It takes time to send command to board and get a response and if pulse occurs between reads it won’t be detected.

Thanks @IgnasJ for the answer!