Javascript required
Skip to content Skip to sidebar Skip to footer

Arduino Mega 2560 - Com Issue- Cannot Open Device - Ser_drain Read Erro- Handle Is Invalid

  1. Tinino

    Joined:
    Jul 31, 2017
    Letters:
    11
    Likes Received:
    five
    Hello. I attempted to update my firmware through multiple versions of arduino and it seems that somewhere along the line I messed something up. The printer still connects to my reckoner through USB and nether Device Managing director the device shows up equally being continued through COM4, however in matter command and arduino it states the port is already in utilise. To the best of my knowledge, that's incorrect...it isn't already in apply by anything, I've gone as far as uninstalling all versions of Arduino I had on my figurer including all the libraries, I've closed any software that could be running in the background, and restarted my calculator as well every bit the printer countless times, I've likewise tried switching to different USB cables with no success. I've tried connecting with a few versions of Arduino (New, erstwhile, eye of the road). I'thousand honestly at a loss on this one. I'm not sure if perhaps the board got fried, I don't think so. I popped open up the back and the arduino has a yellow lite, when I plug/unplug the USB cable a dark-green light comes on rapidly on the Mega 2560, as stated above it still shows up in my device manager, only the port is getting noise, or information technology'south only being tempermental/doesn't desire to connect anymore. At this point it'south not as simple as just 'factory resetting' with stock firmware because I can't do that because information technology doesn't connect.

    I'm not certain if at that place'southward an error log I can provide or any other details, I'll try to be as specific every bit possible for you so it's non a pain to aid me. If there's anyone out there who's more seasoned than I am that could shed some calorie-free on this, or make whatsoever recommendations on how to strength a connection or force a reset of the board itself that'd be crawly. Cheers a ton to anyone willing to take the fourth dimension to read this and help me out.

  2. Geof

    Staff Member

    Joined:
    Nov 9, 2015
    Messages:
    6,729
    Likes Received:
    ii,329
    an error log from arduino would be a good showtime as well equally exactly what printer model you have (yous take to be exact) and what firmware your using.
  3. mark tomlinson

    Staff Fellow member

    Joined:
    Feb 21, 2013
    Letters:
    23,554
    Likes Received:
    7,309
    It is remotely possible that information technology is a bad Arduino (or one with a bad bootloader). Go the details @Geof mentioned and we can become from there (even out of warranty the Arduino Mega is a cheap board).
  4. Tinino

    Joined:
    Jul 31, 2017
    Messages:
    11
    Likes Received:
    5
    Sounds good. Thank you both for the speedy replies. I've gotta get to work soon so I'll post a reply this evening when I become an opportunity with the requested information. Thanks again!
  5. Tinino

    Joined:
    Jul 31, 2017
    Messages:
    11
    Likes Received:
    5
    Sketch uses 134,142 bytes (51%) of programme storage space. Maximum is 258,048 bytes. Global variables use 4,443 bytes (54%) of dynamic memory, leaving iii,749 bytes for local variables. Maximum is viii,192 bytes. avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.   avrdude: ser_drain(): read mistake: The handle is invalid.   processing.app.debug.RunnerException     at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:125)     at processing.app.Sketch.upload(Sketch.java:1719)     at processing.app.Sketch.exportApplet(Sketch.java:1625)     at processing.app.Sketch.exportApplet(Sketch.java:1597)     at processing.app.Editor$DefaultExportHandler.run(Editor.coffee:2397)     at java.lang.Thread.run(Unknown Source) Caused past: processing.app.debug.RunnerException: Problem uploading to board.  Meet http://world wide web.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.     at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:111)     at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:123)     ... 5 more                            
    Arduino: 1.5.six-r2 (Windows eight), Lath: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"  Sketch uses 134,142 bytes (51%) of program storage infinite. Maximum is 258,048 bytes.  Global variables use 4,443 bytes (54%) of dynamic memory, leaving 3,749 bytes for local variables. Maximum is 8,192 bytes.  avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.   avrdude: ser_drain(): read error: The handle is invalid.   processing.app.debug.RunnerException      at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:125)      at processing.app.Sketch.upload(Sketch.java:1719)      at processing.app.Sketch.exportApplet(Sketch.java:1625)      at processing.app.Sketch.exportApplet(Sketch.coffee:1597)      at processing.app.Editor$DefaultExportHandler.run(Editor.java:2397)      at coffee.lang.Thread.run(Unknown Source)  Caused past: processing.app.debug.RunnerException: Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.      at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:111)      at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.coffee:123)      ... v more  processing.app.SerialException: Error opening serial port 'COM4'.      at processing.app.Series.<init>(Series.java:145)      at processing.app.Series.<init>(Serial.coffee:90)      at processing.app.SerialMonitor.open(SerialMonitor.coffee:93)      at processing.app.Editor.handleSerial(Editor.coffee:2542)      at processing.app.Editor$17.actionPerformed(Editor.java:686)      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)      at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)      at javax.swing.AbstractButton.doClick(Unknown Source)      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)      at coffee.awt.Component.processMouseEvent(Unknown Source)      at javax.swing.JComponent.processMouseEvent(Unknown Source)      at coffee.awt.Component.processEvent(Unknown Source)      at java.awt.Container.processEvent(Unknown Source)      at java.awt.Component.dispatchEventImpl(Unknown Source)      at coffee.awt.Container.dispatchEventImpl(Unknown Source)      at java.awt.Component.dispatchEvent(Unknown Source)      at coffee.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)      at java.awt.Container.dispatchEventImpl(Unknown Source)      at java.awt.Window.dispatchEventImpl(Unknown Source)      at java.awt.Component.dispatchEvent(Unknown Source)      at java.awt.EventQueue.dispatchEventImpl(Unknown Source)      at java.awt.EventQueue.admission$200(Unknown Source)      at java.awt.EventQueue$3.run(Unknown Source)      at java.awt.EventQueue$iii.run(Unknown Source)      at java.security.AccessController.doPrivileged(Native Method)      at java.security.ProtectionDomain$ane.doIntersectionPrivilege(Unknown Source)      at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)      at java.awt.EventQueue$iv.run(Unknown Source)      at java.awt.EventQueue$four.run(Unknown Source)      at java.security.AccessController.doPrivileged(Native Method)      at java.security.ProtectionDomain$ane.doIntersectionPrivilege(Unknown Source)      at java.awt.EventQueue.dispatchEvent(Unknown Source)      at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)      at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)      at coffee.awt.EventDispatchThread.pumpEvents(Unknown Source)      at java.awt.EventDispatchThread.run(Unknown Source)  Caused by: jssc.SerialPortException: Port name - COM4; Method name - openPort(); Exception type - Port busy.      at jssc.SerialPort.openPort(SerialPort.java:164)      at processing.app.Series.<init>(Series.java:141)      ... 42 more    This written report would accept more information with   "Show verbose output during compilation"   enabled in File > Preferences.                            
    Printer Model: Robo 3D R1+
    Firmware Version: Stock Release v2.0

    I hope this helps and again thank you guys for taking the fourth dimension out of your 24-hour interval to read through these logs which I don't fully sympathise. I hope it yields the information you lot are looking for and hopefully gives some results on what I need to practice here to get upward and going.

    Thank you!

  6. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Fellow member

    Joined:
    February eighteen, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    @Tinino reinstall the latest version of the Arduino IDE from http://arduino.cc and brand sure you install the USB drivers too.
  7. Geof

    Staff Member

    Joined:
    November 9, 2015
    Messages:
    6,729
    Likes Received:
    2,329
    Yep thats where I would starting time. With the new arduino and drivers installed you need to select the correct com port, ensure you have the amega 2560 selected as the board and try once more (ensure your standard release 2.0 is R1+ and not a R1 standard release, there is a difference )
  8. Tinino

    Joined:
    Jul 31, 2017
    Messages:
    11
    Likes Received:
    5
    Thank you all for the replies. I'll give information technology a shot this evening and see if I can become some results. Worst case I'll simply buy a new board, mega 2560's are pretty inexpensive, I but detest to replace things when I don't have to.
  9. This sounds a little familiar from hither and here.
  10. Tinino

    Joined:
    Jul 31, 2017
    Letters:
    11
    Likes Received:
    5
    Steps taken in an attempt to resolve:
    1. Viewed all links posted in this thread
    2. Read over all solutions offered
    3. Constitute a solution which fabricated the most sense/seemed tailored and relatively guided to the proper info needed
    4. Downloaded Windows device drivers for Arduino UNO from: (Link Omitted)
    5. Drivers were already installed yet I considered the possibility of a bad driver, so I uninstalled and so proceeded to reinstall
    6. Uninstalled old versions of Arduino IDE
    7. Installed Arduino one.eight.3 IDE via the windows installer (Current/Most Recent version as of today 8/3/2017)
    8. Loaded the ROBO3DR1PLUSV2.ini file into arduino (I made sure this was the R1+ version, not the standard R1), file was downloaded from: (Link Omitted)
    9. Selected Arduino/Genuino MEGA 1280/2560 in Arduino one.8.3 IDE
    10. Selected the MEGA 2560 processor
    11. Selected COM4 (Port listed under ports in Device Director and the 1 that shows upwards in Arduino 1.8.3 IDE)
    12. Left the programmer the same (AVRISP MkII)
    13. Verified the file after loading in Arduino 1.8.iii IDE
    14. Received the following error message:
    15. [[[To be adamant]]]
    Arduino: 1.8.3 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:five:  sketch\pins.h:2564:0: alert: "X_MAX_PIN" redefined  #define X_MAX_PIN          -one  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:v:  sketch\pins.h:445:0: note: this is the location of the previous definition       #define X_MAX_PIN           ii  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:five:  sketch\pins.h:2565:0: warning: "Y_MAX_PIN" redefined  #ascertain Y_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:5:  sketch\pins.h:451:0: note: this is the location of the previous definition       #define Y_MAX_PIN          15  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:5:  sketch\pins.h:2566:0: warning: "Z_MAX_PIN" redefined  #define Z_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\BlinkM.cpp:5:  sketch\pins.h:457:0: note: this is the location of the previous definition       #define Z_MAX_PIN          19  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:ane:  sketch\pins.h:2564:0: warning: "X_MAX_PIN" redefined  #define X_MAX_PIN          -one  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:1:  sketch\pins.h:445:0: note: this is the location of the previous definition       #define X_MAX_PIN           2  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:one:  sketch\pins.h:2565:0: warning: "Y_MAX_PIN" redefined  #define Y_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:1:  sketch\pins.h:451:0: note: this is the location of the previous definition       #ascertain Y_MAX_PIN          15  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:ane:  sketch\pins.h:2566:0: alert: "Z_MAX_PIN" redefined  #define Z_MAX_PIN          -i  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\ConfigurationStore.cpp:1:  sketch\pins.h:457:0: annotation: this is the location of the previous definition       #define Z_MAX_PIN          19  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:2564:0: alert: "X_MAX_PIN" redefined  #define X_MAX_PIN          -i  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:445:0: note: this is the location of the previous definition       #define X_MAX_PIN           two  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:2565:0: warning: "Y_MAX_PIN" redefined  #ascertain Y_MAX_PIN          -one  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:451:0: note: this is the location of the previous definition       #define Y_MAX_PIN          15  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:2566:0: warning: "Z_MAX_PIN" redefined  #ascertain Z_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\MarlinSerial.cpp:23:  sketch\pins.h:457:0: note: this is the location of the previous definition       #define Z_MAX_PIN          19  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:thirty:  sketch\pins.h:2564:0: alarm: "X_MAX_PIN" redefined  #ascertain X_MAX_PIN          -one  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:30:  sketch\pins.h:445:0: annotation: this is the location of the previous definition       #define X_MAX_PIN           two  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:30:  sketch\pins.h:2565:0: warning: "Y_MAX_PIN" redefined  #define Y_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:30:  sketch\pins.h:451:0: note: this is the location of the previous definition       #define Y_MAX_PIN          15  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:30:  sketch\pins.h:2566:0: warning: "Z_MAX_PIN" redefined  #define Z_MAX_PIN          -1  ^  In file included from sketch\Marlin.h:23:0,                   from sketch\Marlin_main.cpp:30:  sketch\pins.h:457:0: note: this is the location of the previous definition       #ascertain Z_MAX_PIN          19  ^  sketch\Marlin_main.cpp:2192:36: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]           LCD_MESSAGEPGM(MACHINE_NAME" "MSG_OFF".");                                      ^  In file included from sketch\SdFile.h:27:0,                   from sketch\cardreader.h:8,                   from sketch\Marlin_main.cpp:44:  SdBaseFile.h:38: error: using typedef-proper name 'fpos_t' later 'struct'  struct fpos_t {          ^  In file included from sketch\Marlin.h:10:0,                   from sketch\Marlin_main.cpp:30:  c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdio.h:950:33: note: 'fpos_t' has a previous announcement here  __extension__ typedef long long fpos_t;                                   ^  sketch\Marlin_main.cpp: In function 'void loop()':  sketch\Marlin_main.cpp:588:49: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]                    card.openFile("robo~i.gco",true);                                                   ^  sketch\Marlin_main.cpp: In office 'void set_bed_level_equation_lsq(double*)':  sketch\Marlin_main.cpp:884:36: alert: deprecated conversion from string constant to 'char*' [-Wwrite-strings]       planeNormal.debug("planeNormal");                                      ^  go out status i using typedef-name 'fpos_t' afterward 'struct'  This written report would take more than information with "Bear witness verbose output during compilation" option enabled in File -> Preferences.                            

    I practice recall reading somewhere about fpos_t no longer working and to change to FatPos_t and that may correct the event, yet I am non going to do that at this fourth dimension and leave it to you folks who are better versed at this to analyze the error and make a recommendation. Thank you all once again for taking the time to reply and help me with this.
  11. Geof

    Staff Fellow member

    Joined:
    Nov 9, 2015
    Messages:
    half dozen,729
    Likes Received:
    2,329
    that is the upshot. In that location is a thread (sound like you read) on how to fix this.
  12. mark tomlinson

    Staff Member

    Joined:
    February 21, 2013
    Messages:
    23,554
    Likes Received:
    7,309
    Yep, that trouble is considering the newer Arduino compiler has gotten stricter on the linguistic communication format (it was really incorrect before and now information technology is exposing a bug). If you make that 2 line change you should be fine. If you lot run into problems I tin can mail service the corrected files for you (there are two).
  13. Here's the i about the C++ error: github
    (Needs a single space before MSG)
    LCD_MESSAGEPGM(MACHINE_NAME" " MSG_OFF".");
  14. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Letters:
    v,905
    Likes Received:
    3,593
    @OutsourcedGuru not applicative, the error is as stated by @mark tomlinson using an outdated construct so a elementary two line edit volition fix this.

    All the indistinguishable defines are warnings and can be ignored, the merely mistake stopping compilation is the constant error. Maybe y'all meant that answer for a unlike thread.

  15. Tinino

    Joined:
    Jul 31, 2017
    Messages:
    11
    Likes Received:
    v
    I did actually cheque out that thread, I was reading through some quondam threads a few days ago and passed over it, interestingly enough. I went through the file and replaced any and all instance of fpos_t that I could find with FatPos_t. I'thou pretty sure maybe I missed 1 somewhere because when I verify the file it's still giving me some errors. @mark tomlinson Would it be any trouble for you to mail or direct me to where I tin discover the repaired firmware for IDE v1.8.3?

    Give thanks you all again for the help and your replies information technology's really appreciated.

  16. mark tomlinson

    Staff Member

    Joined:
    Feb 21, 2013
    Letters:
    23,554
    Likes Received:
    7,309
    Attached.

    Those two are all the editing needed.

    Fastened Files:

  17. Tinino

    Joined:
    Jul 31, 2017
    Letters:
    11
    Likes Received:
    5
    Oh yous're quick. Alright I am gonna requite this a shot real quick *rolls out of bed*. I'll become back to you on this in a few minutes.
  18. Tinino

    Joined:
    Jul 31, 2017
    Messages:
    eleven
    Likes Received:
    five
    (I am lamentable in advance that I am so much trouble hahaha, one affair later on another here). I experience like I'm making progress all the same now I am getting this fault upon verifying the file. It does appear it is able to connect to the COM port now, I call up reinstalling the cleaved drivers for the Arduino UNO fixed the issue, even so along with the original fpos_t fault I was getting an fault from what looks like watchdog.cpp and marlin.h from #define Y_MAX_PIN, X_MAX_PIN, and Z_MAX_PIN. Information technology states they are redefined, I cannot seem to tell if this is an mistake or if this is normal for the compiler. Here's the fault:

Share This Page

burnettundiers.blogspot.com

Source: http://community.robo3d.com/index.php?threads/unable-to-connect-to-printer-in-mc-or-arduino.19168/