Hi,
but what I could do to be more safe, should I put a 100ohm resistor in serie with the 0.5V line or it is too cautious ( or even wrong).
--> Do nothing. Else it will make it worse..
The leakage current means that I can't have more current In or Out than 1uA in that pin?
Not
out. Leakage current is for
inputs only.
Don't confuse yourself by looking into the wrong table.
Use the input table for inputs
Use the output table for outputs.
so I don't know why I can tolerate more current when it works as an output
An input needs no current ... at least modern CMOS ones. And one does not want current at inputs.
The less current the better. But there is unavoidable current. We have to live with this low currents. ...usualky they are low enough not to cause a problem.
The opposite is with outputs. ...Indeed not the output needs current but the load needs current ... from the output pin.
Examples: A LED, a transistor, an optocoupler ... or anything else you want to drive with your output.
And if you want to drive LOW you want the voltage to be close to 0V, even if there is some current...the same us with HIGH, here you want the output voltage close to VCC.
But on the silicon chip there are limits, thus one decided specifications for currents and voltages.
You can find them in the "output" table. Often there even are V - I - charts, where you can read the output voltage vs output current.
Your schematic:
Input circuit is correct.
"Both pins will be configured as bidirectional I/O".
Wrong.
Configure the input as input.
Configure the output as output.
Output circuit is wrong. Q1 needs to be an NPN with emitter to GND.
Without LED specifications one can only guess.
Maybe drive the transistor base with 1mA..
To calculate the resistor value you need the voltage:
It is: V_R = V_OH - V_BE .... I guess about 3.2V - 0.6V = 2.6V.
R = V / I = about 2600 Ohms. --> try 2.7kOhms
LED current limiting resistor: just guessing .... 47Ohms
Klaus