I have got an optocoupler to switch an output between 0V and 3.3V. That output is also inverted with a NOT gate, but for simplicity, we could focus on just Out_Enable1 signal. As far as I understand, I must read a logic 1 (3.3V aprox) when I set GND in Signal1 input. But I don't get that. I am reading more than 2 volts between pins 4 and 3 in U5 (always), and in R107 I cannot measure a logic 1 or something near 3.3V when I connect Signal1 to the GND for 28VDC power line. I don't know why the optocoupler is not switching its output, or, at least, that's the problem I see.
EDIT: I have tried changing R106 from 5.6kohms to 2.2kohm (more than 10mA for If) but nothing. With a 2200 ohms value, measured voltages are: for OFF status Voltage across pins 4 and 3 = 3V and for ON status (Signal1 = GND) voltage turns into 2.7V.
EDIT2: I have the exact same circuit except for the NAND gate below that one and it is switching properly. The NAND's footprint is right and the pinout and electrical values too. But it is impacting the behaviour of the swithing.