On Wed, 4 May 2016 05:59:34 -0700 (PDT), Le Costaouec Vincent
<
vincent.l...@gmail.com> declaimed the
following:
>Just in case have you got some information about the maximum frequency that
>I can reach to read a PIN value (GPIO PIN and PRU dedicated PIN) ?
>
I think the answer likely depends on what you are doing with the data
you read...
After all (take into account I don't know the PRU instruction set --
this is pseudo-code)
read pin, reg
jump -1
would be reading the pin at 100MHz, but does nothing with it...
read pin, reg
skip nz, reg #hypothetical skip if reg is non-zero
jump -2
... #do stuff
samples the pin at 66MHz so long as the pin is low, but once it reads high
it depends upon how many instructions follow.
If using the main processor and the default "file system" read
operation, expect very low sample rates. File system access is too slow to
read a DHT11 sensor (a stream of "0" bits are a low-high cycle with a total
length of 80uS, or about 13kHz, and you'd need to sample at about 26kHz to
catch just the high/low transition, and really need more samples to be able
to determine the length of the high (both 0 and 1 have ~50uS low, with a
28uS high for 0, and 80uS high for 1). Memory mapped to the pins will be
faster (supposedly it can be used to read the DHT11), but still unlikely to
approach PRU sample rates.
http://hackaday.com/2013/12/07/speeding-up-beaglebone-black-gpio-a-thousand-times/
Memory mapped, toggling a pin, only got up to less than 3MHz from the main
processor.
If you just need to react to a change in pin state -- it may be
possible to hook into an interrupt.