I'm coming from this problem where I had the issue that one GPIO write would influence the level of another pin. (GPIO19 would influence GPIO13).
When changing the set/clear operation from |=
to =
the behaviour is suddenly correct:
// clear GPIO19
*(GPCLEAR0) |= (1u << 19); // does not work
*(GPCLEAR0) = (1u << 19); // works
I'm aware that there are registers that should only be written to (like clearing interrupt flag).
However, the datasheet of BCM2835 does not mention to not read GPCLEAR0
.
In fact, the datasheet claims that this register is read+write.
So why is it working with =
and not with the more "logical" |=
?