Some time ago, I bought a set of Haoxiang ToF module and 4-in-1 ESC for RMB 48 (picking up trash), which contains 4 ATMEGA328P-MU microcontrollers, so I drew this Arduino development board.
This project is based on this solution verification board, adding a serial port download module, TYPE-C interface, etc.
The role of bootloader
Arduino boots the burning program through a pre-written bootloader. Every time a program is downloaded to the Arduino board through the serial port, the Arduino board will be reset first, so that the bootloader is entered first, and then specific download instructions are sent to the Arduino board. After the bootloader recognizes these instructions, it will start to receive the remaining program. The new program code is written into the internal flash. If the bootloader does not recognize the download instruction, it will jump to the program area and work normally.
There is no bootloader in the newly shipped microcontroller, so you need to burn it in yourself.
Two methods to burn bootloader
Two ways:
Arduino programming bootloader: https://www.jianshu.com/p/2f274f8b3dab
How to make your own Arduino development board: http://www.basemu.com/how-to-make-an-Arduino-clone-board.html
It is recommended to buy this kind. The other one I bought cannot be used.
Open the PROGISP software, select the chip model, and connect the USBISP downloader to the Arduino development board:
ISP Downloader--Target Board
MISO-----MISO
VCC------5V
SCK------SCK
MOSI-----MOSI
RST-------RST
GND------GND
Click to load Flash and select the D:Program FilesArduinohardwarearduinoavr ootloadersatmega folder under the arduino installation directory
If the crystal oscillator used by your development board is 8MHz , then choose ATmegaBOOT_168_atmega328 _pro_8MHz .hex
If the crystal oscillator used by your development board is 16MHz , then choose ATmegaBOOT_168_atmega328.hex
The author uses 16MHz, so I chose ATmegaBOOT_168_atmega328.hex
The bootloader file must match the crystal oscillator, otherwise you will not be able to use the serial port to download the program!
Open the Tools -> Programmer of the arduino IDE and a list of all supported programmers is displayed. It is recommended to use the Arduino as ISP method, which is relatively simple and has a high success rate.
Arduino as ISP is simply to use another Arduino board, download a special program to it in the normal way , turn it into an ISP downloader, and then connect its corresponding pins to the board to be programmed with the bootloader , and then through Arduino IDE is used to control bootloader programming . Here italics show the three steps.
ISP board |
target board |
---|---|
MISO/12 |
MISO/ICSP-1 |
Vcc/5V |
Vcc/ICSP-2 |
SCK/13 |
SCK/ICSP-3 |
MOSI/11 |
MOSI/ICSP-4 |
10 |
Reset/ICSP-5 |
GND |
GND/ICSP-6 |
The actual connection circuit is as follows. The left side is the ISP board, connected to the computer, and the right side is the target board waiting to download the bootloader.
Reference: https://www.jianshu.com/p/2f274f8b3dab
Open Blink in the example and use the USB-TTL downloader to connect to the Arduino development board:
Downloader--Arduino development board
GND---GND
RXD---D1 (TXD)
TXD---D0 (RXD)
5V------VCC
The author uses a 16MHz crystal oscillator . Select the download method as shown below. 8MHz selection (3.3V, 8MHz), the chip supply voltage is 3.3V
Notice:
This 0.1uF capacitor realizes automatic downloading without pressing the RESET button every time it is downloaded.
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet