LGT8F328P LQFP32 SSOP20 BootLoader burning issues.

Hi,

I came across several bootloader burning to LGT8F328P articles using:

  1. LarduinoISP which now supporting LGT8F328P.
  2. David Buezas LGT8FX optiboot_lgt8f328ps20.hex and optiboot_lgt8f328p.hex
  3. ArduinoISP reference page.

The circuit is setup like this image: LarduinoISP circuit.

  1. I have uploaded LarduinoISP sketch successfully to Arduino Nano ( Programmer ), with LGT8F328-SSOP20 as Target.

  2. However, when Arduino IDE’s “Burn Bootloader” is clicked with “AVR ISP” as programmer, error messages shown as below:

C:\arduino-1.8.13\hardware\tools\avr/bin/avrdude -CC:\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM25 -e -Ulock:w:0x3f:m -Uefuse:w:0x07:m -Uhfuse:w:0xff:m -Ulfuse:w:0xff:m

avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000 (retrying) Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000 (retrying) Error while burning bootloader. Reading | ################################################## | 100% 0.01s

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.

I also specified “-F” parameter option to avrdude.exe but result still the same.

It just won’t work under Arduino IDE when “Burning Bootloader” is activated and is not stable, if you activate the second times, it shown error messages below:

C:\arduino-1.8.13\hardware\tools\avr/bin/avrdude -CC:\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM25 -e -Ulock:w:0x3f:m -Uefuse:w:0x07:m -Uhfuse:w:0xff: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:\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf”

Using Port : COM25
Using Programmer : stk500v1
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0

avrdude done. Thank you.

Error while burning bootloader.

It is confirmed that the serial port COM25 is listed under device manager.

  1. I also shorted the RST and GND pins of Arduino Nano with a 10µF capacitor but no different, result still the same.

  2. Later I run avrdude.exe via command line with programmer set to “arduino”:

avrdude -CC:\arduino-1.8.13\hardware\tools\avr\etc\avrdude.conf -carduino -v -patmega328p -PCOM25 -e -Ulock:w:0x3f:m -Uefuse:w:0x07:m -Uhfuse:w:0xff: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:\arduino-1.8.13\hardware\tools\avr\etc\avrdude.conf”

Using Port : COM25
Using Programmer : arduino
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.01s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: erasing chip
avrdude: reading input file “0x3f”
avrdude: writing lock (1 bytes):

Writing | | 0% 0.00s ***failed;
Writing | ################################################## | 100% 0.08s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:

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

avrdude: verifying …
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x3f
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done. Thank you.

  1. Which programmer suppose to use “stk500v1” or “arduino” under the “-c” parameter of avrdude.exe as the Arduino Nano is as Programmer with LarduinoISP sketch running in this case ?

Please help if anyone successfully burn BOOTLOADER into LGT8F328P chip.

Thank you.

Try selecting

rickygai:
2. However, when Arduino IDE's "Burn Bootloader" is clicked with "AVR ISP" as programmer

I think this is the problem. Try it again with Tools > Programmer > Arduino as ISP selected.

hi Pert, I have added new “Arduino as ISP” into C:\Users<username>\AppData\Local\Arduino15\packages\LGT8fx Boards\hardware\avr\1.0.6\programmers.txt as shown below, but result still the same.

arduinoasisp.name=Arduino as ISP
arduinoasisp.communication=serial
arduinoasisp.protocol=stk500v1
arduinoasisp.speed=19200
arduinoasisp.program.protocol=stk500v1
arduinoasisp.program.speed=19200
arduinoasisp.program.tool=avrdude
arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}

Error message after “Burn Bootloader” is activated with programmer set to “Arduino as ISP”, actually if looks carefully Arduino IDE still using “-cstk500v1”:

C:\arduino-1.8.13\hardware\tools\avr/bin/avrdude -CC:\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM25 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0x07:m -Uhfuse:w:0xff: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:\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf”

Using Port : COM25
Using Programmer : stk500v1
Overriding Baud Rate : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x61
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x76
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x72
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x69
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x73
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x70
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x28
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x29
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x2e
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x2e

avrdude done. Thank you.

Error while burning bootloader.

rickygai:
hi Pert, I have added new “Arduino as ISP” into C:\Users<username>\AppData\Local\Arduino15\packages\LGT8fx Boards\hardware\avr\1.0.6\programmers.txt as shown below

Great work! I hadn’t checked to see whether the LGT8fx Boards platform already provided this programmer. The Arduino IDE was recently changed so that each platform must provide its own programmer definitions, as opposed to the old system where every programmer of every platform was accessible all the time. Some of the platform authors haven’t yet added in the necessary programmer definitions.

rickygai:
actually if looks carefully Arduino IDE still using “-cstk500v1”

At least with the standard Arduino as ISP, this is as it should be when running on the classic Arduino Nano. Are you using the classic Nano, or one of the newer Nanos (Nano Every, Nano 33 IoT, Nano 33 BLE)?

You can change the “arduinoasisp.protocol=stk500v1” and “arduinoasisp.program.protocol=stk500v1” lines to use the “arduino” protocol if you like. My experience is that using the “arduino” protocol makes the “avrdude: stk500_getsync() attempt 1 of 10: not in sync:” error more likely to occur. The reason is because it triggers the auto-reset circuit on the Arduino boards that have one, but if you have the reset disabling capacitor connected that should be no problem. Do you still have that capacitor connected?

Do you still have that capacitor connected ?
- I tried, if 10****µF capacitor connected, still the same result as shown just now.
- The 10µF I put like THIS, not sure is correct or not ?

Are you using the classic Nano ...
- I am using clone version of Arduino Nano v3, with new bootloader C:\arduino-1.8.13\hardware\arduino\avr\bootloaders\optiboot\optiboot_atmega328.hex burned via AVRISP MKII.

My experience is that using the "arduino" protocol makes the "avrdude: stk500_getsync() attempt 1 of 10: not in sync:" error more likely to occur.
- My situation is the reverse, as you can see from the mentioned statements and results, even if "-c arduino" used, still stuck at error messages:

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x3f
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

rickygai:
I am using clone version of Arduino Nano v3

OK, for this application it's equivalent to the classic Nano. The reason I asked is because the newer Arduino boards don't use the auto-reset circuit, and those do require the "arduino" protocol.

rickygai:
My situation is the reverse, as you can see from the mentioned statements

I'm sorry to see that.

Unfortunately, I don't have any experience with the LGT8fx or LarduinoISP. I have one of the LGT8fx boards, but I've never done anything other than a basic blink. All of the advice I've provided so far has been based on me assuming that the same approached used with the real ArduinoISP sketch and real AVR chips can be used with LarduinoISP and LGT8fx, but I have already found that expectations of seamless compatibility between the two architectures are too often not fulfilled.

Hopefully one of the other forum members will be able to provide better assistance.

Pert, no problem, thanks for the feedback, appreciated :slight_smile: I only doubted how LarduinoISP can be used successfully, may be I am still new to Arduino, as not many references found.

Anyone that successfully burned BOOTLOADER to LGT8F328P chip, do share your valuable knowledge here.

Thank you.

I used the LarduinoISP.ino sketch and schematic from this page.

hi hmeijdam,

I followed the LarduinoISP diagram from your old post mentioned but I still cannot get it working.

  1. Before you click the “Burn Bootloader” from Arduino IDE, do you plug in the 10uF capacitor to short-circuit both RES and GND pins of Arduino Nano ( Programmer ) in this case ?

  2. There are two sides with RES and GND ( on Arduino Nano ), do you short-circuit both sides with two 10uF capacitors ?

  3. Can you check my LarduinoISP circuit setup HERE to see if there any mistake ?

  4. Do you still have your LarduinoISP physical setup circuit photo captured ? I there is, will it be ok to share here for reference ?

  5. Which CS or SS pin of LGT8F328P you are connecting to, pin 10 or 4 ?

Please advise.

I suspect something has changed since I last uploaded sketches to it. I now own an SWDICE MKII programmer, so do not use the LarduinoISP solution anymore.
For now the only way I can burn the bootloader is by installing the LGT8FX package from David Buezas

He mentions that you need another LGT328 board to make it a programmer, which I can confirm.

When I try to turn an Atmega328 based NANO into the ISP programmer I can't get it to work. I tried different versions of the LarduinoISP sketch. [EDIT] It works if you change the serial RX buffer from 64 to 250

When I swap the Atmega328 NANO for below green LGT328p NANO clone It works flawless.


I don't even need the capacitor nor the 10K pullup resistor and can burn sketches to it (overwriting the bootloader) and I can use "Burn Bootloader".

hi hmeijdam,

I am unsure how your circuit setup that won’t works on Arduino Nano as ISP because further trial-n-error, I manage to burn the BOOTLOADER to LGT8F328P SSOP20 MiniEVB either using Arduino Nano or LGT8F328P LQFP32 MiniEVB as LarduinoISP.

I am in the mid preparing the Github to share the information so others can see the physical circuit setup. Once the Github project is ready, I will post a link here.

Thank you.

I looked better at the decriptions that David Buezas offered ant the difference is that when you select the Arduino Nano in your boards manager the hardware serial read buffer is 64

That buffer needs to be 250.

So I changed

#define SERIAL_RX_BUFFER_SIZE 64

into

#define SERIAL_RX_BUFFER_SIZE 250   // for LarduinoISP to work

in "HardwareSerial.h"
in directory E:\Arduino\arduino-1.8.13\hardware\arduino\avr\cores\arduino
(I have portable installations of many different Arduino IDE's, so it may be in a different folder on your PC)

Then I compile/upload the LarduinoISP sketch for the Arduino Nano (or UNO) and can use it as ISP for the LGT board.
Finally I undo my modification of the buffer size increase (as it increases the size of the compiled binary).

Yes, that's great.

There is another site at HERE under the "usage" section, it mentioned the edit of HardwareSerial.H as well.

Cheers :slight_smile:

Dear friends,

I just uploaded a LGT8F328P.PDF document to my Github HERE. The file LGT8F328P.PDF contains some guidelines and information that physically tested and working with LarduinoISP, neccessary to burn BOOTLOADER successfully.

Hope this help ???

Thank you.

rickygai:
Dear friends,

I just uploaded a LGT8F328P.PDF document to my Github HERE. The file LGT8F328P.PDF contains some guidelines and information that physically tested and working with LarduinoISP, neccessary to burn BOOTLOADER successfully.

Hope this help ???

Thank you.

How to lock fuses of LGT8F328?

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