Okay, forget what I said about the 4 second sleep -- just had a string of those timeouts again tonight, while jumping back and forth between stock and custom firmware. Added a 4 second sleep in connect() but that didn't stop the timeouts. The only thing I can add is that it seemed that the motor clunk was a lot louder on the attempts that ended in timeout, while the successful upload attempts were quieter. EMI? Pretty subjective observations though.
Steve
Recommended Posts
Daid 306
It's normal behaviour that the printer resets if you open the serial port. (This is actually behaviour copied from Arduino)
You might get around the problem in linux with:
stty clocal -hubcl /dev/ttyACM0
There are stability problems with the USB on some computers. Which is why we opted not to officially support USB printing. However, all the code is in place for it to work, and you can actually do it from Cura if you switch to "RepRap" gcode flavor.
If you are more into writing your own code, this is the USB communication implementation of Cura:
https://github.com/daid/Cura/blob/SteamEngine/Cura/util/machineCom.py
(As you need to do flow-control and stuff, doing straight "cat" to the serial port is not recommended)
Link to post
Share on other sites
stevegt 1
Thanks Daid, that was enough clues to get me going. For anyone else who's interested; there were multiple causes for the behavior I was seeing, which is why I was so confused:
The short version of the story: If you want to talk to your UM2 from pronterface, miniterm, or any other python app, simply set them to 250000 baud, but first upgrade your pyserial to the latest version from sourceforge SVN. (You need r469 or later -- pip doesn't have it yet). This may also be the solution if you're seeing timeouts while trying to upload new firmware to the UM2 from inside Cura. The standard 14.03 version of UM2 Firmware is running at a 250000 baud rate. Unless you've hacked your Linux userland to allow that custom baud rate, you won't be able to talk to the UM2 from e.g. minicom or screen. Neither stty nor setserial are likely to cooperate with setting the baud rate to 250000 either, so don't worry about those not working -- they just won't. But python apps work great after the pyserial upgrade, as long as you set them to 250000 baud. Just go do it, stop reading now, and stop thinking "surely this doesn't apply to me...". :wink:
Here's the long version:
Thanks again Daid,
Steve
Link to post
Share on other sites
stevegt 1
Just to add to the mix, I just ran across this change that Daid made to Cura a year ago, to work around any unpatched older versions of pyserial:
https://github.com/daid/Cura/commit/28efc5a0b63d338bd976306460d7f6324fc0d1fb
I'm not sure how this affects my conclusions above -- on the one hand, it would explain why Cura *should* have worked before I upgraded pyserial. But in reality Cura *didn't* work for the first 20-30 attempts at uploading stock firmware to the UM2. And then it worked once, and has worked on every try since then. And it started working before I upgraded pyserial.
Something makes me think stk500v2.py needs about a 4 second sleep in stk500v2.connect(), right after cycling DTR, before the flushes; give the firmware plenty of time to finish setup. But I can't prove it, because I can't make uploads fail now.
Steve
Link to post
Share on other sites