servalproject / openwrt

OpenWRT distribution for Serval Mesh Extenders
https://developer.servalproject.org
GNU General Public License v2.0
8 stars 3 forks source link

Opto-isolated inputs on GPIO26/27 don't work #18

Open gardners opened 7 years ago

gardners commented 7 years ago

The circuit has been verified all the way through from the DSUB-15 to the Domino Core module's GPIO/LED pins.

The problem seems to be that the Atheros 9331's GPIO pins are not set to the correct mode.

If the pins are set to direction = in, and value=0 or value=1, then they always read 0, and the opto isolated inputs cause voltage swings between 0 and ~1.2V

If the pins are set to direction=out, and value=1, then the voltage is set to 2.5V, and drops to ~2.1V if an optoisolated input is activated.

The behaviour with direction=out makes sense, since the internal driver in the Ath9k is driving more strongly than the output from the opto isolator unit.

For direction=in, it seems that there is some pull-down resistor active, since we can never pull the voltage above 1.2V, even though the optoisolater pushes 3.3v (verified by disconnecting the opto output from the path to the Ath9k and measuring the voltage).

Thus it seems we might need to provide some pull-up resister to the output of the optoisolater, so that it can drive the voltage above ~1.5V, so that it is read as high instead of low when asserted.

gardners commented 7 years ago

R4 and R5 are the pull-ups provided. They are 49K, which is too large a resistance. Also, they pull up to 3.3V instead of to 2.5V? (or is 3.3V needed for if they are connected to the RFD900 radio, instead of Ath9k module, as allowed for by jumpers?)

gardners commented 7 years ago

Installing a 7.5K pull-up to 2.5v (while leaving the 49K pull-up to 3.3v in place) allows the voltage to get to just over 1.5V, which is enough to read as a 1, thus allowing opto-isolated input to work.

Removing the old 3.3v 49K pull-up, it gets to only ~1.49V, which is not enough. So 7.7K pull-up to 2.5v alone is not enough. Making the 7.7K pull-up to 3.3V instead of 2.5V, however, gets 1.59V, which is enough.

So, a solution then is to replace the 49K pull-ups with 7.7K (or close) pull-ups? Will talk to RFDesign about this.