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.