I need to connect UART devices in a master to multiple slaves configuration.
I need to isolate the desired slave while I'm transmitting, so others will not receive, non-selected slaves must have its RX line High. These devices only answer when asked, no transmission without a request.
I cannot change the slave devices, this is how they operate, I cannot create slave addresses or something to address this "isolation" in software.
Another issue is that they are isolated by an Optocoupler, PC817, so I cannot create some kind of resistor network to keep the RX line of the slave High while not selected.
This is the slave RX equivalent of the slaves:
This is what I came up with:
The BAT43 is to isolate the TX from slaves. I already used this kind of solution, works great when the slaves don't write to line simultaneously, the pull-up keeps line High if nothing is transmitted, If a slave transmits, only the Low pass through the BAT43.
The doubt is with the TX from the master. In this schematic, I used a 74HC32(OR gates) to keep TX line high(This is a must), even if the slave is not selected, to select a slave, TXx_EN goes Low, others goes High. I don't know if the 74HC32 can drive the PC817 high, in the datasheet it says max 25ma, so I believe it could.
I need to keep RX from slaves high while not selected because otherwise, it would see a "start bit" when de-selected.
Would this solution be a good one? I could use a dual transistor solution(One from TX and another from VCC), but too cumbersome.
EDIT: I'm using STM32F103 as Micro, 3.3v. The R2 resistor is a 470ohms.