Since I'm reading the state of the pin within the Broadcom BCM2835, I suspect the wire length would be only a few microns.
For the experiments I've done: what I'm reading is correct after two reads even if it is incorrect after one.
I have checked the signal on an oscilloscope, but I cannot see when the GPIO pin read takes place.
Here is a code snippet:
Code: Select all
1:
str r4, [r0, 28] // set GPIO pin 7
ldr r7, [r0, 52] // read GPIO pins 0 .. 31
ldr r8, [r0, 52] // read GPIO pins 0 .. 31
ldr r9, [r0, 52] // read GPIO pins 0 .. 31
str r4, [r0, 40] // clear GPIO pin 7
ldr r10, [r0, 52] // read GPIO pins 0 .. 31
ldr r11, [r0, 52] // read GPIO pins 0 .. 31
ldr r12, [r0, 52] // read GPIO pins 0 .. 31
stmia r1!, { r7 - r12 } // store the captured states of GPIO pins 0 .. 31
subs r2, 1
bne 1b
At the beginning of this code, the registers are set as follows:
r0 holds the GPIO peripheral address (0x7e200000)
r1 holds the address of a memory buffer to hold GPIO pin samples
r2 holds the count of the number of samples to take
When I review the results, I can see the expected values on the second capture of the GPIO pin state. Unfortunately, the first capture of the GPIO pin state does not always do that. I have estimated the failure rate to be only about 1 in a thousand. This may sound low until it is needed for long sequences (millions).