Many tutorials provide the use of Atmel Studio and MKII to burn AVR microcontrollers, but the most popular burner used by the public is the inexpensive USBasp, which is much more affordable at around 10 yuan than the 200 yuan MKII. However, USBasp cannot be used directly for burning in Atmel Studio, so other software is usually needed, which brings more trouble.
This article uses Atmel Studio's External Tools and Avrdude software to achieve the purpose of directly burning the microcontroller in Atmel Studio. This way, programming, compiling and burning can be completed in the development environment, which is very convenient.
Step 1: You need a USBasp and its driver. Drivers are everywhere on the Internet. You can ask for them from the store when you buy the module. You can install the driver by setting the driver search path in the device manager. After the driver is installed, libusb-win32 device will appear in the device manager. Click to hide and you will see the USBasp device. As shown in the figure.
Step 2: After installing the driver, you need to install the Avrdude software. The download page is here: http://download.savannah.gnu.org/releases/avrdude/
Windows system can choose to download the zip file. After decompression, there are two files, an executable file and a configuration file. Put them in the desired directory (need to be in the same directory). Try to keep the paths of these two files unchanged, otherwise you need to reconfigure the third step.
Step 3: Open Atmel Studio software, click the Tools menu, and select External Tools. First, configure the text boxes at the bottom of the interface. The Title is optional, I wrote USBasp. In the Command input box, enter (path/)(avrdude software name).exe. If it is placed in the root directory of the D drive and the executable file is named avrdude.exe, enter D:avrdude.exe. In the Argument input box, enter:
-c usbasp -p atmega16 -B12 -U flash:w:$(ProjectDir)Debug$(TargetName).hex:i
Note: The referenced original text corresponds to the last TargetName of the above instruction, using ItemFileName, so the .c program file name and .hex file name must be the same. If your .c file name is main.c, an error will be reported.
In addition, the -p parameter of the above command is the microcontroller model. I use atmega16, so you need to change it to your model.
After setting, click the Add button and it's done. Then the Title option you set will appear under the Tools menu, as shown below.
The USBasp option appears. After writing the program, you must press F7 to compile the solution, and then click this option. After that, the Avrdude command line interface will appear, and several progress bars will appear. If only one progress bar appears and the command line interface flashes by, it may be that the compilation failed. My method is to take a screenshot at the moment of clicking to see what the error is. You can also run Avrdude directly from the CMD command line, burn the .hex file, and see the error reported.
In addition, if the fuses have not been set for a new microcontroller, you need to set the fuses first, otherwise the microcontroller will use the 1MHz internal clock by default. The fuses only need to be set once, so you can use any software to set them once and for all. If there is no fuse setting software, you can also use Avrdude as mentioned above to set them. Using the command line, first navigate to the directory where avrdude.exe is located, and then execute the command. For example, I use the atmega16 chip and set LFuse to make the microcontroller use an external crystal oscillator:
avrdude -c usbasp -p atmega16 -U lfuse:w:0xCE:m
The fuse position can be calculated using the fuse position calculator: http://www.engbedded.com/fusecalc/
Problems that may arise:
1. The original article mentioned that there may be a problem with the path in the parameter command line. The solution is to remove the two double quotes.
2. If the command line prompts that usbasp cannot be found, check the driver or try reinstalling another driver.
Previous article:Programming AVR Microcontrollers and Arduino Boards Using Arduino ISP
Next article:ISP programming of AVR algorithm
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Ended | Live broadcast [Cloud-based secure authentication | Microchip embedded security solutions]
- Please tell me, how to make a dual power automatic switching circuit?
- Decimal to hexadecimal C language function
- MSP432E401Y SimpleLink Ethernet Microcontroller
- [AB32VG1 Development Board Review] Getting to Know the Development Board
- Simple driver for 64Mb PSRAM
- How to tell how many layers a PCB has
- [Sipeed LicheeRV 86 Panel Review] II. GPIO pins are brought out, RGB tri-color LED flashes
- Showing off the LTC3588 Energy Harvesting Development Board
- [LSM6DSOX finite state machine routine learning 2]--How to use finite state machine programming