Burn bootloader for an Leonardo using Leonardo

First, I'm not sure the burning bootloader is my problem solution, but I have no other idea. The problem is related to the device signature and occurred after I accidentally flashed software that exceeds RAM (170%) after that any attempt to flash anything else is not possible since the following issue:

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: ser_drain(): read error: The I/O operation has been aborted because of either a thread exit or an application request.


avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.


avrdude: butterfly_recv(): programmer is not responding
################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.


avrdude: butterfly_recv(): programmer is not responding
################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.


avrdude: butterfly_recv(): programmer is not responding
################################################## | 100% 0.00s

avrdude: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.


avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: ser_send(): write error: sorry no info avail
avrdude: ser_recv(): read error: The device does not recognize the command.


avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader

avrdude done.  Thank you.

*** [upload] Error 1

I assume that bootloader flash will solve the problem (If you see another solution please let me know). I use Leonardo board as a programmer, but it is not the original Arduino. The target (the board I develop the software) is an original Arduino Leonardo. I connected the ICSP in the following way (left: programmer, right: target):
pin 10 --> Reset
pin 11 --> MOSI
pin 12 --> MISO
pin 13 --> SCK
5V --> 5V
GND --> GND

The result of burning bootloader:

Arduino: 1.8.13 (Windows 10), Board: "Arduino Leonardo"

C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -carduino -PCOM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m 



avrdude: Version 6.3-20190619

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch



         System wide configuration file is "C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"



         Using Port                    : COM4

         Using Programmer              : arduino

         Overriding Baud Rate          : 19200

         AVR Part                      : ATmega32U4

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PA0

         RESET disposition             : dedicated

         RETRY pulse                   : SCK

         serial program mode           : yes

         parallel program mode         : yes

         Timeout                       : 200

         StabDelay                     : 100

         CmdexeDelay                   : 25

         SyncLoops                     : 32

         ByteDelay                     : 0

         PollIndex                     : 3

         PollValue                     : 0x53

         Memory Detail                 :



                                  Block Poll               Page                       Polled

           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00

           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00

           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00



         Programmer Type : Arduino

         Description     : Arduino

         Hardware Version: 2

         Firmware Version: 1.18

         Topcard         : Unknown

         Vtarget         : 0.0 V

         Varef           : 0.0 V

         Oscillator      : Off

         SCK period      : 0.1 us



avrdude: AVR device initialized and ready to accept instructions



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



avrdude: Device signature = 0x000000 (retrying)



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



avrdude: Device signature = 0x000000 (retrying)



Error while burning bootloader.

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



avrdude: Device signature = 0x000000

avrdude: Yikes!  Invalid device signature.

         Double check connections and try again, or use -F to override

         this check.





avrdude done.  Thank you.

What I have tried already:

  • Unplugged all other wires that were connected to the target board
  • Checked if wires are connected solidly
  • Unplug the reset wire

I use as the programmer "Arduino as ISP (ATmega32U4)" (Arduino IDE). The programmer is flashed with an unmodified "ArduinoISP" program from examples.

Update:
I was able to flash a simple "blink" project from examples using Arduino IDE. Below I put the console output, it is different than usual. Unfortunately, it doesn't solve the problem. After flashing my program the behavior is strange. The LCD display changes its brightness rapidly (below 1Hz pulsation).

E:\plikiprogramow\Arduino\arduino-builder -dump-prefs -logger=machine -hardware E:\plikiprogramow\Arduino\hardware -hardware C:\Users\Martino\AppData\Local\Arduino15\packages -tools E:\plikiprogramow\Arduino\tools-builder -tools E:\plikiprogramow\Arduino\hardware\tools\avr -tools C:\Users\Martino\AppData\Local\Arduino15\packages -built-in-libraries E:\plikiprogramow\Arduino\libraries -libraries C:\Users\Martino\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -ide-version=10813 -build-path C:\Users\Martino\AppData\Local\Temp\arduino_build_337585 -warnings=none -build-cache C:\Users\Martino\AppData\Local\Temp\arduino_cache_633505 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose E:\plikiprogramow\Arduino\examples\01.Basics\Blink\Blink.ino
E:\plikiprogramow\Arduino\arduino-builder -compile -logger=machine -hardware E:\plikiprogramow\Arduino\hardware -hardware C:\Users\Martino\AppData\Local\Arduino15\packages -tools E:\plikiprogramow\Arduino\tools-builder -tools E:\plikiprogramow\Arduino\hardware\tools\avr -tools C:\Users\Martino\AppData\Local\Arduino15\packages -built-in-libraries E:\plikiprogramow\Arduino\libraries -libraries C:\Users\Martino\Documents\Arduino\libraries -fqbn=arduino:avr:leonardo -ide-version=10813 -build-path C:\Users\Martino\AppData\Local\Temp\arduino_build_337585 -warnings=none -build-cache C:\Users\Martino\AppData\Local\Temp\arduino_cache_633505 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.avrdude.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -verbose E:\plikiprogramow\Arduino\examples\01.Basics\Blink\Blink.ino
Using board 'leonardo' from platform in folder: C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Using core 'arduino' from platform in folder: C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5
Detecting libraries used...
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER=\"Unknown\"" "-DUSB_PRODUCT=\"Arduino Leonardo\"" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\leonardo" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\sketch\\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER=\"Unknown\"" "-DUSB_PRODUCT=\"Arduino Leonardo\"" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\leonardo" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\sketch\\Blink.ino.cpp" -o "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"E:\\plikiprogramow\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 "-DUSB_MANUFACTURER=\"Unknown\"" "-DUSB_PRODUCT=\"Arduino Leonardo\"" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\cores\\arduino" "-IC:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.5\\variants\\leonardo" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\sketch\\Blink.ino.cpp" -o "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\Martino\AppData\Local\Temp\arduino_cache_633505\core\core_arduino_avr_leonardo_96c5e213fb9af7ddbe65dfe357ad4377.a
Linking everything together...
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega32u4 -o "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.elf" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585\\sketch\\Blink.ino.cpp.o" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/..\\arduino_cache_633505\\core\\core_arduino_avr_leonardo_96c5e213fb9af7ddbe65dfe357ad4377.a" "-LC:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585" -lm
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.elf" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.eep"
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.elf" "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.hex"
"C:\\Users\\Martino\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\Martino\\AppData\\Local\\Temp\\arduino_build_337585/Blink.ino.elf"
Sketch uses 3956 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, COM5, } => {COM5, }
Found upload port: COM5
C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM5 -b57600 -D -Uflash:w:C:\Users\Martino\AppData\Local\Temp\arduino_build_337585/Blink.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Martino\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

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

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "C:\Users\Martino\AppData\Local\Temp\arduino_build_337585/Blink.ino.hex"
avrdude: writing flash (3956 bytes):

Writing | ################################################## | 100% 0.31s

avrdude: 3956 bytes of flash written
avrdude: verifying flash memory against C:\Users\Martino\AppData\Local\Temp\arduino_build_337585/Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\Martino\AppData\Local\Temp\arduino_build_337585/Blink.ino.hex:
avrdude: input file C:\Users\Martino\AppData\Local\Temp\arduino_build_337585/Blink.ino.hex contains 3956 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.04s

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

avrdude done.  Thank you.

If you are using one Leonardo to burn tghe bootloader on another Leonardo, the above is wrong. Pins 11/12/13 on a Leonardo are not the SPI interface; you need the pins on the 6 pin header (same as on the target).

What is "usual"?

If you can flash blink, your bootloader is OK. So I guess you're problem is solved :wink:

1 Like

Thank you for quick response. I will try your advice.
So how to interpret this strange behaviour? I'm certain something is wrong since I flashed the board with te same soft as before and the result is different. I will double check I connected everything as before, but how can I check the board is in the same state as it was after buy?

I'm actually surprised that the IDE allowed you to do that. Was the 170% flash or RAM (dynamic memory)

The one that has the 170% memory usage? How did you flash that code? Using the IDE? Using avrdude directly? In both cases, over USB or over ICSP?

The flash memory is divided in 2 parts

  1. Bootloader.
  • An upload over ICSP using a programmer will replace the bootloader with whatever is in the hex file.
  • If you just did the upload over USB, it's highly unlikely that you will manage to corrupt the bootloader if the RAM usage was 170%.
  • If your flash memory was 170%, it might be possible. I don't know.
  1. Your sketch (see below).

When you compile a sketch for a board with native USB (e.g. the Leonardo), it contains

  1. The sketch that you wrote.
  2. Additional code to handle USB.

Mistakes in your sketch can result in variables used by the code that handles the USB becoming corrupt. The result can be that your board is no longer detected or your board does not react on the software reset that the IDE issues (opening and closing the port with a baudrate of 1200 baud); in both cases you will have a bit of a hard time to upload a sketch.

Below indicates that the bootloader is OK. Now the question is if that was the "faulty" Leonardo or the "good" one? After the software reset by the IDE, it starts polling the serial ports till it finds one with the boot loader. In the 3rd line you can see that it found a port that it can use.

You will not see that line when the Leonardo does not react on the software reset; the lines will be repeated. In that case you can manually reset the the board when you see the lines PORTS {COM3, } / {COM3, } => {}. My Leonardo reacts on a single tap on the reset button to get it in bootloader mode; I've seen people indicating that they require a double tap.

If you "faulty" board is not detected at all (check Windows device manager), there are two things you can check.

  1. Does the onboard LED breath in and out for approximately 8 seconds. In that case your bootloader is more than likely OK.
  2. Does Windows device manager show the Leonardo bootloader? If the LED behaves as expected and device manager does not see it, the first thing to check is that you are not using a charge-only cable or damaged cable and that your cable is properly inserted (use e.g. the cable that works with the "good" Leonardo).
1 Like

Dynamic memory.

I use Platformio IDE (plugin for vs code). Flashed through a USB port.

For me it look all right
image
When I push the reset button on the board it changes for a while:
image

Yes, it does pulsate about 8 seconds.

I'm not sure if the above screen (showing COM5 port in the Device Manager) is sufficient verification, let me know if I need to check it in a different way.

So we can assume that bootloader is not corrupted? If so, what is the root cause of the behavior I mentioned earlier? I run out of ideas. Today, I have tried to flash a simple example code for an I2C Display I used a sketch grabbed from the web:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3);

// the setup function runs once when you press reset or power the board
void setup() {
  lcd.init(); 
  lcd.backlight();
}

// the loop function runs over and over again forever
void loop() {
  lcd.setCursor(3, 0); // set the cursor to column 3, line 0
  lcd.print("SunFounder");  // Print a message to the LCD
  
  lcd.setCursor(2, 1); // set the cursor to column 2, line 1
  lcd.print("Hello, World!");  // Print a message to the LCD.
}

Flashed successfully, but the display is dimmed and shows nothing, despite the fact that earlier I had used the same sketch to learn how to plug such LCD (yes, I'm a newbie), and then It worked flawlessly.

If you can upload, bootloader is fine.

Which pins did you connect the display to? A4/A5 or SDA/SCL? If A4/A5, they ain't the I2C pins on the Leonardo.

There is an I2C scanner sketch; you can run it to determine what the address is of the I2C display. If it did not find anything, check the wiring.

Does your LCD/shield have a potentiometer to adjust contrast? Play with that and see if you can get something showing.

That's all that I can come up with.

1 Like

I flashed the scanner. The serial monitor message says that no I2C devices have been found. Eventually, I checked the wiring a third time, and it turned out it was the problem. I probably did not notice that before since I used the same color of wire for GND and pin 7. FYI -- yes, I feel terrible about that :face_with_thermometer:.
Anyway, I want to thank you beautifully for your help and suggestions at least I did not waste my time trying to burn the bootloader :+1: :+1:

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