I am trying to detect the external pulses on the Gumstix Connex via a PIC and use the pulses to control the sampling rate of an ADC (which samples and stores the data on the Gumstix CF card).
However, I’m having problems trying to receive the pulses accurately. I’ve tried using the following example programs to detect the pulses, however it didn’t work for me. I’ve verified the PIC pulses on a scope and it’s working fine.
1. Using the program (http://docwiki.gumstix.org/index.php/Sample_code/C/gpregs) , I tried to update the “gpio-status” of the GPIO line on the gumstix and when it is set, it will trigger the ADC. However, the number of detected pulses counts was more than what the PIC produced. I would suspect that the program reads in all the “logic ones” during the loop and increment the pulse counts. Modifying the code to detect only the “rising edge” (i.e. compare between gpio-status-pre and gpio-status-post) did not help either. Is there a smarter way to work around this?
2. Using the gpio-event program (http://docwiki.gumstix.org/index.php/GPIO_event) I couldn’t get it to work at all, although I have no problem making the executable and installing the kernel module on the gumstix. When I typed “gpio-event 58:r:20”, apparently no edge was detected as there was no output on the screen. I was wondering if I am doing something wrong.
I will greatly appreciate if anyone can advise me on how I can modify any of the existing codes to detect the number of pulses accurately (i.e. every edge of signal pulse from the PIC)? My understanding is that the Gumstix will set the GPIO signal when the incoming voltage level is above 3.3V. Am I right?
Thanks for any help in advance.