First time using this form so please ignore and forgive me if you find mistakes because its urgent for me if I can get help from this form :)
I am working on a USB device which should have capability to communicate serially with computer as well as with other our custom device so this is high level overview.
USB device communicate via CP2102 with computer but our custom device communicate at TTL level with USB device therefore when USB device connected to our device then USB MCU disable CP2102 IC and should communicate directly with our device at TTL level but its not happing because transistor Q3 not activating on setting MCU PIN PA2 to LOW.
USB device has two three ICs, - attiny1634, CP2102 and 25LC256 SPI EEPROM. Now see what I am trying to do - as you can see in schematic CP2102 IC pins D+, D- directly connected to Male USB connector and RXD, TXD of attiny1634 directly connected to CP2102 but RXD, TXD of attiny1634 also connected to Male USB connector via transistors. Now what actually happening is - I am able to power on off CP2102 IC using transistor Q1, Q4 also able to switch on off transistor Q2. But unable to switch on Q3 transistor so it is always off. PA2 PIN of attiny1634 is always set as output and logic low so it should enable transistor Q3 but its not doing as expected. One more thing I notice if I connect base pin of Q3 transistor directly to GND then Q3 switch on. Attached schematic pdf
I wrote a simple code to test Q2, Q3 transistors only. Please see attached Schematic and code.
#define CTRL_1 PA1
#define CTRL_2 PA2
#define CP_PWR PA3
#define CP_GND PA4
DDRA |= (1 << CTRL_1);
DDRA |= (1 << CTRL_2);
DDRA |= (1 << CP_PWR);
DDRA |= (1 << CP_GND);
/* ENABLE Transistor Q2, Q3 */
PORTA &= ~(1 << CTRL_1); // This Q2 transistor working on setting LOW.
PORTA &= ~(1 << CTRL_2); // This Q3 transistor not working on setting LOW.
/* Disabled Transistor Q1, Q4 */
PORTA |= (1 << CP_PWR); // Set high to disbale Q1 PNP
PORTA &= ~(1 << CP_GND); // Set LOW to disbale Q4 NPN