ATMEL Mega328P stops after 2 seconds when connected to USB

Hello i have been pulling my hair out for quite a while and i was hoping someone know what is going on.

Small introduction
I have an orignal Arduino UNO board everything works uploading connecting serial output the works. I connect to the board with Linux Mint 21.1 with Arduino IDE all works out of the box.

Now i have a cheaper board the Mega328P with CH340G chip and after allot of work removing some services and installing some drivers i can now connect and upload my code. So i thought i was done...

Now comes the problem for the Mega328p board.
As soon as i connect the USB and start Arduino IDE i upload my code and after the code was uploaded successfully the code executes for ~2 seconds and then stops. This can be anywhere in the code totally random. Now at first i thought it was my code so i just use the Blink example code and still after ~2 seconds it just stops working. To my surprise after the uploaded finishes and i disconnect the USB give the board it's own power supply it works great no crashing no stopping blinky blinky all the way for hours.

I did the above tests with the original Arduino UNO board and no problem what so ever.
Somehow connecting Arduino IDE to my chinese fake arduino makes it stop.

My board manager is MiniCore ATMega328 and is the only one i could find that works and uploads the code correctly.

I am having a hard time following, it appears you changed some hardware. Can you post an annotated schematic showing originally what was there and note what you have changed on the Mega328P.

Ok so i found to problem.

I switched to platformio and still had the same issue, just to see if the problem was with the IDE.

But after some googling if found if you put this in your platformio.ini

monitor_rts = 0
monitor_dtr = 0

The serial monitor will keep working and wont crash after 2 seconds.
I have no idea how to do this for the Arduino IDE so i gues ill stick with platformio for now.

To be honoust if you got the money buy the original Arduino save you allot of issues and time!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.