-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Micronucleus issues #944
Comments
Another thing, probably a question for you @mariusgreuel. When the user program is running on the microcontroller, and I'm trying to upload using Avrdude, I get the following error. I have to unplug the board, execute Avrdude and then insert the board again for it to work.
However, with the "original" micronucleus upload tool I can execute the uploader even though the board is running the user application, and it will just wait until I re-connect the board.
It would be awesome if Avrdude could mimic the Micronuceus upload tool behaviour! |
Because it has never been designed with the intention of a (kinda) crippled bootloader in mind. Verification of the upload seemed to be crucial and is thus the default. Actually, I think the need to add |
Well, that kinda makes sense. The other issue where Avrdude return |
Bootloaders are a bit like octogenarians. They do whatever they like, and there is little one can do about it (this is the one thing I actually look forward to at old age). In fairness, AVRDUDE's documentation invites the user to type |
The primary reason was that I could not figure out how to turn that off without touching the rest of the code base. Currently, avrdude expects certain read functions to be implemented, which I would have otherwise just marked as NULL. So, I went with
I suspect that the I don't know how macOS works, but perhaps there is some tool that shows the state of an USB device? I am curious what macOS reports when the Micronucleus bootloader exited and the user-program runs. In this case the USB device should report some disconnected/unresponsive state. If we know what to look for we could perhaps examine the state and skip the device if necessary. Another idea is to send a dummy request in |
Personally, I would prefer a nicely formatted warning instead when not using the -V flash. I don't think the Micronucleus bootloader will support read functionality any time soon anyway.
I couldn't find a built-in tool that outputs a different status from when in bootloader mode and when it runs the user program. However, when it is in this "unresponsive" state, Lines 232 to 247 in a4c9fcd
A potential solution would be to require a disconnect/reconnect if -5 is returned, and not print any scary errors or warnings. |
According to the libusb documentation I just found, -5 means enum | libusb_error { LIBUSB_SUCCESS = 0, LIBUSB_ERROR_IO = -1, LIBUSB_ERROR_INVALID_PARAM = -2, LIBUSB_ERROR_ACCESS = -3, LIBUSB_ERROR_NO_DEVICE = -4, LIBUSB_ERROR_NOT_FOUND = -5, LIBUSB_ERROR_BUSY = -6, LIBUSB_ERROR_TIMEOUT = -7, LIBUSB_ERROR_OVERFLOW = -8, LIBUSB_ERROR_PIPE = -9, LIBUSB_ERROR_INTERRUPTED = -10, LIBUSB_ERROR_NO_MEM = -11, LIBUSB_ERROR_NOT_SUPPORTED = -12, LIBUSB_ERROR_OTHER = -99 } https://libusb.sourceforge.io/api-1.0/group__libusb__misc.html#gab2323aa0f04bc22038e7e1740b2f29ef |
@mariusgreuel do you think there's a chance we can come up with a solution for the "-5 error" before 7.0 is released? I've tried playing around with some of the USB-related code, but I'm just getting segmentation faults. |
@MCUdude I don't have the possibility to do any testing right now, so here is a compile-check only patch. Could you please try this? If it works, I can submit the PR. |
Thanks, @mariusgreuel for taking a look at the problem. Unfortually,
It does, however, work if I disconnect and conect it again:
|
I take it that it works, beside the shitload of messages, correct? |
Correct. It also works like it should with
Or similar. |
That is a very good point. That being said, V-USB seems to be popular among non-USB avr devices, including the tools like usbasp and usbtinyisp. |
Although the V-USB devices do not meet the specs, they often just work. I have not seen this issue with the usbasp and usbtinyisp devices I own, but only with certain Digispark clones. They somehow mucked up the hardware, so that certain hubs do not detect a device disconnect properly. I was actually able to reproduce that issue also on Windows, when the right hub and port was used. |
I am facing this issue now with two MH-Tiny ATtiny88 boards. The on-board Micronucleus bootloader works very poorly. They worked once for my laptop and now do not seem to work anymore. Ref: I will first try different version of the bootloader. Or I will just give up and the use optiboot and USB-TTL converter. |
Flashing new FW here seems to help a bit but still flaky. Looks like the hardware design may be the problem. The board is really cheap at about US$2.0, image and info reference: |
Interesting Arduino ATTinyCore has the same thing -- I need to plug out and then plug in to get the programming working with the micronucleus bootloader for the ATtiny88.
|
When trying to upload a program to an ATtiny85 running the Micronucleus bootloader, I'm getting the following error:
Since the Micronucleus bootloader doesn't support flash reading at all, why is Avrdude trying to read the flash by default? Wouldn't it be better if Avrdude simply skipped reading the flash by default when using the micronucleus programmer option instead of "manually" adding the -V flag every time?
The text was updated successfully, but these errors were encountered: