ZakKemble / AVRDUDESS

A GUI for AVRDUDE
https://blog.zakkemble.net/avrdudess-a-gui-for-avrdude/
GNU General Public License v3.0
594 stars 128 forks source link

Improve MCU auto-detect #26

Open ZakKemble opened 5 years ago

ZakKemble commented 5 years ago

MCU auto-detect doesn't always work, depending on the programmer and MCU programming interface.

Auto-detect works by running avrdude with the chosen programmer and MCU set to ATmega8, since avrdude needs to have an MCU set before it will do anything. It then reports the device signature which we use to work out what MCU we're really talking to. But this doesn't always work, for example, if an ATtiny10 is connected to an USBasp then auto-detect will fail because it is expecting an MCU with the usual SPI programming interface, but the ATtiny10 uses TPI.

This can probably be fixed by going through a list of MCUs that have different interfaces until one works and reports its signature. ATmega8 (SPI) -> ATtiny202 (UPDI) -> ATtiny10 (TPI) -> ATxmega16A4U (PDI) -> DebugWire? -> JTAG?

Ser9ei commented 3 years ago

may be a drop down "listbox" with list of interfaces can help us. (with spi as default value)

EclipseBoom commented 3 years ago

I downloaded the latest AVRDudess. The CPU list doesn't include these late model Tiny parts. I had to manually update to the latest AVRDude and .conf files. Then it listed the CPU but even when manually picking the CPU from the list it doesn't put the proper -p in there. At least that was my experience.

ZakKemble commented 3 years ago

@EclipseBoom Yes, that is expected. Auto-detect tries to automatically detect the MCU for you, but it currently only works with parts that use the SPI programming interface. Selecting an MCU first will not change how auto-detect works.

EclipseBoom commented 3 years ago

OK that seems odd. Why can't you force the CPU choice? If I accidentally put in the wrong CPU say from an old version of hardware I don't want the software to autodetect that CPU and override my choice and just use it.

If I choose a CPU I want it to error out if I put connect a different one to the programmer not just change the CPU setting and program away. This is what MicrochipStudio and AVRStudio do. This is an actual case with ATMega168PB vs ATMega168PA chips. The PB chips don't work and the PA do. So if I mistakenly mount a PB I don't want to program it and have it verify etc. I also have some ATtiny1616 mounted and some ATtiny1626. Same PCB different CPU that isn't software compatible but you can load the HEX file for the 1626 into the 1616.

ZakKemble commented 3 years ago

The whole idea of auto-detect is to simply detect what MCU you have your programmer connected to and automatically select it from the drop-down list. If you don't want it to override your chosen MCU then don't click on the auto-detect button. If you have a different microcontroller connected from the one you selected it will return an error when you attempt to program or read it.

It is not meant to be used as a way of verifying the connection to the microcontroller.

EclipseBoom commented 3 years ago

MicrochipStudio has a button for "Read" Device Sig that will do a check to see if the attached CPU matches the chosen unit.

ZakKemble commented 3 years ago

Ok, so you're asking for a new feature that only verifies that the connected microcontroller is the correct part. I'll add it to the todo list, but I've no idea when it'll be added.

harryberlin commented 3 years ago

i mean avrdude should do this already. check the args for avrdude.

ZakKemble commented 3 years ago

Yes, avrdude can read just the signature if only the programmer and MCU parameters are passed to it (that's how the auto-detect feature works), but AVRDUDESS still needs a new button or something for the feature requested by @EclipseBoom where it just makes sure that the microcontroller matches the selected part.

zydl123 commented 2 years ago

I used the ft245bl programmer, but the software couldn't find it FT245BL.txt

fsmoke commented 2 years ago

Also i want to add - better use t13 but not m8 MCU for detect - because m8 not support HVSP programming mode see log

avrdude.exe: stk500hv_initialize(): high-voltage serial programming control stack not defined for part "ATmega8"
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

So you must test MCU 3 times - for TPI interface, for HVSP interface(like tiny13) and HVPP Interface(like mega8)

rompipelotas commented 6 months ago

is it possible with avrdudess to read lgt8f328??