SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
542 stars 140 forks source link

UPDI init failed on Ubuntu 22.04.3 LTS #1047

Open kr15h opened 5 months ago

kr15h commented 5 months ago

Hi,

I am trying to program ATtiny412 and ATtiny1614 boards using Serial UPDI (tried all programmer options) and Quentin's SWD UARD Adapter and the packaged pymcuprog throws a UPDI Initialization failed error.

I tried to export the compiled binary and upload it with the latest pymcuprog installed on my system via pip and it worked. I also added the workaround to the README of Quentin's SWD UARD Adapter.

First, yes, I am using Arduino IDE 1.8.13. Second, I tried it on Windows 10 and it works out of the box, no problem. Mac is another issue, but it would be great to solve it on Linux first.

I assume that the packaged pymcuprog should be updated. Packaged version is 3.6.4.86, but the latest available version is 3.16.8.40.

If you can give me hints about how to perform the upgrade, I could do it and submit a pull request.

Thank you for your time!

SpenceKonde commented 3 months ago

No, the packaged version of SerialUPDI is very very different from the official one and has departed too much from the codebase and the code can no longer be ported between the two. Performance with the "official" version is markedly worse than for my version, a huge amount of effort was put towards optimizing it. 99% of the time a UPDI init failed is a bad connection or incorrect wiring - where it's failing for you it has received no response from the target; I don't think anything in the upstream helps other than that it acts like our version with all the speed-robbing settings set to the most grindingly slow and even worse, it doesn't use RSD when writing bulk data, forcing the excessively long default guard times and pauses noted above on every byte, which adds a round trip, which is typically 1-2 ms.

If there are enhancements, that need to be pulled in from the main one, it needs to be done by hand, working in godawful code.

It is of course also possible that they locked UPDI.