Step 1: Hardware Preparation
1.ATMEGA8L-8PU avr microcontroller (Figure 1)
figure 1
2. USBasp (a tool for burning bootloader) (Figure 2, top)
3. USB to TTL serial cable (I use the FT232 chip, which has better stability and is used to load programs under Arduino) (Figure 2 below)
figure 2
4. 16M crystal, breadboard, LED, etc., and some Dupont cables
There may be a question here: Why is ATMEGA8L-8PU equipped with a 16M crystal oscillator?
The reason is this: in principle, the ATMEGA8L-8PU uses a maximum 8M crystal oscillator, but the bootloader of the M8 platform used in Arduino is compiled based on ATMEGA8 and uses a 16M crystal oscillator; I don't have an ATMEGA8 chip (note that the chip I use has an "L" at the end), and I don't know how to recompile the bootloader, so I have to equip the existing ATMEGA8L with 16M. Although it is "overclocked", no problems have been found in the current experiment.
Step 2: Software preparation (download from Baidu)
1.arduino的IDE:arduino-1.0.5-r2
2. USB asp driver and serial port line driver (please note that you need to download the driver for the chip corresponding to your serial port line)
3. progisp (this is the software used to burn the bootloader)
Note: After installing USB asp, you must copy the two files libusb0.dll and libusb0.sys in the driver directory to the directory where the burning tool progisp.exe is located. In particular, there are multiple sets of libusb0.dll and libusb0.sys files in the driver file directory of USBasp, and you must choose the file that corresponds to your computer system.
For example, Figure 3 is the x64 driver directory. My computer is x64win7 with AMD CPU, and the two files I copied are under amd64. Of course, the computer with Intel CPU uses the two files in the ia64 folder.
Figure 3
Otherwise, the following problems may occur when burning the program:
Figure 4
Step 3: Build a Minimum System on a Breadboard
Wiring as shown in Figure 5
Figure 5
Actual example Figure 6:
Figure 6
Step 4: Use usbasp to burn the bootloader
After installing and connecting the USBasp driver, open the progisp software as shown in Figure 7
Figure 7
1. Select the chip as ATmega8
2. Open the HEX file of the bootloader, which is located in the Arduino IDE software's arduino-1.0.5-r2hardwarearduinobootloadersatmega8 directory. The file name is ATmegaBOOT-prod-firmware-2009-11-07.hex
3. Configure the fuse bit to 0xCADF. Note that incorrect fuse bit configuration may lock the chip.
4. Check the Program Fuse checkbox
5. Click the automatic button to start programming the chip. After programming is completed, the word "successfully" will appear in the box in the lower left corner of the software.
Step 5: Create the Flashing LED Code in Arduino IDE
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Figure 8
After entering the code, click the first "check mark" button in the IDE shown in Figure 8 to compile.
Step 6: Load the compiled program into the Atmega8 chip under Arduino IDE
1. Disconnect any connection between USBasp and the breadboard (this is important, otherwise the download will fail. Of course, if the bootloader is downloaded correctly, you can use USB to TTL to download Arduino programs in the future, and USBasp will not be needed).
2. Connect the VCC and GND of USB to TTL to the corresponding pins of Atmega8L chip. Connect the TXD of USB to TTL to the RXD of ATmega8L, and the RXD of USB to TTL to the TXD of ATmega8L, refer to Figure 6.
3 Connect a light-emitting diode on the breadboard: the positive pole of the light-emitting diode is connected to PB5 (pin 19) of ATmega8L, and the negative pole is connected to GND through a current-limiting resistor (about 500 ohms). (Refer to Figure 10, the current-limiting resistor is not connected in Figure 10)
4. Connect USB to TTL to PC. Then in Arduino IDE, click the menu selection Tool->Board->Arduino NG or older /W ATmega8, and then select Tool->Board->Serial Port and select the COM port corresponding to USB to TTL on your computer. See Figure 9.
Fig. 9
Fig.10
5. Finally, click the "→" button on the Ardunio IDE to start loading the program. At the same time, use a DuPont line to short-circuit the RST (first pin) of Atmega8L with GND on the breadboard to reset it (of course, it is most convenient to connect a button), and then wait for the download to complete.
6. After the download is complete: you can see the experimental results. The LED light turns on for one second, turns off for one second, and so on. If this is successful, it means that the bootloader correctly guides the download and operation of the program, and the Ardunio program itself is also correct.
Fig.11
At this point, a minimal Arduino development board has been made, and the first Arduino introductory program has been run. The implementation of subsequent Arduino programs and system expansion are up to everyone.
Figure: The correspondence between the PIN pins in Arduino and the pins of the Atmega8L chip.
Additional information:
There is a board type configuration file boards.txt in the installation directory arduino-1.0.5-r2hardwarearduino of Ardunio IDE. Some of the configuration codes are as follows
##############################################################
atmega8.name=Arduino NG or older w/ ATmega8
atmega8.upload.protocol=arduino
atmega8.upload.maximum_size=7168
atmega8.upload.speed=19200
atmega8.bootloader.low_fuses=0xdf
atmega8.bootloader.high_fuses=0xca
atmega8.bootloader.path=atmega8
atmega8.bootloader.file=ATmegaBOOT-prod-firmware-2009-11-07.hex
atmega8.bootloader.unlock_bits=0x3F
atmega8.bootloader.lock_bits=0x0F
atmega8.build.mcu=atmega8
atmega8.build.f_cpu=16000000L
atmega8.build.core=arduino
atmega8.build.variant=standard
##############################################################
Here you can see the configuration of the fuse bits, the crystal oscillator frequency, and the HEX file of the specified bootloader. This is why the fuse bits are configured as shown in the fourth step and the crystal oscillator must be selected as 16M.
Previous article:Production of Arduino minimum system based on atmega8 (Arduino uno as downloader)
Next article:Arduino - Minimal System (Based on ATMEGA8-16PU)
Recommended ReadingLatest update time:2024-11-16 14:36
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- MSP430F5529 key interrupt scanning and pwm program
- Hello, I need help, but it's not urgent. How can I send an email using ESP8266?
- Saiyuan MCU baby bed remote control system
- 6. System control scheme and algorithm design
- Considerations for selecting solid-state relays
- 【TouchGFX Design】Use TouchGFX buttons and message responses
- The delivery guy was on the parade. What do you think about the importance of hard work?
- The New Year is coming soon, so I would like to share with you some practical words.
- [Repost] Enter the top ten most commonly used electronic components, how many do you know? (Part 2)
- [NXP Rapid IoT Review] NO6. How to modify the rapid lot icon color and other modules