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
554 stars 144 forks source link

UPDI Iinitialization failed on attiny1604 #1049

Open charbelB7 opened 8 months ago

charbelB7 commented 8 months ago

I'm using an attiny1604 devboard from soldered.com (https://soldered.com/product/dasduino-lite/) and i tried to program it with serial updi but as said in the title i get the following error message : Traceback (most recent call last): File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10/tools/prog.py", line 286, in <module> main() File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10/tools/prog.py", line 128, in main return_code = pymcuprog_basic(args, fuses_dict) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10/tools/prog.py", line 201, in pymcuprog_basic args_start) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\pymcuprog_main.py", line 545, in _start_session backend.start_session(sessionconfig) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\backend.py", line 362, in start_session sessionconfig.interface_speed) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\programmer.py", line 83, in setup_device options=self.options) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\nvm.py", line 42, in get_nvm_access_provider accessprovider = NvmAccessProviderSerial(transport, device_info, baud=frequency, options=options) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\nvmserialupdi.py", line 54, in __init__ self.avr = UpdiApplication(port, baud, self.dut) File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\serialupdi\application.py", line 79, in __init__ datalink.init_datalink() File "C:\Users\delta\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10\tools\libs\pymcuprog\serialupdi\link.py", line 44, in init_datalink raise PymcuprogError("UPDI initialisation failed") pymcuprog.pymcuprog_errors.PymcuprogError: UPDI initialisation failed Failed programming: uploading error: exit status 1 I am using the following CH340 adapter : https://www.seeedstudio.com/USB-To-Uart-5V-3V3-p-1832.html Which has no internal resistor for TX. the circuit i am doing is the following :

image with a schottky diode and a 470 ohm resistor in serial with the UPDI pin. My arduino IDE version is 2.2.1 I am programming it with 230400 bauds and and even tried to reconfigure the serial port's uart settings as using even parity bits and 2 stop bits but to no success. Any idea on how to fix this?

charbelB7 commented 6 months ago

could you please answer this problem, its been two months and still doesn't work @SpenceKonde

hmeijdam commented 6 months ago

Are you sure this is a board without a bootloader that has disabled UPDI and turned it into a Reset pin? I see your board has already a CH340G and USB connector And the RESET pin is shared with UPDI and has a whole circiutry connected to it, that may interfere with UPDI programming.

image

You need to have a fresh Attiny1604 without additional components soldered to the UPDI pin, to make this work. I don't think that is what you have.

Dasduino lite schematic.pdf

SpenceKonde commented 6 months ago

For UPDI to work with that board you need to

  1. Ensure that JP1 (autoreset) is not connected
  2. Ensure that you connect the wires in the correct order. The pin order there is bad; it violates basic principles of applied murphology* and sets a trap for customers. The correct order is to have Gnd in the middle, so that even if you get the connector backwards, you're swapping Vcc and UPDI, which is unlikely to cause hardware damage. That board puts UPDI in the middle, so that if you get the connector backwards, Vcc and Gnd are reversed. This is invariably fatal to the chip, and often lets out smoke.

That whole board appears to have made a large number of poor design decisions.

But that updi header, jeez. I guess that's one way to ensure repeat business!

* Applied Murphology: Consideration of murphy's law and it's ramifications as an integral part of the design process. If anything can go wrong, it will; Over a large enough sample everything that can go wrong will, most many times. Therefor consideration should always be given to "How likely is it for this thing to go wrong? Plugging a connector in backwards when it's not polarized is very easy, and so if its often connected or disconnected, you assume it will be connected backwards routinely for indefinite lengths of time. In this case we would consider that there are three pin orderings (each of which can be reversed):

fritzlb commented 5 months ago

From the picture of your serial adapter it seems like that thing has got LEDs for RX/TX. As per documentation, in case the RX LED just shorts the RX line over a resistor to VCC, that won’t work with UPDI.