Can't upload to MKS Gen L board

I can't seem to uplaod to my board. It worked once with everything disconnected but won't work any longer. Really dont' want to label everything again and pull my printer apart again to remove all the connections to test.

I'm running windows 10 pro 64 bit

I have a MKS gen L v1.0 board

I have tried disconnecting the screen and BL touch and tried uploading when the board is powered by usb and by printer power supply. The message I get is "the selected serial port does not exist or your board is not connected" The board is connected and shows up as COM 5. When I disconnect the board, COM 5 disappears, so I know that's the right com port.

Here is my error message:

Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Sketch uses 129726 bytes (51%) of program storage space. Maximum is 253952 bytes.
Global variables use 4758 bytes (58%) of dynamic memory, leaving 3434 bytes for local variables. Maximum is 8192 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM5 -b115200 -D -Uflash:w:C:\Users\Nick\AppData\Local\Temp\arduino_build_9420/Marlin.ino.hex:i 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.19.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "\\.\COM5": Access is denied.


avrdude: ser_drain(): read error: The handle is invalid.


avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
avrdude: ser_recv(): read error: The handle is invalid.


avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

the selected serial port 
 does not exist or your board is not connected
Invalid library found in C:\Users\Nick\Documents\Arduino\libraries\u8glib-master: no headers files (.h) found in C:\Users\Nick\Documents\Arduino\libraries\u8glib-master
Invalid library found in C:\Users\Nick\Documents\Arduino\libraries\u8glib-master: no headers files (.h) found in C:\Users\Nick\Documents\Arduino\libraries\u8glib-master

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thank you for any help you can provide.

Nick

The first error says “Access denied.” could some other program be accessing the port at the same time you are trying to upload?

Did you find a solution? I'm having the same problem. Flashed Marlin 1.1.9 and it worked fine the first time. Went to flash it second time and seeing the same error as above. I played with the com port settings and now the error has changed to:

avrdude: ser_open(): can't open device "\.\COM4": The system cannot find the file specified.

Does COM4 appear under the Arduino IDE's Tools > Port menu?

Yes it does, the board also shows up in device manager as COM4. Going to try burning the bootloader again with an AVR-ISP-MK2.

I decided to try uploading with a laptop so I could get closer to the printer and it worked fine. Maybe the USB hub I was using to connect the MKS board to my pc was causing the issue.

Nice work finding a solution! Thanks for taking the time to write an update. Enjoy.
Per