I lost the bootloader. How to recover with TL886

Hello forum,
As the title mentions I strangely lost the function to load an Arduino UNO by the USB interface.
My system is Archlinux and I've planned to make a board with the only ATmega328P, so I'll get the power saving to the most. The project should run with the full swing oscillator, but I still not able to decipher the correct meaning of the fuses.
I reloaded one program with the bootloader, by the means of an universal programmer like the TL886A. The only problems comes with the fuse programming, which I'm unsure what was the Arduino default.
So actually I'm using 0xd6 for the hfuse, the remaining fuses I left at 0xff. When I plug the USB the LED blinks 3~4 times, then it remains still. Trying to program anything the arduino-cli (avrdude) will stuck and I've to kill the task.
My suspect is that the booatloader gets overwritten at the first boot.

That should be OK.

When I plug the USB the LED blinks 3~4 times, then it remains still. Trying to program anything the arduino-cli (avrdude) will stuck and I've to kill the task.

Do you have the auto-reset circuitry? Does the LED blink when you click your "upload" button?
Without the auto-reset circuitry, the first upload will work OK because the "application" is essentially a bunch of 0xFFFF instructions that run off the end (where the bootloader is.)

Does the LED blink when you click your "upload" button?

I can't even reach such point, the blinking is too short for starting even the upload.
Besides that I use a non graphic environment, so to start the uploading I have to give the ENTER to the command line.

Do you have the auto-reset circuitry?

What's that, the board is a normal Arduino with all the bells & whistles. :smile:

No, I'm not talking about uploading the Blink sketch. The LED should do it's 3 "rapid" blinks whenever the bootloader starts, and that SHOULD happen (in hardware) whenever you click the "upload" button, even if everything fails thereafter.

Thank you, westfw, for your support.
The "three blinks" are happening, but then the LED got still ON. But the news are that today I could write the sketch. What that made it possible is very mysterious.
So, after a couple of days without supplying the board , I saw the "three blinks" and then the LED gone OFF upon I plugged the USB. Avrdude didn't take much and started to write the sketch and completed.


arduino-cli upload -b arduino:avr:nano -p /dev/ttyACM0 -v -i $(find /tmp/ -iname Ard*ino.hex 2>/dev/null)
"/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-P/dev/ttyACM0" -b115200 -D "-Uflash:w:/tmp/arduino-sketch-6222F5FA7B6D3EAD75314B45B3A5EB03/ArduMeasure.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 "/home/user/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/home/user/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "/tmp/arduino-sketch-6222F5FA7B6D3EAD75314B45B3A5EB03/ArduMeasure.ino.hex"
avrdude: writing flash (11366 bytes):

Writing | ################################################## | 100% 1.82s

avrdude: 11366 bytes of flash written

So I would like to read the entire memory and see whether the commands got the fuses to default settings. But I doubt they got modified.

I still have to investigate what would be the cause and how to fix it.

For the standalone MCU I'd need to understand what should I put on the flash to make my program working. I presume that programming by the universal programmer the bootloader isn't strictly necessary. But I would like to know the fuses influence on a ATMega328 with a quartz. Maybe I have to change the oscillator for a full swing.
Yeah, I mean that I still have a doubt that the sketch is working when I uploaded by the TL886A.

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