Pwdr / Pwdr-Model-0.1

A powder substrate rapid prototyping machine
131 stars 68 forks source link

Can't connect to Arduino #28

Closed ajn9494 closed 10 years ago

ajn9494 commented 10 years ago

I'm having trouble connecting the Arduino. I'm getting a similar error that another user on the forums had with:

ArrayIndexOutOfBoundsException:1

Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 1 at Pwdr_GUI_V0_3.startSerial (Pwdr_GUI_V0_3.java:498) at Pwdr_GUI_V0_3.mouseClicked (Pwdr_GUI_V0_3.java:1056) at processing.core.PApplet.handleMouseEvent (Unknown Source) at processing.core.PApplet.dequeueMouseEvent (Unknown Source) at processing.core.PApplet.handleDraw (Unknown Source) at processing.core.PApplet.run (Unknown Source) at java.lang.Thread.run(Thread.java:662)

It seems that the person who had that same problem before, atticdweller, got past it.

When I try to compile and upload the firmware, I seems to go through. Although, the 'L' led on the Arduino keeps blinking. (To my understanding, that isn't supposed to happen. it's supposed to not blink). I'm using PwdrFirmware2_0_mk1. Processing version 1.5.1.

Boreaz commented 10 years ago

Hi ajn9494, this bug occurs when choose incorrect arduino port. At first, the arduino program must be closed before processing starts and microcontroller must be connected, otherwise processing unable to see arduino port. Pwdr GUI, shows that the COM1 available even if arduino disconnected and this bug occurs when you clicked it. But if arduino connected, GUI now shows that COM1 and COM4 (may differ in your system) available, so currently one of them is correct arduino port, it's COM1 for me. P.S. the blinking of the L led may be changed in arduino firmware (pin 13) in this version it's blinking when arduino standby and lights permanently when printing.

ajn9494 commented 10 years ago

So you're saying that after I upload the firmware, I leave the USB connected, close Arduino program, and then open and run the Processing program? That's what I've been doing, but I'm still having trouble.

I better back up a minute too. The Arudino that is currently wired to the printer has been giving me an error code when uploading the firmware.

avrdude: stk500v2_ReceiveMessage(): timeout (//for about 5 or so lines) avrdude: stk500v2_getsync(): timeout communicating with programmer.

I saw some forums about it saying something about reprogramming the 16u2 firmware with a DFU bootloader. Not sure about all that, but figured I'd mention.

Anyway, I had a second Arduino Mega and tried with that. Not wired in, just the USB. The firmware uploaded successfully. Also, the TX and RX lights were lit as I believe they were supposed to be. (The one currently wired in didn't even give me that). I tried to open the GUI again in Processing with the same steps I described above. It still wouldn't read the Arduino and would crash the program.

And just for the record, for the wired in Arduino, the GUI will display the port its connected to COM 3, but that will be the ONLY port shown. Even though is the correct port and NOT COM 1, it crashes. For the other Arduino, its COM 4 instead of COM 3. Figured I mention that too.

Boreaz commented 10 years ago

Hm, I did not pay attention before, but now decided to check. Maybe my win7 buggy, the device manager shows that the arduino is connected to COM4 but the GUI sees it as connected to COM1 device-manager Anyway all works perfectly if I choose incorrect COM1, and crash when i choose correct COM4, maybe it specific only for my system.

And I do not understand, the RX and TX blinking when uploading firmware? Or lights when you trying to connect from GUI? On my arduino when it's standing by and GUI connected, only LEDs ON lights permanently and L blinking.

Pwdr commented 10 years ago

@ajn9494 Try hardcoding your COM port in the Processing progam:

Serial.pde line 9: arduinoSerial = new Serial(this, Serial.list()[ selectPort], 9600);

Change selectPort with your COM port (e.g. COM3)

@Micheal That's a weird bug, probably related to Windows.

On Tue, Jun 3, 2014 at 8:07 AM, Michael notifications@github.com wrote:

Hm, I did not pay attention before, but now decided to check. Maybe my win7 buggy, the device manager shows that the arduino is connected to COM4 but the GUI sees it as connected to COM1 [image: device-manager] https://cloud.githubusercontent.com/assets/3283492/3156442/21dfef34-eadd-11e3-99b1-0272db3e3c11.png Anyway all works perfectly if I choose incorrect COM1, and crash when i choose correct COM4, maybe it specific only for my system.

And I do not understand, the RX and TX blinking when uploading firmware? Or lights when you trying to connect from GUI? On my arduino when it's standing by and GUI connected, only LEDs ON lights permanently and L blinking.

— Reply to this email directly or view it on GitHub https://github.com/Pwdr/Pwdr-Model-0.1/issues/28#issuecomment-44923336.

Pwdr commented 10 years ago

Is the AccepStepper library properly installed?

On Fri, May 30, 2014 at 11:46 PM, ajn9494 notifications@github.com wrote:

Reopened #28 https://github.com/Pwdr/Pwdr-Model-0.1/issues/28.

— Reply to this email directly or view it on GitHub https://github.com/Pwdr/Pwdr-Model-0.1/issues/28#event-126617124.

ajn9494 commented 10 years ago

Hardcoding isn't working for either Arduino. It says "Cannot find anything named COM4" (COM3 for the wired in Arduino). As for the library, it should be alright. Is there a way to test if it was installed correctly?

Pwdr commented 10 years ago

Have you tried hardcoding every COM port (just from 1 to 5 or so)?

When the program compiles correctly, the AccelStepper library is installed correctly.

On Tue, Jun 3, 2014 at 6:12 PM, ajn9494 notifications@github.com wrote:

Hardcoding isn't working for either Arduino. It says "Cannot find anything named COM4" (COM3 for the wired in Arduino). As for the library, it should be alright. Is there a way to test if it was installed correctly?

— Reply to this email directly or view it on GitHub https://github.com/Pwdr/Pwdr-Model-0.1/issues/28#issuecomment-44985556.

ajn9494 commented 10 years ago

I think that's closer. But, what happens how is under the FloodFIll tab, at the very bottom, line 87, it highlights the closing curly brace and gives a new error.

syntax error, maybe a missing ] character

expecting RBRACK, found ',' processing.app.SketchException: Syntax error, maybe a missing ] character? at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:300) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197) at processing.mode.java.JavaBuild.build(JavaBuild.java:156) at processing.mode.java.JavaBuild.build(JavaBuild.java:135) at processing.mode.java.JavaMode.handleRun(JavaMode.java:176) at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481) at java.lang.Thread.run(Thread.java:662)

Pwdr commented 10 years ago

At least it's not a missing ']'. Can you reproduce this error?

On Wed, Jun 4, 2014 at 3:19 PM, ajn9494 notifications@github.com wrote:

I think that's closer. But, what happens how is under the FloodFIll tab, at the very bottom, line 87, it highlights the closing curly brace and gives a new error.

syntax error, maybe a missing ] character

expecting RBRACK, found ',' processing.app.SketchException: Syntax error, maybe a missing ] character? at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:300) at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197) at processing.mode.java.JavaBuild.build(JavaBuild.java:156) at processing.mode.java.JavaBuild.build(JavaBuild.java:135) at processing.mode.java.JavaMode.handleRun(JavaMode.java:176) at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481) at java.lang.Thread.run(Thread.java:662)

— Reply to this email directly or view it on GitHub https://github.com/Pwdr/Pwdr-Model-0.1/issues/28#issuecomment-45088925.

ajn9494 commented 10 years ago

Yes, it happens repeatedly. I'll show you.

serial

untitled

Boreaz commented 10 years ago

@ajn9494 I think the best way to check that firmware was correctly uploaded is use serial monitor, just push tools>serial monitor in arduino program, if the arduino controller runs the program, you must see message like this, after few seconds serial_monitor or SD initialization failed! if SD card not connected, and you may send commands to arduino like x, X, and see how coordinates will change. If that not happens, then firmware uploaded not correctly, or serial port is busy, or the arduino is broken.

Pwdr commented 10 years ago

You induced an bug by adding the pseudo array for the COM ports

Change the line:

arduinoSerial = new Serial(this, Serial.list()[COM1, COM2, COM3, COM4, COM5], 9600);

With this:

arduinoSerial = new Serial(this, "COM1", 9600);

Or of course the COM port you need.

When connecting the GUI to the Arduino Mega doesn't work, use Micheal's top tip of using the Arduino IDE's serial monitor.

On Thu, Jun 5, 2014 at 4:04 PM, Michael notifications@github.com wrote:

@ajn9494 https://github.com/ajn9494 I think the best way to check that firmware was correctly uploaded is use serial monitor, just push tools>serial monitor in arduino program, if the arduino controller runs the program, you must see message like this, after few seconds [image: serial_monitor] https://cloud.githubusercontent.com/assets/3283492/3188215/a88a3846-ecb8-11e3-9b39-4da5bc910178.png or SD initialization failed! if SD card not connected, and you may send commands to arduino like x, X, and see how coordinates will change. If that not happens, then firmware uploaded not correctly, or serial port is busy, or the arduino is broken.

— Reply to this email directly or view it on GitHub https://github.com/Pwdr/Pwdr-Model-0.1/issues/28#issuecomment-45222798.

ajn9494 commented 10 years ago

Changing that line of code was successful! The GUI is now able to read both of my Arduinos. Thanks a million. :) :)

Now, I am still having trouble with the Arduino that is currently hooked up to the printer. I'm still getting timeout error; and when I use the serial monitor, nothing appears.

The error code is the same as what I had above in my second comment:

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

I saw on some other computer forums something about "16u2" and reprogramming the Arduino with "a DFU bootloader". Not sure what all that means, but figured I'd mention.

I'm not as concerned about this since I do have the other Arduino that IS reading the firmware. But, I wouldn't mind learning why this one is having trouble.

h4ckninja commented 10 years ago

I'm not the Micheal you are looking for. I like Arduino, but that's not me. ;)