A trouble that comes up relatively frequently about the TS-7680 is that developers have a hard time using these outputs as an input.


While it is possible to read the current state of the output, this activity can not be done from the usual /sys/class/gpio system.  The most common error is that the developer will do something like this:


#set output, assert signal (sink current)

echo "out" > /sys/class/gpio/gpio207/direction

echo 1 > /sys/class/gpio/gpio207/value

#check to see if output got set

echo "in" <--- STOP.  This is the problem.  


The TS-7680 low-side outputs can NOT be read as an input in the /sys/class/gpio system.  Do not use the /sys/class/gpio/* system to set these outputs as inputs.  


The only way to read the state of the low-side outputs is to parse the syscon register 0xE.


The correct scenario:


Set GPIO as output using /sys/class/gpio/*

Set desired GPIO state using /sys/class/gpio/*.

If you then need to know the state of the low-side output, run tshwctl --addr 0xE --peek to confirm the output is in the expected state (0 = sinking current, 1 =  not sinking current).


If you use the GPIO subsystem to set the TS-7680 low-side outputs as inputs, it will clear the output state, rendering your subsequent read inaccurate and worse possibly turning off the circuit you intended to turn on in the first place.


Useful pertinent documentation:

The TS-7680 manual:

https://docs.embeddedTS.com/TS-7680


The TS-7680 manual, on the Low-Side outputs:

https://docs.embeddedTS.com/TS-7680


The TS-7680 manual on the Syscon (see table, register 0xE):

https://docs.embeddedTS.com/TS-7680#Syscon