Need a little help figuring out an issue.
Atmel 2560 using a CH340E USB to serial converter
-Uploading code and running it while plugged in on USB works fine.
-Running on just 5V power supply does not run code
It is not code error as the simplest code with nothing using the serial port will not run while using power from the 5V power supply.
Example of code that doesnt run:
void setup(void){pinMode(26, OUTPUT);}
void loop(){digitalWrite(26, HIGH);}
The issue does not lie with the power quality of the power supply as it gives 5V up to 3A
I suspect that it lies with the power supply (or the lack thereof) to the CH340E
When plugged in on USB the CH340E is powered by the USB.
When connected to 5V power the CH340E is not powered.
When jumping power to the VCC pin of the CH340E the system works and runs code without being connected to USB power. This is a solution but is it the correct one?
I am trying to figure out what the CH340 is doing when it is un-powered that is causing the board to not run. Is it resetting the Atmel chip over and over? The RTS pin on the CH340E pulls low to reset the Atmel chip at the start of communication. So I am assuming this is going to be low when it is in the off state how ever should it not then only reset the Atmel once when the capacitor charges up and after that the reset voltage should remain constant? (An oscilloscope would probably make this instantly obvious but I don't have access to one at the moment)
Secondly what is the correct practice when it comes to powering the CH340 (or any USB to serial converter on a device) Should it be powered by the the Host or the Device?
Here is the schematic of the board in question
SCH_Schematic2_2023-09-19.pdf (499.1 KB)
Some notes:
-The power selector section of the circuit is not quite correct in that when USB is the only source of power for the board, it does in effect turn it self "off" at the mosfet Q2 and the power on the 5V rail is lower than it should be (a little under 4V). This can be corrected by putting a diode between the power source and 5V rail and having the power for the Q2 gate come from before the diode so it will only pull the gate up when there is actual power coming from the 5V power supply.