Dlloydev / jtag2updi

HV UPDI / UPDI programmer software for Arduino (targets Tiny AVR-0/1/2, Mega AVR-0 and AVR-DA/DB MCUs)
MIT License
27 stars 8 forks source link

Unstable trailing edge of stopbit pulse while using software UPDI I/O #18

Closed kosilin closed 2 years ago

kosilin commented 2 years ago

Good day!

Yesterday I've spend some time trying to make working UPDI HV mini programmer that I'd made using slightly modified schematics. I investigated that updi_io_soft.cpp contains an error (at my sight) that leads to either unstable or completely failed programmer operating.

The problem is that at stop bit transmission UPDI pin is switched to input mode (line 225, updi_io_soft.cpp) just after it has set to "1" (line 214, updi_io_soft.cpp). The trailing edge of the stop bit might not be detected by target device due to very short positive pulse that is damping completely as a fact because of parasitic capacitances. I think it's an issue.

I suggest to add some delay after stop bit transmission. I'm not sure but it seems to be reasonable for me to append the same time as "0" pulse has (txdelay).

At least in my environment the modification has led to stable operating of my UPDI programmer.

This patch is included. 0001-Fixes-unstable-trailing-edge-of-stopbit-pulse-while-using-software-UPDI-IO.txt

Best regards, Alexey

Dlloydev commented 2 years ago

Thank you for posting this. I think the developer of jtag2updi might be interested in your experience. If you could create an issue there, it would be interesting to get some feedback from him. Your fix seems reasonable to me, but I'm not the expert.

kosilin commented 2 years ago

Thank you for the feedback. I've posted the issue to original project (ElTangas).

Best regards, Alexey

Dlloydev commented 2 years ago

Patch has been implemented, thanks again.