LGT8F328P
LGT8F328P
by Ricky Gai
Revision 2.1
FEBRUARY 9, 2021
Introduction
About this Book
This book is about hands-on information documented to illustrate the use of LGT8F328P chips that
tested and run successfully on Arduino sketch projects using Arduino C/C++ programming language.
In the learning of Arduino platform and compatible microcontrollers, there often lack of information,
incomplete online help comments, circuitry implemented may not be the same result as the original
circuit diagram and many different MCU libraries required to compile sketch, where can easily
forgotten.
Therefore, I decided to write this book to document steps that went through before and solutions
found. It is not perfect, but with necessary guidelines to get through and move on.
LGT8F328P LQFP32 and SSOP20 MiniEVB were adopted in this book as to facilitate the learning
process, and we do want to build something optimum at the end.
To understand this book, reader should be familiar with Arduino IDE, basic electronics fundamental,
PCB design and C/C++ software programming
Ricky Gai
is the founder and technical director of Nexuz Innovation, a small R&D IT company established in
Kuala Lumpur, Malaysia.
After receiving certification from Oxford Computer Engineering discipline in 1992, my carreer was
mostly exposed to C/C++ system software development for decades about 30 years, since the MS-
DOS time until today’s Windows environments including real-time, networking, file system, 2D/3D
games, software driver, application and mobile programming.
Nevertheless, much spare time devoted to further the electronics studies for two years before coming
to Arduino platform, and my wife often staring at me. Arduino programming reminded me the MS-
DOS season, it brought back memory of something like interrupt, vector and bootsector ( eg.
Bootloader in Arduino ).
All the reference materials and source code are available via Github at:
https://github.com/rickygai/arduino
For any errors found, suggestions and questions, please do email to:
[email protected]
Well, passion is everything and the key to success, I hope you find something useful here.
DISCLAIMER
Abbrevation Descriptions
READER / READER(S) / READER’S refers to the person who read or knowledge transferred, accessed the
circuitry setup based on the contents illustrated in this document.
COMPONENTS / EQUIPMENTS refers to electronics components, tools, materials that used as part of the
circuitry setup.
CONTENTS Information described within the document, including software and hardware
solutions or mathods described by the author.
IP / INTELLECTUAL PROPERTY / refers to the copyrighted materials ( eg. Photo, Diagram, Source Code, Links )
COPYRIGHT / PERMISSION that owned by other creators.
THE COMPANY NEXUZ INNOVATION AND THE AUTHOR BARES NO RESPONSIBILITY UPON ANY
DAMAGE OR HARM IN CASE HAPPENS TO THE READER(S) OR READER’S SIDE, THIS INCLUDE
READER’S RELATED SUCH AS HUMAN HEALTH, HARDWARE EQUIPMENTS AND OTHER LOSSES.
THE AUTHOR RESPECTS THE INTELLECTUAL PROPERTY FROM OTHER CREATORS, THIS
DOCUMENTATION MAY SHARE SOME PARTLY EXTRACTED PORTION OF PHOTO OR DIAGRAM AS
PART OF THE ILLUSTRATION USAGE. IF THERE IS ANY COPYRIGHT INFRINGEMENT, PLEASE DO
INFORM THE AUTHOR TO EXCLUDE FROM THIS DOCUMENT.
Physical Layout
Pinout
Physical Layout
Same as above.
Pinout
Prerequisition
Arduino IDE - Setup the LGT8F328P library
It is very important to configure the installed LGT8F328P libraries as to appear There are many versions of LGT8F328P
under the Arduino IDE menu outstandingly such as below: libraries built by different authors. Here,
I choose to install three board libraries
from:
Logic Green
Ralph Bacon
David Buezas
Figure 8: The default attribute name=“Arduino AVR Boards” To solve this problem, I edited three of
the platform.txt files and renamed the
attribute “name=” of each file
respectively to something like below:
C:\arduino-
1.8.13\hardware\LGT\avr\platform.txt
C:\arduino-1.8.13\hardware\Ralph
Bacon\avr\platform.txt
C:\arduino-1.8.13\hardware\David
Figure 9: The default attribute name=“Arduino AVR Boards”
Buezas\avr\platform.txt
Introduction
Figure 10: LarduinoISP working circuitry setup Figure 11: LGT/LarduinoISP extracted diagram
Really wasted much time on it, no one from the Arduino Forum can
gives me at least a snapshot photo of how to setup the physical
circuitry correctly.
#define SERIAL_RX_BUFFER_SIZE 64
to:
Components Quantity
LGT8F328P LQFP32 MiniEVB 1
LGT8F328P SSOP20 MiniEVB 1
FTDI FT232RL 1
RESISTOR 10kΩ 1
10 cm Female-to-Male Jumper Wire 5
10 cm Female-to-Female Jumper Wire 5
10 cm Male-to-Male Jumper Wire 1
USB 2.0 Micro B cable connector 1
USB 2.0 Mini B cable connector 1
MB102 Mini Breadboard 8.5CM x 5.5CM 400 Holes 2
Illustrations Descriptions
Illustrations Descriptions
Figure 14: Selecting the LGT8F328P LQFP32 Serial Port Figure 15: LGT8F328P LQFP32 Serial Port
under Device Manager
Updating HardwareSerial.H
C:/arduino-
1.8.13/hardware/arduino/avr/cores/arduino/HardwareSerial.h
Descriptions
12. If the LarduinoISP sketch is successfully uploaded to ISP Programmer ( LGT8F328P LQFP32 MiniEVB ), you should
be seeing messages below:
Figure 19: The success messages of LarduinoISP sketch uploaded to ISP Programmer
Illustrations Descriptions
Illustrations Descriptions
Descriptions
22. If the BOOTLOADER is successful, you will see the message below:
Figure 24: The success messages of burning BOOTLOADER to Target LGT8F328P SSOP20 MiniEVB
Descriptions
30. Here, we are to upload a sketch called blink64ms.ino to the LGT8F328P SSOP20 MiniEVB since the Bootloader
already written, if it is working normally after a reset, the Bootloader should starts and jumps to the program
address where the blink64ms.ino program will be loaded and run.
31. Select the correct Port COM22 ( FT232RL ) from the menu as shown below:
32. At Arduino IDE, open the blink64ms.ino sketch then click the button to upload sketch.
33. If it is uploaded successfully you will notice the blue LED will blink faster continuously.
34. The success messages after blink64ms.ino sketch uploaded to LGT8F328P SSOP20 MiniEVB will look like below:
Figure 30: The success messages of uploading blink64ms.ino sketch to LGT8F328P SSOP20 MiniEVB
35. DONE.