Arduino IDE communication issue with ATmega128 using MegaCore

So I've been having an issue with getting communication through the Arduino IDE to communicate to an ATMega128 using both a USBasp and AVRISP mkII. Here what Arduino IDE shows...

avrdude: Version 7.1-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2\avrdude.conf

         Using Port                    : /dev/ttyS0
         Using Programmer              : stk500v2
avrdude ser_open() error: cannot open port /dev/ttyS0: The system cannot find the path specified.


avrdude main() error: unable to open programmer stk500v2 on port /dev/ttyS0

avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

However, I can access it using AVRDUDESS 2.14 (avrdude version 7.0) using both programmers.

>>>: avrdude 
>>>: avrdude -c avrispmkII -P usb -b 115200 -p m8 
Detected 1e9702 = ATmega128

So the wiring is correct and able to read/write that way, but would like to be able to using the Arduino IDE instead. I'm assuming there is an issue with wanting to open serial communication, but the programmer is connected via USB? I've scoured and can't find much info, any help would be appreciated :slight_smile:

Update...

I ran across a site about resetting fuse bits on the ATMega128 and since I couuld communicate using version 7.0, I went ahead and did this, at the time, I had the AVRisp mkII connected and tried again to burn the bootloader in the Arduino IDE and received the same issue. I switched back to the USBasp and tried again and it appears to have worked...

avrdude: Version 7.1-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2\avrdude.conf

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega128
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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                  4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash                  33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9702 (probably m128)
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdud"C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\tools\avrdude\7.1-arduino.1/bin/avrdude" "-CC:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2/avrdude.conf" -v -patmega128 -cusbasp  "-Uflash:w:C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2/bootloaders/optiboot_flash/bootloaders/atmega128/16000000L/optiboot_flash_atmega128_UART0_115200_16000000L_B5_BIGBOOT.hex:i" -Ulock:w:0xcf:m
e: reading input file 0xff for lock
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xff
avrdude: 1 byte of lock verified
avrdude: reading input file 0xff for efuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte efuse ...
avrdude: 1 byte of efuse written
avrdude: verifying efuse memory against 0xff
avrdude: 1 byte of efuse verified
avrdude: reading input file 0b11000110 for hfuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte hfuse ...
avrdude: 1 byte of hfuse written
avrdude: verifying hfuse memory against 0b11000110
avrdude: 1 byte of hfuse verified
avrdude: reading input file 0b10111111 for lfuse
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lfuse ...
avrdude: 1 byte of lfuse written
avrdude: verifying lfuse memory against 0b10111111
avrdude: 1 byte of lfuse verified

avrdude done.  Thank you.


avrdude: Version 7.1-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2\avrdude.conf

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega128
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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                  4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash                  33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9702 (probably m128)
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: auto set sck period (because given equals null)
avrdude: reading input file C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2/bootloaders/optiboot_flash/bootloaders/atmega128/16000000L/optiboot_flash_atmega128_UART0_115200_16000000L_B5_BIGBOOT.hex for flash
         with 896 bytes in 2 sections within [0x1fc00, 0x1ffff]
         using 4 pages and 128 pad bytes
avrdude: writing 896 bytes flash ...

Writing | ################################################## | 100% 0.07s

avrdude: 896 bytes of flash written
avrdude: verifying flash memory against C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2/bootloaders/optiboot_flash/bootloaders/atmega128/16000000L/optiboot_flash_atmega128_UART0_115200_16000000L_B5_BIGBOOT.hex

Reading | ################################################## | 100% 0.00s

avrdude: 896 bytes of flash verified
avrdude: reading input file 0xcf for lock
         with 1 byte in 1 section within [0, 0]
avrdude: writing 1 byte lock ...
avrdude: 1 byte of lock written
avrdude: verifying lock memory against 0xcf
avrdude: 1 byte of lock verified

avrdude done.  Thank you.

Since this appeared to work, I tried to upload the sketch and it too worked :slight_smile:

Sketch uses 26756 bytes (20%) of program storage space. Maximum is 130048 bytes.
Global variables use 2070 bytes (50%) of dynamic memory, leaving 2026 bytes for local variables. Maximum is 4096 bytes.
"C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\tools\avrdude\7.1-arduino.1/bin/avrdude" "-CC:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2/avrdude.conf" -v -V -patmega128 -cusbasp  "-Uflash:w:C:\Users\Matthew Barrett\AppData\Local\Temp\arduino-sketch-8E22B48D1E78F8D77D8E3C57F8315BA9/Lyme Laser 2560.ino.with_bootloader.hex:i"

avrdude: Version 7.1-arduino.1
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\Users\Matthew Barrett\AppData\Local\Arduino15\packages\MegaCore\hardware\avr\2.2.2\avrdude.conf

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega128
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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                  4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash                  33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           hfuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           efuse                   0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           lock                    0     0     0    0 no          1    1      0  9000  9000 0x00 0x00
           signature               0     0     0    0 no          3    1      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          4    1      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9702 (probably m128)
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: auto set sck period (because given equals null)
avrdude: reading input file C:\Users\Matthew Barrett\AppData\Local\Temp\arduino-sketch-8E22B48D1E78F8D77D8E3C57F8315BA9/Lyme Laser 2560.ino.with_bootloader.hex for flash
         with 27652 bytes in 3 sections within [0, 0x1ffff]
         using 109 pages and 252 pad bytes
avrdude: writing 27652 bytes flash ...

Writing | ################################################## | 100% 8.34s

avrdude: 27652 bytes of flash written

avrdude done.  Thank you.

Still have to update the pinouts from the sketch to match the 128, then to wire it up to my proto board and see if it has indeed worked :slight_smile:

The issue related to MegaCore + AVRISPmkII is due to an error in the MegaCore programmers.txt file. I'll fix the issue right away, and it will be available in the next MegaCore boards manager release.

If you can't wait, find the programmers.txt file and replace the AVRISP mkII with this:

avrispmkii.name=AVRISPmkII
avrispmkii.communication=usb
avrispmkii.protocol=avrispmkii
avrispmkii.program.protocol=avrispmkii
avrispmkii.program.tool=avrdude
avrispmkii.program.extra_params=-Pusb
1 Like

Awesome :slight_smile:

I did get it to work with the USBasp programmer though, but good to know that it was an actual issue and being resolved :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.