microchip-pic-avr-tools / pymcuprog

a Python utility for programming various Microchip MCU devices using Microchip CMSIS-DAP based debuggers
MIT License
104 stars 22 forks source link

MCP2221 #22

Closed DC1MBY closed 2 years ago

DC1MBY commented 2 years ago

Did anybody program successfully over UPDI with an MCP2221? I'd like to use MCP2221 in an project together with atmega4809. I'm running Win10 and get the following error:

pymcuprog erase -t uart -u COM6 -d atmega4809 pymcuprog.serialupdi.link - WARNING - Check failed pymcuprog.serialupdi.link - WARNING - Check failed Traceback (most recent call last): File "c:\users\xxx\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\xxx\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\Scripts\pymcuprog.exe__main.py", line 7, in File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\pymcuprog.py", line 285, in main return pymcuprog_main.pymcuprog(arguments) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\pymcuprog_main.py", line 80, in pymcuprog status = _start_session(backend, device_selected, args) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\pymcuprog_main.py", line 549, in _start_session backend.start_session(sessionconfig) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\backend.py", line 366, in start_session sessionconfig.interface_speed) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\programmer.py", line 83, in setup_device options=self.options) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\nvm.py", line 42, in get_nvm_access_provider accessprovider = NvmAccessProviderSerial(transport, device_info, baud=frequency, options=options) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\nvmserialupdi.py", line 51, in init self.avr = UpdiApplication(port, baud, self.dut) File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\serialupdi\application.py", line 81, in init__ datalink.init_datalink() File "c:\users\xxx\appdata\local\programs\python\python36\lib\site-packages\pymcuprog\serialupdi\link.py", line 45, in init_datalink raise PymcuprogError("UPDI initialisation failed") pymcuprog.pymcuprog_errors.PymcuprogError: UPDI initialisation failed

pymcuprog --version pymcuprog version 3.10.2.133

DC1MBY commented 2 years ago

I found the explanation for the behavior here: https://github.com/SpenceKonde/AVR-Guidance/blob/master/UPDI/jtag2updi.md

"The UPDI protocol uses parity and 2 stop bits (parity can be disabled by a control register flag, but you need to access UPDI in the default mode using parity to change this). Adapters that do not support parity or 2 stop bits, such as the MCP2200 and MCP2221, cannot be used."

Looks like it is not possible to use MCP2221 for UPDI because it only supports 8N1.