Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVR910 programmer enhancment to support more parts #1060

Closed
mcuee opened this issue Aug 9, 2022 · 106 comments
Closed

AVR910 programmer enhancment to support more parts #1060

mcuee opened this issue Aug 9, 2022 · 106 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mcuee
Copy link
Collaborator

mcuee commented Aug 9, 2022

Just got a serial port AVR910 prog (based on AT902313 and use some passive components for the serial interface) from AliExpress (along with a serial port based SI-Prog).

Currently avr910 only supports limited parts. Alternative PC applications like AVROSP2 supports many more parts. Microchip/Atmel original avrosp can support more parts as well with the proper xml files.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c avr910 -P COM5 -b 115200 -qqp m328p
Found programmer: Id = "AVR ISP"; type = S
    Software Version = 3.8; Hardware Version = 1.2
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize = 64 bytes.

Programmer supports the following devices:
    Device code: 0x13 = AT90S1200
    Device code: 0x20 = AT90S2313
    Device code: 0x28 = AT90S4414
    Device code: 0x30 = AT90S4433
    Device code: 0x34 = AT90S2333
    Device code: 0x38 = AT90S8515
    Device code: 0x48 = (unknown)
    Device code: 0x4c = AT90S2343
    Device code: 0x51 = (unknown)
    Device code: 0x55 = ATtiny12
    Device code: 0x56 = ATtiny15
    Device code: 0x68 = AT90S8535
    Device code: 0x6c = AT90S4434
    Device code: 0xffffff86 = (unknown)
    Device code: 0xffffff87 = (unknown)
    Device code: 0x04 = (unknown)
    Device code: 0x05 = (unknown)
    Device code: 0x06 = (unknown)
    Device code: 0x07 = (unknown)
    Device code: 0x1a = (unknown)
    Device code: 0x1b = (unknown)
    Device code: 0x1c = (unknown)
    Device code: 0x1d = (unknown)
    Device code: 0x23 = (unknown)
    Device code: 0x31 = (unknown)
    Device code: 0x33 = (unknown)
    Device code: 0x37 = (unknown)
    Device code: 0x39 = (unknown)
    Device code: 0x3d = (unknown)
    Device code: 0x3e = (unknown)
    Device code: 0x3a = ATmega8515
    Device code: 0x3b = (unknown)
    Device code: 0x41 = ATmega103
    Device code: 0x43 = ATmega128
    Device code: 0x44 = (unknown)
    Device code: 0x45 = ATmega64
    Device code: 0x46 = (unknown)
    Device code: 0x5e = ATtiny26
    Device code: 0x60 = ATmega161
    Device code: 0x61 = (unknown)
    Device code: 0x62 = (unknown)
    Device code: 0x63 = ATmega162
    Device code: 0x64 = ATmega163
    Device code: 0x66 = (unknown)
    Device code: 0x69 = ATmega8535
    Device code: 0x6a = (unknown)
    Device code: 0x72 = ATmega32
    Device code: 0x73 = (unknown)
    Device code: 0x74 = ATmega16
    Device code: 0x75 = ATmega329
    Device code: 0x76 = ATmega8
    Device code: 0x77 = (unknown)
    Device code: 0x78 = ATmega169
    Device code: 0x79 = (unknown)

avrdude.exe: error: selected device is not supported by programmer: m328p
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
@mcuee mcuee added the enhancement New feature or request label Aug 9, 2022
@mcuee
Copy link
Collaborator Author

mcuee commented Aug 9, 2022

For example, with the xml files from the archive here, the original Microchip AVROSP.exe seems to work with ATmega328P (quite slow though). I verified with USBASP as well.
https://avr.ru/tools/avrosp
https://avr.ru/int/Files/Dounload/instruments/AvrOspII.rar

PS C:\work\avr\avrdude_test\others\avr910\AVR911\bin> .\AVROSP -dATmega328p -ofm328p -rf
AVR Open-source Programmer $Revision: 1163 $ (C) 2004 Atmel Corp.

Serial port timeout set to 5 sec.
Scanning COM ports for supported programmer...
COM1...
COM2...
COM3...
COM4...
COM5...
Found AVR ISP on COM5!
Entering programming mode...
Parsing XML file for device parameters...
Parsing '.\ATmega328p.xml'...
#################################
...
Saving cached XML parameters...
Signature matches device!
Reading Flash contents...
#################################
...
Writing HEX output file...
#################################
...
Leaving programming mode...

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c usbasp -qqp m328p
 -U flash:v:m328p.hex:i && echo OK
OK

The xml files from this github repo has even more parts (193 parts, including xmega parts).
https://github.com/Mes-ser/xplained-easy-config

c:\work\avr\avrdude_test\others\avr910\AVR911\bin>ls *.xml
AT86RF401.xml      ATmega164PA.xml   ATmega32U6.xml   ATtiny25.xml
AT89S51.xml        ATmega165.xml     ATmega406.xml    ATtiny26.xml
AT89S52.xml        ATmega165A.xml    ATmega48.xml     ATtiny261.xml
AT90CAN128.xml     ATmega165P.xml    ATmega48A.xml    ATtiny261A.xml
AT90CAN32.xml      ATmega165PA.xml   ATmega48P.xml    ATtiny28.xml
AT90CAN64.xml      ATmega168.xml     ATmega48PA.xml   ATtiny4.xml
AT90PWM1.xml       ATmega168A.xml    ATmega64.xml     ATtiny40.xml
AT90PWM2.xml       ATmega168P.xml    ATmega640.xml    ATtiny4313.xml
AT90PWM216.xml     ATmega168PA.xml   ATmega644.xml    ATtiny43U.xml
AT90PWM2B.xml      ATmega169.xml     ATmega644A.xml   ATtiny44.xml
AT90PWM3.xml       ATmega169A.xml    ATmega644P.xml   ATtiny44A.xml
AT90PWM316.xml     ATmega169P.xml    ATmega644PA.xml  ATtiny45.xml
AT90PWM3B.xml      ATmega169PA.xml   ATmega645.xml    ATtiny461.xml
AT90PWM81.xml      ATmega16A.xml     ATmega6450.xml   ATtiny461A.xml
AT90S1200.xml      ATmega16HVA.xml   ATmega6450A.xml  ATtiny48.xml
AT90S2313.xml      ATmega16HVA2.xml  ATmega645A.xml   ATtiny5.xml
AT90S2323.xml      ATmega16HVB.xml   ATmega649.xml    ATtiny84.xml
AT90S2343.xml      ATmega16M1.xml    ATmega6490.xml   ATtiny84A.xml
AT90S4414.xml      ATmega16U2.xml    ATmega6490A.xml  ATtiny85.xml
AT90S4433.xml      ATmega16U4.xml    ATmega649A.xml   ATtiny861.xml
AT90S4434.xml      ATmega2560.xml    ATmega649P.xml   ATtiny861A.xml
AT90S8515.xml      ATmega2561.xml    ATmega64A.xml    ATtiny87.xml
AT90S8515comp.xml  ATmega32.xml      ATmega64C1.xml   ATtiny88.xml
AT90S8535.xml      ATmega323.xml     ATmega64HVE.xml  ATtiny9.xml
AT90S8535comp.xml  ATmega324A.xml    ATmega64M1.xml   ATxmega128A1.xml
AT90SCR100H.xml    ATmega324P.xml    ATmega8.xml      ATxmega128A3.xml
AT90USB1286.xml    ATmega324PA.xml   ATmega8515.xml   ATxmega128A3U.xml
AT90USB1287.xml    ATmega325.xml     ATmega8535.xml   ATxmega128D3.xml
AT90USB162.xml     ATmega3250.xml    ATmega88.xml     ATxmega16A4.xml
AT90USB646.xml     ATmega3250P.xml   ATmega88A.xml    ATxmega16A4U.xml
AT90USB647.xml     ATmega3250PA.xml  ATmega88P.xml    ATxmega16D4.xml
AT90USB82.xml      ATmega325A.xml    ATmega88PA.xml   ATxmega192A3.xml
ATA6289.xml        ATmega325P.xml    ATmega8A.xml     ATxmega192A3U.xml
ATmega103.xml      ATmega325PA.xml   ATmega8HVA.xml   ATxmega192D3.xml
ATmega103comp.xml  ATmega328.xml     ATmega8U2.xml    ATxmega256A3.xml
ATmega128.xml      ATmega328P.xml    ATtiny10.xml     ATxmega256A3B.xml
ATmega1280.xml     ATmega329.xml     ATtiny11.xml     ATxmega256A3BU.xml
ATmega1281.xml     ATmega3290.xml    ATtiny12.xml     ATxmega256A3U.xml
ATmega1284.xml     ATmega3290P.xml   ATtiny13.xml     ATxmega256D3.xml
ATmega1284P.xml    ATmega3290PA.xml  ATtiny13A.xml    ATxmega32A4.xml
ATmega128A.xml     ATmega329A.xml    ATtiny15.xml     ATxmega32A4U.xml
ATmega128RFA1.xml  ATmega329P.xml    ATtiny1634.xml   ATxmega32D4.xml
ATmega16.xml       ATmega329PA.xml   ATtiny167.xml    ATxmega64A1.xml
ATmega161.xml      ATmega32A.xml     ATtiny20.xml     ATxmega64A3.xml
ATmega161comp.xml  ATmega32C1.xml    ATtiny22.xml     ATxmega64A3U.xml
ATmega162.xml      ATmega32HVB.xml   ATtiny2313.xml   ATxmega64D3.xml
ATmega163.xml      ATmega32M1.xml    ATtiny2313A.xml
ATmega164A.xml     ATmega32U2.xml    ATtiny24.xml
ATmega164P.xml     ATmega32U4.xml    ATtiny24A.xml

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 9, 2022

@dl8dtl

I understand that AVR910 based programmers have largely been replaced with more modern programmers (eg: USBASP, USBtinyISP, etc), even though AVR109 based bootloaders seem to be still popular (but not as popular as STK500v1/v2 based bootloaders).

If you think there is no point doing this, then I will close the issue as not planned.

@dl8dtl
Copy link
Contributor

dl8dtl commented Aug 9, 2022

Well, I have no real opinion on that. The only AVR910 programmer I know of is the bootloader (actually, a separate chip, used to be AT90S1200, later ATtiny2313) on the STK500.

If one can still by them at Aliexpress, it might be worth the while. Biggest issue IIRC is that the protocol uses a single byte to identify the target controller, and that single ID byte has only ever been standardized for very old AVRs.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 9, 2022

I bought the serial AVR910 from AliExpress: the thing is rather cheap but shipping is rather expensive compared to the part cost. The good thing is that there is a jumper for you to upgrade the FW of the ATtiny2313.
https://www.aliexpress.com/item/555008131.html

BTW, I bought the other three low cost items from the same shop.

  1. SI-Prog from the same shop and it seems to work with avrdude as well.
    https://www.aliexpress.com/item/555027336.html

  2. The STK500v2 clone is not bad and works fine, using CH340C (built-in oscillator), 74HC165D and the main MCU ATmega8535 (same main MCU as the real STK500).
    https://www.aliexpress.com/item/554989751.html

  3. Then I also got the low cost cheap AVRISP mkii compatible programmer from the same shop and expect it to be a low cost ATmega8A based clone and expected not work under Windows 10/11. And indeed it is true (using ATmega8A and low speed CDC-ACM V-USB based implemenation). It seems to work under Linux though. Not really worth buying -- I am just getting it for curiosity.
    https://www.aliexpress.com/item/32687012093.html

Pictures of the 4.
avrdude_programmers

BTW, I have ordered another USB AVR910 from Taobao and it is quite a bit more expensive (still on the way). I believe it is similar to the following AliExpress item and based on ATmega8535. Not really worth buying -- I am just getting it for testing avrdude.
https://www.aliexpress.com/item/1267121534.html

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 9, 2022

I think we should make sure we at least can support targets that have an "established" AVR910 device code.

@mcuee do you know if there exist other AVR910 implementations other than the official one?

avrdude.conf.in contains a list of various AVR910 device codes. However, it seems like some devices have multiple device codes. I'm not sure what's correct here.

Here's what I suggest we do:

  • Track down "every" AVR910 compatible bootloader that's out there and most likely still being used
  • Figure out as many device codes as possible for known parts, and ignore parts that don't have an established device code. If a target has two known device codes (ATmega8535 for instance), avrdude should be updated to support both.
  • Clean up avrdude.conf and remove all invalid or commented out avr910_devcode lines, and perhaps update the header where all the device codes are listed.

From avrdude.conf:

# The following table lists the devices in the original AVR910
# appnote:
# |Device |Signature | Code |
# +-------+----------+------+
# |tiny12 | 1E 90 05 | 0x55 |
# |tiny15 | 1E 90 06 | 0x56 |
# |       |          |      |
# | S1200 | 1E 90 01 | 0x13 |
# |       |          |      |
# | S2313 | 1E 91 01 | 0x20 |
# | S2323 | 1E 91 02 | 0x48 |
# | S2333 | 1E 91 05 | 0x34 |
# | S2343 | 1E 91 03 | 0x4C |
# |       |          |      |
# | S4414 | 1E 92 01 | 0x28 |
# | S4433 | 1E 92 03 | 0x30 |
# | S4434 | 1E 92 02 | 0x6C |
# |       |          |      |
# | S8515 | 1E 93 01 | 0x38 |
# | S8535 | 1E 93 03 | 0x68 |
# |       |          |      |
# |mega32 | 1E 95 01 | 0x72 |
# |mega83 | 1E 93 05 | 0x65 |
# |mega103| 1E 97 01 | 0x41 |
# |mega161| 1E 94 01 | 0x60 |
# |mega163| 1E 94 02 | 0x64 |

# Appnote AVR109 also has a table of AVR910 device codes, which
# lists:
# dev         avr910   signature
# ATmega8     0x77     0x1E 0x93 0x07
# ATmega8515  0x3B     0x1E 0x93 0x06
# ATmega8535  0x6A     0x1E 0x93 0x08
# ATmega16    0x75     0x1E 0x94 0x03
# ATmega162   0x63     0x1E 0x94 0x04
# ATmega163   0x66     0x1E 0x94 0x02
# ATmega169   0x79     0x1E 0x94 0x05
# ATmega32    0x7F     0x1E 0x95 0x02
# ATmega323   0x73     0x1E 0x95 0x01
# ATmega64    0x46     0x1E 0x96 0x02
# ATmega128   0x44     0x1E 0x97 0x02
#
# These codes refer to "BOOT" device codes which are apparently
# different than standard device codes, for whatever reasons
# (often one above the standard code).

# There are several extended versions of AVR910 implementations around
# in the Internet.  These add the following codes (only devices that
# actually exist are listed):

# ATmega8515	0x3A
# ATmega128	0x43
# ATmega64	0x45
# ATtiny26	0x5E
# ATmega8535	0x69
# ATmega32	0x72
# ATmega16	0x74
# ATmega8	0x76
# ATmega169	0x78

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 9, 2022

I think we should make sure we at least can support targets that have an "established" AVR910 device code.

@mcuee do you know if there exist other AVR910 implementations other than the official one?

I think most of the AVR910 implemnetations are quite closely based on the official one mentioned above in terms of both core HW (AVR910 AN Figure 4-1) and FW.
HW Eg: https://mechatronics.me.wisc.edu/labresources/schemsNmans/STK500_Schematics.pdf (Page6/7): AVR910 implemetation in STK500 using AT90S1200/ATtiny2313. This is for the FW upgrade/downgrade of the main AT90S8535/ATmega8535.
FW Eg: https://sourceforge.net/projects/avr10-firmware/

In terms of HW, there are new ones with USB to Serial converter to replace the serial interface. Then there are some implementations with a bit more features like opto isolation. Most of them still use AT90S1200/ATtiny2313.
Eg: http://www.deep-shadows.com/hax/wordpress/?page_id=793 (opto isolated)

There are also V-USB based implementation using ATmega8/8A/8L. This kind of implementation will usually not working under Windows 10/11 due to the use of low speed bulk transfer (USB CDC-ACM, not compliant to USB spec) even though they may work with Linux. I am not so sure if any of them use USB HID to work under Windows 10/11.
https://simplemetaldetector.com/programmers/avr-910-programmer/
https://320volt.com/en/avr910-usb-avr-programlayici-ponyprog/
Ref on avrcdc: http://www.recursion.jp/prose/avrcdc/

Very rare high cost implementation is based on USB Serial chip plus ATmega8535. This is very much similar to STK500 already and I was quite surprised to see such implementation from a Chinese vendor (which also produce the STK500 High Voltage programmer based on either ATmega8535 or an STC 8051 MCU). That is why I ordered it even though they raised the price by about about US$3 due to chip shortage.

In terms of PC application, the original official one from Atmel is AVRprog.exe in AVR Studio 3.x and 4.x. Atmel kept it for the FW upgrading of tools like STK500 and JTAG ICE 1. I was actullly using it today trying to revive my dead JTAG ICE 1 clone (FW seems to be corrupted) but unfortunately failed.

Then after that there is the official AVR911 (AVROSP) PC application from Atmel, and other implementations like AVROSP2. It seems that quite some xml files have been created for AVROSP, as shown here.
https://github.com/Mes-ser/xplained-easy-config

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 9, 2022

I've created a simple table where I've gathered all known AVR910 device codes. It looks like no part has more than two known device codes, and all of them are unique, which definitely helps. The problem is that the AVR910 programmer has to be aware of all the device codes.

Target Official devcode Alternative devcode 1 Alternative devcode 2
AT90S1200 0x13
AT90S2313 0x20
AT90S2323 0x48
AT90S2333 0x34
AT90S2343 0x4C
AT90S4414 0x28
AT90S4433 0x30
AT90S4434 0x6C
AT90S8515 0x38
AT90S8535 0x68
ATmega8 0x77 0x76
ATmega16 0x75 0x74
ATmega32 0x72 0x7F
ATmega64 0x46 0x45
ATmega83 0x65
ATmega103 0x41
ATmega128 0x44 0x43
ATmega161 0x60
ATmega162 0x63
ATmega163 0x64 0x66
ATmega169 0x79 0x78
ATmega323 0x73
ATmega8515 0x3B 0x3A
ATmega8535 0x6A 0x69
ATtiny12 0x55
ATtiny15 0x56
ATtiny26 0x5E

The only AVR910 bootloader alternative I've found is USBVirtualSerial-AVRISP, which can be downloaded here: https://code.google.com/archive/p/avropendous/downloads

The bootloader can only store 14 device codes, and suggest using Avrdude's -F flag:

From USBVirtualSerial-AVRISP.h

		/*  AVR Device Codes - Can have a maximum of 14 but can be any you want.
		    Note that these are completely irrelevent.  If AVRdude supports a device,
		    then that device is programmable.  Use -F switch to ignore device codes. */
		#define AVRDEVCODE01	0x55 /* ATtiny12 */
		#define AVRDEVCODE02	0x56 /* ATtiny15 */
		#define AVRDEVCODE03	0x5E /* ATtiny261 */
		#define AVRDEVCODE04	0x76 /* ATmega8 */
		#define AVRDEVCODE05	0x74 /*ATmega16 */
		#define AVRDEVCODE06	0x72 /* ATmega32 */
		#define AVRDEVCODE07	0x45 /* ATmega64 */
		#define AVRDEVCODE08	0x74 /* ATmega644 */
		#define AVRDEVCODE09	0x43 /* ATmega128 */
		#define AVRDEVCODE10	0x63 /* ATmega162 */
		#define AVRDEVCODE11	0x78 /* ATmega169 */
		#define AVRDEVCODE12	0x6C /* AT90S4434 */
		#define AVRDEVCODE13	0x38 /* AT90S8515A */
		#define AVRDEVCODE14	0x65 /* AT90S8555 */

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 10, 2022

The original AVRProg.exe seems to have the "BOOT" device mentioned. Probably because it supports both AVR109 and AVR910. Replacement of AVRProg is AVROSP (AVR911).

 # These codes refer to "BOOT" device codes which are apparently
 # different than standard device codes, for whatever reasons
 # (often one above the standard code).

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 10, 2022

BTW, the following is from AVROSP2 5.47 version (last release from Mike Henning).
https://xdevs.com/doc/xDevs.com/M16/AVROSP2/Osp2Boot.asm

It seems to support Osp2 protocol along with AVR911 (AVR109/AVR910). I guess that osp2 bootloader protocol is not popular and not supported by avrdude.

@newmguy
Copy link

newmguy commented Aug 15, 2022

I would love to see avr910 support modern devices with avrdude (instead of using avrospII.exe in windows).
IIRC, AVROSPII supports whatever devices are present in your avrstudio installation and updates devicelist.dat based on AVRstudios supported devices.

I can modify the avr910 firmware easily, just knowing what codes to implement for each device or just to satisfy avrdude is the difficult thing for me.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 19, 2022

Just got a USB AVR910 programmer and it is actually not too slow.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c avr910 -P COM3 -p m32 -U flash:r:m32demo_usb_avr910_read.hex:i

Found programmer: Id = "AVR ISP"; type = S
    Software Version = 3.8; Hardware Version = 1.2
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize = 64 bytes.

Programmer supports the following devices:
    Device code: 0x13 = AT90S1200
    Device code: 0x20 = AT90S2313
    Device code: 0x28 = AT90S4414
    Device code: 0x30 = AT90S4433
    Device code: 0x34 = AT90S2333
    Device code: 0x38 = AT90S8515
    Device code: 0x48 = (unknown)
    Device code: 0x4c = AT90S2343
    Device code: 0x51 = (unknown)
    Device code: 0x55 = ATtiny12
    Device code: 0x56 = ATtiny15
    Device code: 0x68 = AT90S8535
    Device code: 0x6c = AT90S4434
    Device code: 0xffffff86 = (unknown)
    Device code: 0xffffff87 = (unknown)
    Device code: 0x01 = (unknown)
    Device code: 0x04 = (unknown)
    Device code: 0x05 = (unknown)
    Device code: 0x06 = (unknown)
    Device code: 0x07 = (unknown)
    Device code: 0x08 = (unknown)
    Device code: 0x09 = (unknown)
    Device code: 0x0e = (unknown)
    Device code: 0x1a = (unknown)
    Device code: 0x0f = (unknown)
    Device code: 0x1b = (unknown)
    Device code: 0x14 = (unknown)
    Device code: 0x1c = (unknown)
    Device code: 0x1d = (unknown)
    Device code: 0x23 = (unknown)
    Device code: 0x31 = (unknown)
    Device code: 0x33 = (unknown)
    Device code: 0x35 = (unknown)
    Device code: 0x37 = (unknown)
    Device code: 0x39 = (unknown)
    Device code: 0x3d = (unknown)
    Device code: 0x3e = (unknown)
    Device code: 0x57 = (unknown)
    Device code: 0x3a = ATmega8515
    Device code: 0x3b = (unknown)
    Device code: 0x41 = ATmega103
    Device code: 0x43 = ATmega128
    Device code: 0x44 = (unknown)
    Device code: 0x45 = ATmega64
    Device code: 0x46 = (unknown)
    Device code: 0x5e = ATtiny26
    Device code: 0x60 = ATmega161
    Device code: 0x61 = (unknown)
    Device code: 0x62 = (unknown)
    Device code: 0x63 = ATmega162
    Device code: 0x64 = ATmega163
    Device code: 0x66 = (unknown)
    Device code: 0x69 = ATmega8535
    Device code: 0x6a = (unknown)
    Device code: 0x72 = ATmega32
    Device code: 0x73 = (unknown)
    Device code: 0x74 = ATmega16
    Device code: 0x75 = ATmega329
    Device code: 0x76 = ATmega8
    Device code: 0x77 = (unknown)
    Device code: 0x78 = ATmega169
    Device code: 0x79 = (unknown)

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude.exe: Device signature = 0x1e9502 (probably m32)
avrdude.exe: reading flash memory ...

Reading | ################################################## | 100% 19.79s

avrdude.exe: writing output file m32demo_usb_avr910_read.hex

avrdude.exe done.  Thank you.

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 19, 2022

@mcuee do have the source code or at least a list of the targets the programmer supports, so we can figure out what all the unknown targets are?

As I stated in a previous post, a single part may have one or two device codes. It would be great if Avrdude could support both, and send the one the programmer wants. However, How can Avrdude know what code the programmer wants if there's more than one to choose from?

For instance, @mcuee's programmer supports 0x76 (atmega8), but also 0x77 (unknown, but probably atmega8?).

@avrfreak
Copy link

avrfreak commented Aug 20, 2022

The latest source code I've seen for avr910 is V38B and it's in asm. Looking at the post above it appears that is the version in the programmer you just received.

I understand the reason avrospII programs modern devices using an avr910 programmer is because it ignores the device codes sent out from the avr910 programmer and uses the universal 4 bytes SPI packets.

So correct me if I am wrong, I think the only way to make this work is to modify avrdude to program the same way (like avrospII).

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 20, 2022

@MCUdude
I am trying to get the source codes of my USB AVR910 programmer -- the vendor is telling me they will send me the codes soon. As for the chips it supports, then the vendor is basically saying that I can use two applications.

  1. AVRprog from Atmel Studio, with very limit chip support (supported by the vendor)
  2. avrosp or similar -- not supported by the vendor

There are many different avr910 firmware codes, most of them are following Microchip and use AT90S1200/ATtiny2313.

The one I find from Microchip is probably version 23 for AT90S1200. I belive they use the same code and hex file for the ATtiny2313 when they upgrade the HW for STK500 (AT90S1200--> ATtiny2313; AT90S8535 --> ATmega8535).

;***************************************************************************
;*
;* Title	: AVR ISP (Auto adr inc, 19200bps)
;* Version	: 2.3
;* Last updated	: 13 mar 2000 (arodland)
;* Target	: AT90S1200
;* File		: avr910.asm
;* Author(s)	: Ole Saether, Terje Frostad,
;*		  Ingar Fredriksen, Morten W. Lund
;*                Haakon Skar, Paal Kastnes
;*
;* DESCRIPTION
;*	The firmware on all programmers now support a unified protocol for 
;*	program and data memory programming. The host computer do not need
;*	to know if the programmer operates in serial or parallel mode.
;*
;*	The following commands are supported. All commands start with a
;*	single letter. The programmer returns 13d (carriage return) or the
;*	data read after the command is finished.
;*
;*                                     +-------------+------------+------+
;*  Commands                           | Host writes | Host reads |      |
;*  --------                           +-----+-------+------+-----+      |
;*                                     | ID  | data  | data |     | Note |
;* +-----------------------------------+-----+-------+------+-----+------+
;* | Enter programming mode            | 'P' |       |      | 13d |   1  |
;* | Report autoincrement address      | 'a' |       | 	    | 'Y' |      |
;* | Set address                       | 'A' | ah al |      | 13d |   2  |
;* | Write program memory, low byte    | 'c' |    dd |      | 13d |   3  |
;* | Write program memory, high byte   | 'C' |    dd |      | 13d |   3  |
;* | Issue Page Write                  | 'm' |       |      | 13d |      |
;* | Read program memory               | 'R' |       |dd(dd)|     |   4  |
;* | Write data memory                 | 'D' |    dd |      | 13d |      |
;* | Read data memory                  | 'd' |       |   dd |     |      |
;* | Chip erase                        | 'e' |       |      | 13d |      |
;* | Write lock bits                   | 'l' |    dd |      | 13d |      |
;* | Write fuse bits                   | 'f' |    dd |      | 13d |  11  |
;* | Read fuse and lock bits           | 'F' |       |   dd |     |  11  |
;* | Leave programming mode            | 'L' |       |      | 13d |   5  |
;* | Select device type                | 'T' |    dd |      | 13d |   6  |
;* | Read signature bytes              | 's' |       | 3*dd |     |      |
;* | Return supported device codes     | 't' |       | n*dd | 00d |   7  |
;* | Return software identifier        | 'S' |       | s[7] |     |   8  |
;* | Return sofware version            | 'V' |       |dd dd |     |   9  |
;* | Return hardware version           | 'v' |       |dd dd |     |   9  |
;* | Return programmer type            | 'p' |       |   dd |     |  10  |
;* | Set LED                           | 'x' |    dd |      | 13d |  12  |
;* | Clear LED                         | 'y' |    dd |      | 13d |  12  |
;* | Universial command                | ':' |  3*dd |   dd | 13d |      |
;* | New universal command	       | '.' |  4*dd |   dd | 13d |      |
;* | Special test command	       | 'Z' |  2*dd |   dd |     |      |
;* +-----------------------------------+-----+-------+------+-----+------+
;*
;* NOTE 1
;*	The Enter programming mode command MUST be sent one time prior to
;*	the other commands, with the exception of the 't', 'S', 'V', 'v'
;*	and 'T' commands. The 'T' command must be sent before this command
;*	(see note 6).
;*
;*	For programmers supporting both parallel and serial programming
;*	mode this command enters parallel programming mode. For programmers
;*	supporting only serial programming mode, this command enters serial
;*	programming mode.
;*
;* NOTE 2
;*	The ah and al are the high and low order bytes of the address. For
;*	parallel programmers this command issues the Load Address Low/High
;*	Byte command. For serial programmers the address byte is stored for
;*	use by the Read/Write commands.
;*
;* NOTE 3
;*	For parallel programmers this command issues the Program Flash
;*	command. For serial programmers this command iussues the Write
;*	Program Memory Command. For devices with byte-wide program memories
;*	only the low byte command should be used.
;*
;* NOTE 4
;*	The contents of the program memory at the address given by the 'A'
;*	command are written to the serial port in binary form. For byte
;*	wide memories one byte is written. For 16 bit memories two bytes
;*	are written,MSB first.
;*
;* NOTE 5
;*	This command must be executed after the programming is finished.
;*
;* NOTE 6
;*	The select device type command must be sent before the enter
;*	programming command
;*
;* NOTE 7
;*	The supported device codes are returned in binary form terminated
;*	by 0x00.
;*
;* NOTE 8
;*	This return a 7 character ASCII string identifying the programmer.
;*	For the development board it is "AVR DEV", for the parallel
;*	programmer it is "AVR PPR" and for the in-curcuit programmer it is
;*	"AVR ICP".
;*
;* NOTE 9
;*	The software/hardware version are returned as two ASCII numbers.
;*
;* NOTE 10
;*	This command should be used to identify the programmer type. The
;*	return value is 'S' for serial (or SPI) programmers or 'P' for
;*	parallel programmers.
;*
;* NOTE 11
;*	The write fuse bits command are available only on parallel
;*	programmers and only for AVR devices (device code < 0x80). The host
;*	should use the return programmer type command to determine the
;*	programmer type, do not use the  "AVR PPR" idenifier because other
;*	programmers may be available in the future.
;*
;* NOTE 12
;*	Currently only the AVR development board has LEDs. The other boards
;*	must implement this commands as NOPs.
;*
;* NOTE 13
;*      Devices using Page Mode Programming write one page of flash memory
;*      before issuing a Page Mode Write Pulse.
;*
;* HISTORY
;*      V2.3    00.03.10 (pkastnes)     Added support for multiple new devices
;*	V2.1	98.10.26 (mlund)	New date marking.
;*					Removed support for AT90S1200C.
;*					Added support for AT90S4433A.
;*	V2.0	98.01.06 (mlund)	ATmega103 support
;*	V1.7	97.11.06 (mlund)	Universial command (':') implemented.
;*					Releases all pins when not in 
;*					programming mode.
;*	V1.6e	97.11.04 (mlund)	mega103 rev D support
;*	V1.6c	97.10.30 (mlund)	Auto incrementing / SPI sync
;*					also works for mega103.
;*      V1.6	97.09.09 (hskar)	Created Page Mode Version (mega103)
;*	V1.5	97.08.21 (mlund)	Modified / Bugfix / Major cleanup
;*	...	...			(no records)
;*	V?.?	97.03.15 (OS)		Created
;* 
;* 
;*		
;* Device Support List    
;* -------------------
;* 
;* +-------+----------+------+-------+------+------+------+-------+
;* |Device |Signature | Code | Flash |EEProm| Lock | Fuse | PMode |
;* +-------+----------+------+-------+------+------+------+-------+
;* |tiny12 | 1E 90 05 | 0x55 |  R/W  | R/W  | R/W  | R/W  | Byte  |
;* |tiny15 | 1E 90 06 | 0x56 |  R/W  | R/W  | R/W  | R/W  | Byte  |
;* |       |          |      |       |      |      |      |       |
;* | S1200 | 1E 90 01 | 0x13 |  R/W  | R/W  |  W   | NA   | Byte  |
;* |       |          |      |       |      |      |      |       |
;* | S2313 | 1E 91 01 | 0x20 |  R/W  | R/W  |  W   | NA   | Byte  |
;* | S2323 | 1E 91 02 | 0x48 |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* | S2333 | 1E 91 05 | 0x34 |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* | S2343 | 1E 91 03 | 0x4C |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* |       |          |      |       |      |      |      |       |
;* | S4414 | 1E 92 01 | 0x28 |  R/W  | R/W  |  W   | NA   | Byte  |    
;* | S4433 | 1E 92 03 | 0x30 |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* | S4434 | 1E 92 02 | 0x6C |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* |       |          |      |       |      |      |      |       |
;* | S8515 | 1E 93 01 | 0x38 |  R/W  | R/W  |  W   | NA   | Byte  |    
;* | S8535 | 1E 93 03 | 0x68 |  R/W  | R/W  | R/W  | R/W  | Byte  |    
;* |       |          |      |       |      |      |      |       |
;* |mega32 | 1E 95 01 | 0x72 |  R/W  | R/W  | R/W  | R/W  | Page  |
;* |mega83 | 1E 93 05 | 0x65 |  R/W  | R/W  | R/W  | R/W  | Page  |    
;* |mega103| 1E 97 01 | 0x41 |  R/W  | R/W  | R/W  | R/W  | Page  |    
;* |mega161| 1E 94 01 | 0x60 |  R/W  | R/W  | R/W  | R/W  | Page  |    
;* |mega163| 1E 94 02 | 0x64 |  R/W  | R/W  | R/W  | R/W  | Page  |    
;* +-------+----------+------+-------+------+------+------+-------+
;* 
;* LEGEND:
;* -------
;* Signature - Device Signature Byte
;* Code      - Unique device code used by AVRProg to identify device
;* Flash     - Flash size in bytes
;* EEProm    - EEProm size in bytes
;* Lock      - Lockbits
;* Fuse      - Fusebits
;* PMode     - Indicates if device uses byte or page programming mode
;* 
;* R/W - Read and Write Access
;* R   - Read Access Only
;* W   - Write Access Only
;* NA  - Not Accessible
;* 
;***************************************************************************

Then there are new FW (latest is v38b, Last updated 26-Feb-2006 ) which is based on Microchip implementations by Klaus Leidinger.
https://www.mikrocontroller.net/topic/14812
https://www.mikrocontroller.net/topic/12180
https://www.emsp.tu-berlin.de/fileadmin/fg232/Lehre/PjEle/Tools/avr910_2313_v38b.asm

Then the Sourceforge project "AVR ISP: AVR910 programmer firmware" which seems to be based on the above.
https://sourceforge.net/projects/avr10-firmware/files/avr10-firmware/ (v44, 07-Sept-2007)

Then there are other ports -- but most of them seem to be based on Klaus Leidinger's codes.

I agree with @avrfreak, it is probably good to ignore the device codes if we want to support many more chips like avrosp/avrospii.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 20, 2022

Just to archive the FW source codes from the above.
AVR910_Atmel_v23.zip
avr910_2313_v38b.zip
avr910_2313_v44.zip

@avrfreak
Copy link

Is this what you want?
http://www.prottoss.com/projects/AVR910.usb.prog/avr910_usb_programmer.htm
you will have to translate it.

I have the source if you can't find it, I can post it here.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 20, 2022

Is this what you want? http://www.prottoss.com/projects/AVR910.usb.prog/avr910_usb_programmer.htm you will have to translate it.

I have the source if you can't find it, I can post it here.

Thanks, I know this one you mentioned and I have downloaded the source as well. Take note it is using V-USB CDC and it will not work under Windows 10/11.

The USB AVR910 programmer I have is different. It is from a Chinese vendor using a proper USB serial chip and ATmega8535. They have STK500 HV programmer clone (using ATmega8535), AVRISP mkii and AVR Dragon clone. But the AVR Dragon clone do not no support of JTAG/DW.

@avrfreak
Copy link

avrfreak commented Aug 20, 2022

The USB AVR910 programmer I have is different. It is from a Chinese vendor using a proper USB serial chip and ATmega8535.

What USB chip is it using, a CH340G? If so, then there is no USB software to deal with. It's easy to adapt the avr910 code to use the atmega8535 or any other Atmega.

I can do it (but only in asm not C). The attiny2313 has a very small (64 byte) buffer for the data to be programmed. An Atmega would allow you to increase the buffer size which would speed up the programming.
I did this in 2019 for an atmega128. I have been using it reliably since then.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 20, 2022

@avrfreak

Thanks. Yes there is no USB SW to deal with as it is a USB to Serial bridge (PL2303HXA which is obsolete and I need to use an old driver -- I have suggested the vensor to switch to CH340G or similar for better driver support for their product).

It will be great that you can share your mod for ATmega128 and ATmega8535. Thanks.

@avrfreak
Copy link

Here is the avr910 source code for atmega8, atmega8535, atmega328p and atmega128.
The atmega328p and atmega128 are set up to run on a 14.7456 MHz crystal and can easily be modified.
Both the delay.inc and usart.inc files will need to be modified to suit the crystal you are using as well as the fuses for the device you are programming. See notes in the source.

I tested the atmega328p code on an arduino UNO with a CH340G and a 14.7456 MHz crystal.
I had to change the crystal on the arduino from 16MHz because the usart communication was bad at that speed.

The atmega8 & Atmega8535 sources are set up for use with a 7.3728 Mhz crystal.

910-m8.zip
910-m128.zip
910-m328p.zip
910-m8535.zip

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 21, 2022

My USB AVR910 is like the following, probably a new revision since there is another alternative 8051 type MCU (not populated) -- probably due to the higher price of ATmega8535L now.
https://www.aliexpress.com/item/1267121534.html
[BTW, I am not recommending to buy this though at the US$20, you can buy good AVRISP mkii clone with lower price, from AliExpress. I got it slightly cheaper from Taobao but again I can buy an AVRISP mkii cheaper from Taobao].

The source code is basically the same as the v38b with adjustment to the ATmega8535L and 3.7328MHz crystal.

;* HISTORY
;* V3.8c 25.11.06 (Serasidis)   Changed the programmer's AVR to ATtiny2313 at 11.0592MHz speed and 115200 bps baud rate.
;* V3.8b 26.02.06 (Klaus)       Matched new Devices to avrdude.conf v5.1
;* V3.8a 30.12.05 (Klaus)       Corrected Devic entry for ATTiny13

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 21, 2022

The atmega8 & Atmega8535 sources are set up for use with a 7.3728 Mhz crystal.

@avrfreak
Thanks a lot for the help.

Just wondering if you can create a similar version for ATmega16 with the same 7.3728MHz crystal. The reason is that the JTAG ICE 1 clone is using ATmega16 with 7.3728MHz crysgtal. In that case, people may be able to swap the FW as avr910 technically is able to support many chips comparing to JTAG.

Ref: links for building the JTAG ICE 1 clone, including schematics and bootloader.

@avrfreak
Copy link

You can use the atmega8535 code, it's the same pinout as Atmega16. You will have to change the SPI pins and the LED pins to match your board. Change SPI_PORT, SPI_PIN and SPI_DDR to match your board. I don't see what the LED's do in this programmer. One LED blinks usually once during programming, this is not needed IMO.

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 21, 2022

Sorry for the dumb questions, but I'll have to catch up somehow, since I've not been following the discussion for a few days:

I understand the reason avrospII programs modern devices using an avr910 programmer is because it ignores the device codes sent out from the avr910 programmer and uses the universal 4 bytes SPI packets.

If the AVR910 firmware (even the older versions?) supports 4-byte SPI packets, why even bother with the device signature in the first place? From a compatibility point of view, wouldn't it be better to just use SPI packets? Then we could support most (all?) AVRs with an ISP programming interface.

I realize I'll have to build an AVR910 programmer to join the party here. Does Avrdude support 4-byte SPI packets mode using the AVR910 programmer? If yes, we could perhaps use the device code if present in the avrdude.conf file, and 4-byte SPI mode if not?

The atmega8 & Atmega8535 sources are set up for use with a 7.3728 Mhz crystal.
910-m8.zip
910-m128.zip
910-m328p.zip
910-m8535.zip

Thanks @avrfreak! Is there a schematic available for these as well?

@avrfreak
Copy link

avrfreak commented Aug 21, 2022

Sorry for the dumb questions, but I'll have to catch up somehow, since I've not been following the discussion for a few days:

I understand the reason avrospII programs modern devices using an avr910 programmer is because it ignores the device codes sent out from the avr910 programmer and uses the universal 4 bytes SPI packets.

If the AVR910 firmware (even the older versions?) supports 4-byte SPI packets, why even bother with the device signature in the first place? From a compatibility point of view, wouldn't it be better to just use SPI packets? Then we could support most (all?) AVRs with an ISP programming interface.

I realize I'll have to build an AVR910 programmer to join the party here. Does Avrdude support 4-byte SPI packets mode using the AVR910 programmer? If yes, we could perhaps use the device code if present in the avrdude.conf file, and 4-byte SPI mode if not?

AVROSPII (IIRC) uses the universal commands. This is (I THINK) why it supports any device that atmel or avrstudio does. It looks at all the xml files and creates a devicelist.dat file based on that. (you have to delete the devicelist.dat file, then start the program so it will create a new file based on the xml files).
Avrdude is way more convenient in that you can just double click a bat file and program the device, instead of going in a windows program.
The only way I could see on how to make avrdude work with the avr910 programmer the way avrospII does is to modify avrdude. The avrospII is open source (it's in the name). If you can't find the source let me know i can upload it.
I only know assembly so I can't make any mods to avrdude.

I posted a schematic but the pinout and the crystal is probably different. You will have to modify the source code I posted so that it will match the pinout on your board. It's probably easiest to use an arduino nano or UNO with the m328p code i posted.
Of course, you will have to change the crystal to 14.7456 MHz so the communication can run at 115200 reliably.
Don't worry about the LED's, they do nothing anyways. (except at startup)

schematic

@avrfreak
Copy link

avrfreak commented Aug 21, 2022

If the AVR910 firmware (even the older versions?) supports 4-byte SPI packets, why even bother with the device signature in the first place?

Its the PC side that does not work with the universal commands, like avrprog.exe and avrdude.exe. (AVROSPII does). When the programmer "avr910" is specified in the avrdude command line, it expects to see all of the device bytes and will only accept the ones the programmer spits out.
I guess we could just clean up the unused outdated older devices and add new ones, but something would have to be done on the PC side whether it can be done in the avrdude.conf file or not (I am not sure).

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 21, 2022

Thanks for the hints @avrfreak! I happen to have an ATmega8535 and a 7.3728 MHz crystal, so the process was fairly trivial.
I can confirm that I can communicate with an ATmega128 using the AVR910 programmer, so that's a good thing.

It would be great if we somehow could implement support for SPI commands for parts that doesn't have a device code. For reference, is the avrospii source code available?

@MCUdude
Copy link
Collaborator

MCUdude commented Aug 21, 2022

It appears that Avrdude already has support for SPI commands:

avrdude/src/avr910.c

Lines 296 to 318 in 38aa131

static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
unsigned char *res)
{
char buf[5];
/* FIXME: Insert version check here */
buf[0] = '.'; /* New Universal Command */
buf[1] = cmd[0];
buf[2] = cmd[1];
buf[3] = cmd[2];
buf[4] = cmd[3];
avr910_send (pgm, buf, 5);
avr910_recv (pgm, buf, 2);
res[0] = 0x00; /* Dummy value */
res[1] = cmd[0];
res[2] = cmd[1];
res[3] = buf[0];
return 0;
}

However, I'm not sure how we can utilize this so the AVR910 programmer can act as a bridge between Avrdude and the target, where Avrdude is figuring out all the SPI commands, not the programmer.

The ideal solution would IMO be:

  • If a device code is present in avrdude.conf, and the AVR910 programmers supports this device code, program the target "the AVR910 way".
  • If a device code is not preset, program the target using SPI commands.
 ;*                                     +-------------+------------+------+
;*  Commands                           | Host writes | Host reads |      |
;*  --------                           +-----+-------+------+-----+      |
;*                                     | ID  | data  | data |     | Note |
;* +-----------------------------------+-----+-------+------+-----+------+
;* | Enter programming mode            | 'P' |       |      | 13d |   1  |
;* | Report autoincrement address      | 'a' |       | 	    | 'Y' |      |
;* | Set address                       | 'A' | ah al |      | 13d |   2  |
;* | Write program memory, low byte    | 'c' |    dd |      | 13d |   3  |
;* | Write program memory, high byte   | 'C' |    dd |      | 13d |   3  |
;* | Issue Page Write                  | 'm' |       |      | 13d |      |
;* | Read program memory               | 'R' |       |dd(dd)|     |   4  |
;* | Write data memory                 | 'D' |    dd |      | 13d |      |
;* | Read data memory                  | 'd' |       |   dd |     |      |
;* | Chip erase                        | 'e' |       |      | 13d |      |
;* | Write lock bits                   | 'l' |    dd |      | 13d |      |
;* | Write fuse bits                   | 'f' |    dd |      | 13d |  11  |
;* | Read fuse and lock bits           | 'F' |       |   dd |     |  11  |
;* | Leave programming mode            | 'L' |       |      | 13d |   5  |
;* | Select device type                | 'T' |    dd |      | 13d |   6  |
;* | Read signature bytes              | 's' |       | 3*dd |     |      |
;* | Return supported device codes     | 't' |       | n*dd | 00d |   7  |
;* | Return software identifier        | 'S' |       | s[7] |     |   8  |
;* | Return sofware version            | 'V' |       |dd dd |     |   9  |
;* | Return hardware version           | 'v' |       |dd dd |     |   9  |
;* | Return programmer type            | 'p' |       |   dd |     |  10  |
;* | Set LED                           | 'x' |    dd |      | 13d |  12  |
;* | Clear LED                         | 'y' |    dd |      | 13d |  12  |
;* | Universial command                | ':' |  3*dd |   dd | 13d |      |
;* | New universal command	       | '.' |  4*dd |   dd | 13d |      |
;* | Special test command	       | 'Z' |  2*dd |   dd |     |      |
;* +-----------------------------------+-----+-------+------+-----+------+

I'm not sure if this matters or not, but the AVR910 programmer has the ':' commands, which doesn't appear to be implemented in Avrdude. Maybe ':' could speed up "SPI command" programming? This might be @stefanrueger's territory 😁

@avrfreak
Copy link

Well for starters I want to use the hardware spi instead of bit banging. Originally the code was meant for an AT90S1200 that did not have SPI. I did try to speed it up years ago and IIRC it was troublesome or unreliable with new factory fused chips.
IMO it is fast enough as long as the SPI is changed as I mentioned.

Making it work as AVROSPII might be easier since the source code has all the answers, however that is not my expertise.

I may have commented some of the code out in the source I posted, so that command could be used. It's been so long I can't remember! The programmer source I posted is slightly modified to program the AT89S51 and AT89S52 and works very well. So this is not an "official" version.

Here is a link to the AVROSPII documentation.
https://ww1.microchip.com/downloads/en/Appnotes/doc2568.pdf

I found a link to the source code here:
https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/avrosp911/source-archive.zip

I should have some time early this week to clean up the programmer code and implement the changes I mentioned.

Does anyone have preference as to what board layout we should use? Just so anyone can test it without many modifications.
I am open to suggestions.
I was thinking of using a modified arduino UNO (or NANO) with a 14.7456 MHz crystal and the target reset modded with a jumper as in the schematic I posted earlier. It seems like everyone has an UNO or NANO these days.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 26, 2022

My ribbon cable setup

What is this cable? Between the programmer and the target or the programmer and the PC? I posted the files already. Those are the latest versions. I only changed some minor errors in the 115200 16 MHz version.

Thanks for the clarification for the hex files. Good that the 250k/500k baud hex files are already the latest.

By ribbon cable I mean the connection between the programmer and the target. The interface to the PC is always USB.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 26, 2022

Comparison of Uno based programmers using the "ribbon cable" setup and same 32KB hex file.

Interestingly ScratchMonkey is faster than AVR910 in terms of flash writing but not flash verification. Arduino as ISP only works for 19200 baud so it is always the slowest.

Programmer Flash writing Flash verification
Uno AVR910 500000 bps 20.11 s 6.65 s
ScratchMonkey stk500v2 14.59 s 14.34 s
AVR ISP shield stk500v1 19200bps 36.75 s 20.47 s

@avrfreak
Copy link

That cable will have nothing to do with the baud rates or changes to the baud rate.
The PC communicates with the programmer, then the programmer relays the data to the target via SPI.
The speed is controlled by the programmer.
(there is only one speed, not adjustable like the USBASP programmer)

If you are having communication issues with the PC it's probably the board you are using.
I have had good luck with the CH340G but the PL2303 are total garbage. Every single one I have tried is unreliable.
Maybe because it's difficult to file a genuine Prolific PL2303 device anywhere, I don't know.

@mcuee
Copy link
Collaborator Author

mcuee commented Aug 26, 2022

Indeed it may have something to do with my paticular setup (Windows 11 laptop, USB Type C port and then a 4-port USB Hub). Anyway, that is just my experience.

It has nothing to do with the USB chipset either. I tested 4 Uno clones, 2 are using ATmega16U2 (same as official design) oand the other two are using CH340G. And all 4 of them have the same results: ribbon cable setup works with 250k/500k baud FW but not 115200 baud FW. AVR ISP Shield setup works with all FW (115200/250k/500k baud).

The setup is probably a bit messy.
testsetup_avr910

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 23, 2022

@avrfreak

Would you please create a pull request to modify avrdude.conf.in to support more classic AVR parts for the AVR910 programmers based on your avrdude.conf 6.3 version? If you are not willing to do that, I will give that a try. Thanks.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 23, 2022

Here is the modified avrdude_avr910.conf as well as the latest git main version of the avrdude mingw64 version, using my USB AVR910 programmer (PL2303+ATmega9535, it seems to only run in 19200 bps).

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_git.exe -C .\avrdude_avr910.conf -c avr910 -P COM19
 -p m328p -U .\hex\Blink.ino.with_bootloader.standard.hex

avrdude_git: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude_git: device signature = 0x1e950f (probably m328p)
avrdude_git: Note: flash memory has been specified, an erase cycle will be performed.
             To disable this feature, specify the -D option.
erasing chip
avrdude_git: reading input file .\hex\Blink.ino.with_bootloader.standard.hex for flash
             with 1426 bytes in 3 sections within [0, 0x7fff]
             using 12 pages and 110 pad bytes
avrdude_git: writing 1426 bytes flash ...

Writing | ################################################## | 100% 1.20s

avrdude_git: 1426 bytes of flash written
avrdude_git: verifying flash memory against .\hex\Blink.ino.with_bootloader.standard.hex

Reading | ################################################## | 100% 0.66s

avrdude_git: 1426 bytes of flash verified

avrdude_git done.  Thank you.

avrdude_git_avr910.zip

@avrfreak
Copy link

you have to specify the baud rate -b 115200 or it defaults to 19200

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 25, 2022

you have to specify the baud rate -b 115200 or it defaults to 19200

My USB AVR910 has a lower frequency crysgtal and it can not support 115200bps.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 15, 2022

Comparison of Uno based programmers using the "ribbon cable" setup and same 32KB hex file.

Interestingly ScratchMonkey is faster than AVR910 in terms of flash writing but not flash verification. Arduino as ISP only works for 19200 baud so it is always the slowest.

With optimization (comment out all the LED related codes), Arduino as ISP can work well with 115200bps.

Programmer Flash writing Flash verification
Uno AVR910 500000 bps 20.11 s 6.65 s
ScratchMonkey stk500v2 14.59 s 14.34 s
AVR ISP shield stk500v1 19200bps 36.75 s 20.47 s
AVR ISP shield stk500v1 115200bps 21.99 s 11.51 s
PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c stk500v1 -P COM5 -b 115200 -p m328p -U flash:w:.\zeros32KB.hex:i

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
erasing chip
avrdude: reading input file .\zeros32KB.hex for flash
         with 32768 bytes in 1 section within [0, 0x7fff]
         using 256 pages and 0 pad bytes
avrdude: writing 32768 bytes flash ...

Writing | ################################################## | 100% 21.99 s

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against .\zeros32KB.hex

Reading | ################################################## | 100% 11.51 s

avrdude: 32768 bytes of flash verified

avrdude done.  Thank you.

@mcuee mcuee added the help wanted Extra attention is needed label Jun 6, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Jun 24, 2023

@avrfreak

Just wondering if you are still interested to create a PR to modify avrdude.conf.in to support more parts. Thanks,

@avrfreak
Copy link

I don't know a lot about avrdude and the conf files.

I did however create another file for the UNO board that will work at a faster programming speed.
I got it to program a 64K file in about 3 - 4 seconds. You just need to add a jumper wire between
pins 6 & 7 for fast mode, leave it off for normal mode. Most files are not 64K in size so they will program in
1 or 2 seconds.

The code works with an unmodified UNO @ 16MHz with the reset pin configured for the programming sheild.
I will try and upload it in the next few days.

@stefanrueger
Copy link
Collaborator

stefanrueger commented Jun 25, 2023

It is slightly unclear to me how to do this:

  • The AVR910 protocol only defines a small number of old parts
  • The used device code is one byte, so max 256 parts even if there was a single authoritative list how to allocate codes
  • It is a protocol, so both the new firmware and new AVRDUDE code/config file need to agree. Are there competing different firmware extensions by different people?
  • How should the protocol be extended to deal with flash memories in excess of 128 kB?

So this can be done for one firmware extension at the expense of other incompatible firmware extensions.

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 25, 2023

It is slightly unclear to me how to do this:

  • The AVR910 protocol only defines a small number of old parts
  • The used device code is one byte, so max 256 parts even if there was a single authoritative list how to allocate codes
  • It is a protocol, so both the new firmware and new AVRDUDE code/config file need to agree. Are there competing different firmware extensions by different people?
  • How should the protocol be extended to deal with flash memories in excess of 128 kB?

So this can be done for one firmware extension at the expense of other incompatible firmware extensions.

@stefanrueger

I may be wrong but I tend to think if we ignore the AVR910 IDs (changing avrdude codes), we can support the classic AVRs which support ISP, without touching the firmware.

From what I see the different firmware is just to adapt to different AVR used and different clock speed.

http://ww1.microchip.com/downloads/en/appnotes/atmel-0943-in-system-programming_applicationnote_avr910.pdf

@avrfreak
Copy link

The avr910 firmware in the programmer defines a small number of older parts.
You would have to change avrprog.exe or avrdude.conf to allow more entries.
Since we can't change avrprog.exe the only way to do it is with avrdude.conf.

As I mentioned before, I have little knowledge of the avrdude.conf file.

IIRC, I used similar avr910 codes for similar devices. For the attiny2313, I used the AVR910 Attiny26 device code.
For the atmega328, I used the Atmega32 code. The avrdude.conf file was modified with the similar device code. Then the page sizes and fuse bytes, signature bytes, etc, etc, etc were all checked with each datasheet.

The page sizes must be the same if you are using avrprog.exe but they can be changed in avrdude.conf when newer devices are added. You can see what I have done in the avrdude.conf file I posted above.

For avrospII.exe you just install the latest microchip studio. (I think you have to delete the dat file then restart avrospII.exe and the devicelist.dat will regenerate. The problem with avrosp.exe is that it is very slow. I don't remember why, (I think avrosp sends the data one byte at a time from the PC to the programmer.

AVRprog supports Atmega128. You can select Atmega128 for use with atmega1284.

What I just did recently was added a jumper setting just like the old USBASP firmware where it allows you to select slow SCK.
IIRC, Slow SCK = 125 kHz and fast SCK = 4MHz. The faster speed is mainly for programming AVR's with a large crystal (like the UNO's, 16 MHz)

I don't think this modification is for everyone, especially when you can just buy a USBASP for under $3 which will support newer devices with avrdude.

@avrfreak
Copy link

avrfreak commented Jun 25, 2023

910-328p.zip

Here is the AVR910 firmware for the UNO board @ 16Mhz.
Please read the readme.txt.

@avrfreak
Copy link

Programming a 64K file in Fast Mode:

C:\910-UNO>avrdude -c avr910 -p m644 -P com3 -b 115200 

-C avrdude.conf -e -U flash:w:64K.hex:a
avrdude: AVR device initialized and ready to accept 

instructions

Reading | 

################################################## | 

100% 0.01s

avrdude: Device signature = 0x1e9609 (probably m644)
avrdude: erasing chip
avrdude: reading input file "64K.hex"
avrdude: input file 64K.hex auto detected as Intel Hex
avrdude: writing flash (65536 bytes):

Writing | 

################################################## | 

100% 11.70s

avrdude: 65536 bytes of flash written
avrdude: verifying flash memory against 64K.hex:
avrdude: load data flash data from input file 64K.hex:
avrdude: input file 64K.hex auto detected as Intel Hex
avrdude: input file 64K.hex contains 65536 bytes
avrdude: reading on-chip flash data:

Reading | 

################################################## | 

100% 7.88s

avrdude: verifying ...
avrdude: 65536 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:CE)

avrdude done.  Thank you.

Programming a 64K file in Slow Mode:

C:\910-UNO>avrdude -c avr910 -p m644 -P com3 -b 115200 -C avrdude.conf -e -U flash:w:64K.hex:a

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9609 (probably m644)
avrdude: erasing chip
avrdude: reading input file "64K.hex"
avrdude: input file 64K.hex auto detected as Intel Hex
avrdude: writing flash (65536 bytes):

Writing | ################################################## | 100% 27.89s

avrdude: 65536 bytes of flash written
avrdude: verifying flash memory against 64K.hex:
avrdude: load data flash data from input file 64K.hex:
avrdude: input file 64K.hex auto detected as Intel Hex
avrdude: input file 64K.hex contains 65536 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 19.42s

avrdude: verifying ...
avrdude: 65536 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:CE)

avrdude done.  Thank you.

@stefanrueger
Copy link
Collaborator

the only way to do it is with avrdude.conf

I suspect this can be done in a private ~/.avrduderc file (in Windows the file avrdude.rc in the directory where avrdude.exe resides).

@avrfreak appears to reuse an existing avr910_devcode for every new part that can be programmed with the existing (original?) AVR910 firmware. That is reasonable and these codes could be added to avrdude.conf.

There seem to be firmware variants: @MCUdude has suggested the use of two different device codes, probably based on the observation that different firmware/bootloaders have made a different assignment and that so far no part gets assigned more than two different device codes. I suspect this is not quite as simple. Given a particular part, AVRDUDE needs to know which of the two device codes a programmer/firmware/protocol has assigned to it...

The cleanest solution is to have a device code variable for each programmer/firmware/bootloader that has made their own extension of the AVR910 device code assignment. That is difficult to track down though (and how would a user know which firmware their AVR910 programmer has?)

You can see what I have done in the avrdude.conf file I posted above

There are quite a few post. If that is your current full avrdude.conf file it would not be clear what you have changed. As @mcuee said, if you submit a PR the it's much clearer what you have done, and it can instantly be tested.

@avrfreak
Copy link

avrdude.zip
this is the one. Just look for "avr910_devcode" in the file.

@stefanrueger
Copy link
Collaborator

stefanrueger commented Jun 25, 2023

look for "avr910_devcode" in the file

Thanks. I installed that avrdude.conf file locally. Turns out its mapping of 96 parts to avr910_devcode numbers is already the same as that of git mainline:

$ avrdude_avrfreak -p*/St | grep 910_devcode | sort >/tmp/1
$ avrdude_git_main -p*/St | grep 910_devcode | sort | diff - /tmp/1

So, nothing more to do for AVRDUDE?

BTW, here the inverse mapping in a bash loop:

for code in $(avrdude -p*/St | grep 910_dev | sort | cut -f4 | sort -u); do
  echo $code: $(avrdude -p*/St | grep 910_devcode.$code | cut -f2 | sed -es/ATmega/m/ -es/ATtiny/t/|tr A-Z a-z)
done

0x13: at90s1200
0x20: at90s2313 t87 t167 ata5505 ata6616c ata6617c ata664251 t25 t45 t85 t24 t24a t44 t44a t84 t84a t441 t841 t43u
0x28: at90s4414
0x30: at90s4433
0x34: at90s2333
0x38: at90s8515
0x3a: m8515
0x41: m103
0x43: m128 m128a
0x45: m64 m64a
0x48: at90s2323
0x4c: at90s2343
0x56: t12 t15
0x5c: t28
0x5e: t26 t2313 t2313a t4313
0x60: m161
0x63: m162
0x64: m163
0x68: at90s8535
0x69: m8535
0x6c: at90s4434
0x72: m32 m32a
0x74: m16 m16a m324p m164p m164pa m164a m324pb m324pa m324a m644 m644a m644p m644pa m1284 m1284p m325 m325a m325p m325pa m645 m645a m645p m3250 m3250a m3250p m3250pa m6450 m6450a m6450p
0x75: m329 m329a m329p m329pa m3290 m3290a m3290p m3290pa m649 m649a m649p m6490 m6490a m6490p
0x76: m8 m8a
0x78: m169 m169a m169p m169pa

@avrfreak
Copy link

yes I did nothing new on the config file, the config file is from last year.

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 26, 2023

This is the run log for my modified avrdude.conf last year, it still works with latest avrdude git, but of course with some warnings.

You can see it works with ATmega328PB.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c usbasp -p m328p -U .\910-328p_16MHz_Rst_PB2.hex
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
avrdude: erasing chip

avrdude: processing -U flash:w:.\910-328p_16MHz_Rst_PB2.hex:i
avrdude: reading input file .\910-328p_16MHz_Rst_PB2.hex for flash
         with 2602 bytes in 2 sections within [0, 0x7fff]
         using 21 pages and 86 pad bytes
avrdude: writing 2602 bytes flash ...
Writing | ################################################## | 100% 0.64 s
avrdude: 2602 bytes of flash written
avrdude: verifying flash memory against .\910-328p_16MHz_Rst_PB2.hex
Reading | ################################################## | 100% 0.42 s
avrdude: 2602 bytes of flash verified

avrdude done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -C .\avrdude_avr910.conf -c avr910 -p m328pb -P COM50 -b 115200 -U .\910-328p.hex -v

avrdude: Version 7.1-20230623 (5a8aff09)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:483]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:484]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:517]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:518]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:557]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:558]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:580]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:581]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:663]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:664]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:690]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:691]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:712]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:713]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:749]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:750]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:772]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:773]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:859]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:860]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1001]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1002]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1017]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1018]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1035]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1036]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1054]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1055]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1071]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1072]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1105]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1106]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1135]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1136]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2083]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2084]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2114]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2115]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2133]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2134]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2152]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2153]
         User configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude.rc

         Using Port                    : COM50
         Using Programmer              : avr910
         Overriding Baud Rate          : 115200
         avr910_devcode (avrdude.conf) : 0x72
avrdude: input file .\910-328p.hex auto detected as Intel Hex
         AVR Part                      : ATmega328PB
         Chip Erase delay              : 10500 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00

         Programmer Type : avr910
         Description     : Atmel Low Cost Serial Programmer
Programmer id    = AVR ISP; type = S
Software version = 6.0; Hardware version = 1.2
programmer supports auto addr increment
programmer supports buffered memory access with buffersize = 256 bytes
avrdude: avr910_devcode selected: 0x72
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9516 (probably m328pb)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
avrdude: erasing chip

avrdude: processing -U flash:w:.\910-328p.hex:i
avrdude: reading input file .\910-328p.hex for flash
         with 2102 bytes in 1 section within [0, 0x835]
         using 17 pages and 74 pad bytes
avrdude: writing 2102 bytes flash ...
Writing | ################################################## | 100% 0.91 s
avrdude: 2102 bytes of flash written
avrdude: verifying flash memory against .\910-328p.hex
Reading | ################################################## | 100% 0.48 s
avrdude: 2102 bytes of flash verified

avrdude done.  Thank you.

avrdude_avr910.zip

Relevant entries for ATmega328/328P/328PB


#------------------------------------------------------------
# ATmega328
#------------------------------------------------------------

part
    desc                   = "ATmega328";
    id                     = "m328";
    prog_modes             = PM_SPM | PM_ISP | PM_HVPP | PM_debugWIRE;
    mcuid                  = 118;
    n_interrupts           = 26;
    stk500_devcode         = 0x86;
    chip_erase_delay       = 9000;
    pagel                  = 0xd7;
    bs2                    = 0xc2;
    avr910_devcode         = 0x72;
    signature              = 0x1e 0x95 0x14;
    reset                  = io;
    timeout                = 200;
    stabdelay              = 100;
    cmdexedelay            = 25;
    synchloops             = 32;
    pollindex              = 3;
    pollvalue              = 0x53;
    predelay               = 1;
    postdelay              = 1;
    pollmethod             = 1;
    pp_controlstack        =
        0x0e, 0x1e, 0x0f, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f,
        0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f,
        0x66, 0x76, 0x67, 0x77, 0x6a, 0x7a, 0x6b, 0x7b,
        0xbe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
    flash_instr            =  0xb6, 0x01, 0x11;
    eeprom_instr           =
        0xbd, 0xf2, 0xbd, 0xe1, 0xbb, 0xcf, 0xb4, 0x00,
        0xbe, 0x01, 0xb6, 0x01, 0xbc, 0x00, 0xbb, 0xbf,
        0x99, 0xf9, 0xbb, 0xaf;
    hventerstabdelay       = 100;
    latchcycles            = 5;
    togglevtg              = 1;
    poweroffdelay          = 15;
    resetdelayms           = 1;
    hvleavestabdelay       = 15;
    resetdelay             = 15;
    chiperasepolltimeout   = 10;
    programfusepolltimeout = 5;
    programlockpolltimeout = 5;
    ocdrev                 = 1;
    chip_erase             = "1010.1100--100x.xxxx--xxxx.xxxx--xxxx.xxxx";
    pgm_enable             = "1010.1100--0101.0011--xxxx.xxxx--xxxx.xxxx";

    memory "eeprom"
        size               = 1024;
        page_size          = 4;
        min_write_delay    = 3600;
        max_write_delay    = 3600;
        readback           = 0xff 0xff;
        mode               = 65;
        delay              = 20;
        blocksize          = 4;
        readsize           = 256;
        read               = "1010.0000--000x.xxaa--aaaa.aaaa--oooo.oooo";
        write              = "1100.0000--000x.xxaa--aaaa.aaaa--iiii.iiii";
        loadpage_lo        = "1100.0001--0000.0000--0000.00aa--iiii.iiii";
        writepage          = "1100.0010--00xx.xxaa--aaaa.aa00--xxxx.xxxx";
    ;

    memory "flash"
        paged              = yes;
        size               = 0x8000;
        page_size          = 128;
        num_pages          = 256;
        min_write_delay    = 4500;
        max_write_delay    = 4500;
        readback           = 0xff 0xff;
        mode               = 65;
        delay              = 6;
        blocksize          = 128;
        readsize           = 256;
        read_lo            = "0010.0000--00aa.aaaa--aaaa.aaaa--oooo.oooo";
        read_hi            = "0010.1000--00aa.aaaa--aaaa.aaaa--oooo.oooo";
        loadpage_lo        = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii";
        loadpage_hi        = "0100.1000--000x.xxxx--xxaa.aaaa--iiii.iiii";
        writepage          = "0100.1100--00aa.aaaa--aaxx.xxxx--xxxx.xxxx";
    ;

    memory "lfuse"
        size               = 1;
        min_write_delay    = 4500;
        max_write_delay    = 4500;
        read               = "0101.0000--0000.0000--xxxx.xxxx--oooo.oooo";
        write              = "1010.1100--1010.0000--xxxx.xxxx--iiii.iiii";
    ;

    memory "hfuse"
        size               = 1;
        min_write_delay    = 4500;
        max_write_delay    = 4500;
        read               = "0101.1000--0000.1000--xxxx.xxxx--oooo.oooo";
        write              = "1010.1100--1010.1000--xxxx.xxxx--iiii.iiii";
    ;

    memory "efuse"
        size               = 1;
        min_write_delay    = 4500;
        max_write_delay    = 4500;
        read               = "0101.0000--0000.1000--xxxx.xxxx--oooo.oooo";
        write              = "1010.1100--1010.0100--xxxx.xxxx--xxxx.xiii";
    ;

    memory "lock"
        size               = 1;
        min_write_delay    = 4500;
        max_write_delay    = 4500;
        read               = "0101.1000--0000.0000--xxxx.xxxx--oooo.oooo";
        write              = "1010.1100--111x.xxxx--xxxx.xxxx--11ii.iiii";
    ;

    memory "signature"
        size               = 3;
        read               = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo";
    ;

    memory "calibration"
        size               = 1;
        read               = "0011.1000--000x.xxxx--0000.0000--oooo.oooo";
    ;
;

#------------------------------------------------------------
# ATmega328P
#------------------------------------------------------------

part parent "m328"
    desc                   = "ATmega328P";
    id                     = "m328p";
    mcuid                  = 119;
    signature              = 0x1e 0x95 0x0f;
;

#------------------------------------------------------------
# ATmega328PB
#------------------------------------------------------------

part parent "m328"
    desc                   = "ATmega328PB";
    id                     = "m328pb";
    mcuid                  = 120;
    n_interrupts           = 45;
    chip_erase_delay       = 10500;
    signature              = 0x1e 0x95 0x16;

    memory "efuse"
        write              = "1010.1100--1010.0100--xxxx.xxxx--xxxx.iiii";
    ;
;

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 26, 2023

910-328p.zip

Here is the AVR910 firmware for the UNO board @ 16Mhz. Please read the readme.txt.

This does not seem to work for me. So I was still using the older hex file (910-328p_16MHz_Rst_PB2.hex, from last year) in the previous run log.

Failed run log with the latest hex file

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c urclock -p m328p -P COM50 -U .\910-328p.hex
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e950f (probably m328p)
avrdude: Note: flash memory has been specified, an erase cycle will be performed.
         To disable this feature, specify the -D option.
avrdude: erasing chip
         delaying chip erase until first -U upload to flash

avrdude: processing -U flash:w:.\910-328p.hex:i
avrdude: reading input file .\910-328p.hex for flash
         with 2102 bytes in 1 section within [0, 0x835]
         using 17 pages and 74 pad bytes
avrdude: preparing flash input for device bootloader
avrdude: writing 2102 bytes flash ...
Writing | ################################################## | 100% 6.55 s
avrdude: 2102 bytes of flash written
avrdude: verifying flash memory against .\910-328p.hex
Reading | ################################################## | 100% 5.23 s
avrdude: 2102 bytes of flash verified

avrdude done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -C .\avrdude_avr910.conf -c avr910 -p m328pb -P COM50 -b 115200 -U .\910-328p.hex -v

avrdude: Version 7.1-20230623 (5a8aff09)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:483]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:484]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:517]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:518]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:557]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:558]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:580]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:581]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:663]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:664]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:690]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:691]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:712]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:713]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:749]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:750]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:772]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:773]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:859]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:860]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1001]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1002]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1017]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1018]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1035]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1036]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1054]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1055]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1071]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1072]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1105]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1106]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1135]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:1136]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2083]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2084]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2114]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2115]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2133]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2134]
avrdude yywarning() warning: mosi is deprecated, will be removed in v8.0, use sdo [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2152]
avrdude yywarning() warning: miso is deprecated, will be removed in v8.0, use sdi [C:\work\avr\avrdude_test\avrdude_bin\avrdude_avr910.conf:2153]
         User configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude.rc

         Using Port                    : COM50
         Using Programmer              : avr910
         Overriding Baud Rate          : 115200
         avr910_devcode (avrdude.conf) : 0x72
avrdude: input file .\910-328p.hex auto detected as Intel Hex
         AVR Part                      : ATmega328PB
         Chip Erase delay              : 10500 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : possible i/o
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                           Block Poll               Page                       Polled
           Memory Type Alias    Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom                 65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash                  65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  4500  4500 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1    1      0     0     0 0x00 0x00

         Programmer Type : avr910
         Description     : Atmel Low Cost Serial Programmer
Programmer id    = AVR ISP; type = S
Software version = 6.0; Hardware version = 1.2
programmer supports auto addr increment
programmer supports buffered memory access with buffersize = 256 bytes
avrdude: avr910_devcode selected: 0x72
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega) (retrying)
avrdude: device signature = 0xffffff (probably .xmega)
avrdude main() error: Yikes!  Invalid device signature.
avrdude main() error: expected signature for ATmega328PB is 1E 95 16
        Double check connections and try again, or use -F to override
        this check.


avrdude done.  Thank you.

@avrfreak
Copy link

avrfreak commented Jun 26, 2023

I suggest you stop using avrdude 7.1 in my opinion it is nothing but trouble especially when trying to use a real RS232 serial port (not a TTL adapter), IT DOESN'T WORK.

As for the error messages, "mosi is deprecated" now what is that supposed to mean? I guess the config file is not compatible with the avrdude version you are using.

The only reason for uploading a new hex file is to allow the programmer to increase the SCK rate to 2MHz if PD6 & PD7 are joined.
If you do not use the new hex file then your programmer will only program with the slow SCK setting
(in the old code the SPI routine is bit-bang).

I use avrdude V6.3 with the config file I posted. Since I don't have a great deal of time to spend on this because of my job, anything after avrdude V6.3 has been too troublesome and time consuming for me to bother with.

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 27, 2023

I suggest you stop using avrdude 7.1 in my opinion it is nothing but trouble especially when trying to use a real RS232 serial port (not a TTL adapter), IT DOESN'T WORK.

I use avrdude V6.3 with the config file I posted. Since I don't have a great deal of time to spend on this because of my job, anything after avrdude V6.3 has been too troublesome and time consuming for me to bother with.

I will for sure not use the ancient avrdude 6.3 version. You are missing really a lot of features if you stick to the 6.3 version. But anyway, that is your choice...

If you have issues with real serial port, please create the issue. But I do not have PCs with real serial port now so I can not test that.

As for the error messages, "mosi is deprecated" now what is that supposed to mean? I guess the config file is not compatible with the avrdude version you are using.

Yes, that is just for quick testing -- I reuse the old configuration file last year, which will cause warnings.

The only reason for uploading a new hex file is to allow the programmer to increase the SCK rate to 2MHz if PD6 & PD7 are joined. If you do not use the new hex file then your programmer will only program with the slow SCK setting
(in the old code the SPI routine is bit-bang).

Thanks for the information.

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 27, 2023

I don't think this modification is for everyone, especially when you can just buy a USBASP for under $3 which will support newer devices with avrdude.

@avrfreak

This is a good point. I guess this issue is probably not worth the efforts in the end. But still thanks for your contribution. Maybe someone may find it useful in the future.

@mcuee
Copy link
Collaborator Author

mcuee commented Jun 27, 2023

In this case, I will move this to discussion. If someone helps to create a PR then we can start from there again.

@avrdudes avrdudes locked and limited conversation to collaborators Jun 27, 2023
@mcuee mcuee converted this issue into discussion #1449 Jun 27, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants