Last month, I was tinkering with the Arduino minimum system. I accidentally changed the crystal fuse position incorrectly, causing an Atmega8A-PU chip to be unrecognizable. I consulted Baidu and learned that I needed to use a high-voltage programmer to restore the fuse. Although I found ready-made flashing equipment on Taobao, I searched Baidu for relevant information and found that it should not be difficult to DIY one. Then I bought relevant electronic components from Taobao according to the circuit diagram in the information (I can't help it, it's a small place, many things can't be bought, so I can only buy them online), and made some modifications. I didn't expect that I could make it. Now I will share some of the production process. First, the finished board is as follows:
Let's talk about the production process. The entire production process mainly refers to the following relevant materials
http://jingyan.baidu.com/article/22a299b53e2ab89e19376a05.html
http://mightyohm.com/blog/2008/09/arduino-based-avr-high-voltage-programmer/ (This is a bird article page. It seems that the Baidu page above also translates the content here. You need to climb over the firewall to browse it. Why? Don’t ask me. I don’t know why technical forums also require climbing over the firewall.)
The materials for making are as follows:
1. A piece of perforated board of suitable size
2. Several 1K capacitors
3. One 2N3903 or 2N3904 transistor
4. Switch one
5. LED and other
6. One 28-pin chip holder
7. Several connecting wires
8. A 12V DC power supply device (since the high-voltage programmer requires an external 12V DC power supply, I used a boost module bought from Taobao to connect to a battery)
First, solder the electronic components to the perfboard according to the circuit diagram below.
The chip pins on the left in the picture correspond to the Arduino UNO, and the pins on the right correspond to the chip pins to be restored (i.e. the 28-pin chip socket). For the specific pin order, refer to the figure below.
After the circuit is connected, flash the recovery code into Arduino. The guy in Baidu Knowledge did not share the code file, but I found the code on that bird website. For the convenience of brothers who cannot climb over the wall, I now share the code here for your convenience.
/*
HVFuse - Use High Voltage Programming Mode to Set Fuses on ATmega48/88/168
09/23/08 Jeff Keyzer http://mightyohm.com
The HV programming routines are based on those described in the
ATmega48/88/168 datasheet 2545M-AVR-09/07, pg. 290-297
This program should work for other members of the AVR family, but has only
been verified to work with the ATmega168. If it works for you, please
let me know! http://mightyohm.com/blog/contact/
*/
// Desired fuse configuration
#define HFUSE 0xDF // Default for ATmega48/88/168, for others see
#define LFUSE 0x62 // http://www.engbedded.com/cgi-bin/fc.cgi
// Pin Assignments
#define DATA PORTD // PORTD = Arduino Digital pins 0-7
#define DATAD DDRD // Data direction register for DATA port
#define VCC 8
#define RDY 12 // RDY/!BSY signal from target
#define OE 11
#define WR 10
#define BS1 9
#define XA0 13
#define XA1 18 // Analog inputs 0-5 can be addressed as
#define PAGEL 19 // digital outputs 14-19
#define RST 14 // Output to level shifter for !RESET
#define BS2 16
#define XTAL1 17
#define BUTTON 15 // Run button
void setup() // run once, when the sketch starts
{
// Set up control lines for HV parallel programming
DATA = 0x00; // Clear digital pins 0-7
DATAD = 0xFF; // set digital pins 0-7 as outputs
pinMode(VCC, OUTPUT);
pinMode(RDY, INPUT);
pinMode(OE, OUTPUT);
pinMode(WR, OUTPUT);
pinMode(BS1, OUTPUT);
pinMode(XA0, OUTPUT);
pinMode(XA1, OUTPUT);
pinMode(PAGEL, OUTPUT);
pinMode(RST, OUTPUT); // signal to level shifter for +12V !RESET
pinMode(BS2, OUTPUT);
pinMode(XTAL1, OUTPUT);
pinMode(BUTTON, INPUT);
digitalWrite(BUTTON, HIGH); // turn on pullup resistor
// Initialize output pins as needed
digitalWrite(RST, HIGH); // Level shifter is inverting, this shuts off 12V
}
void loop() // run over and over again
{
while(digitalRead(BUTTON) == HIGH) { // wait until button is pressed
}
// Initialize pins to enter programming mode
digitalWrite(PAGEL, LOW);
digitalWrite(XA1, LOW);
digitalWrite(XA0, LOW);
digitalWrite(BS1, LOW);
digitalWrite(BS2, LOW);
// Enter programming mode
digitalWrite(VCC, HIGH); // Apply VCC to start programming process
digitalWrite(WR, HIGH); // Now we can assert !OE and !WR
digitalWrite(OE, HIGH);
delay(1);
digitalWrite(RST, LOW); // Apply 12V to !RESET thru level shifter
delay(1);
// Now we're in programming mode until RST is set HIGH again
// First we program HFUSE
sendcmd(B01000000); // Send command to enable fuse programming mode
writefuse(HFUSE, true);
// Now we program LFUSE
sendcmd(B01000000);
writefuse(LFUSE, false);
delay(1000); // wait a while to allow button to be released
// Exit programming mode
digitalWrite(RST, HIGH);
// Turn off all outputs
DATA = 0x00;
digitalWrite(OE, LOW);
digitalWrite(WR, LOW);
digitalWrite(PAGEL, LOW);
digitalWrite(XA1, LOW);
digitalWrite(XA0, LOW);
digitalWrite(BS1, LOW);
digitalWrite(BS2, LOW);
digitalWrite(VCC, LOW);
}
void sendcmd(byte command) // Send command to target AVR
{
// Set controls for command mode
digitalWrite(XA1, HIGH);
digitalWrite(XA0, LOW);
digitalWrite(BS1, LOW);
//DATA = B01000000; // Command to load fuse bits
DATA = command;
digitalWrite(XTAL1, HIGH); // pulse XTAL to send command to target
delay(1);
digitalWrite(XTAL1, LOW);
//delay(1);
}
void writefuse(byte fuse, boolean highbyte) // write high or low fuse to AVR
{
// if highbyte = true, then we program HFUSE, otherwise LFUSE
// Enable data loading
digitalWrite(XA1, LOW);
digitalWrite(XA0, HIGH);
delay(1);
// Write fuse
DATA = fuse; // set desired fuse value
digitalWrite(XTAL1, HIGH);
delay(1);
digitalWrite(XTAL1, LOW);
if(highbyte == true)
digitalWrite(BS1, HIGH); // program HFUSE
else
digitalWrite(BS1, LOW);
digitalWrite(WR, LOW);
delay(1);
digitalWrite(WR, HIGH);
delay(100);
}
The code needs to be changed according to the flash chip
#define HFUSE 0xDF // Default for ATmega48/88/168, for others see
#define LFUSE 0x62 //
The above two lines are fuse bits, which need to be modified according to the restored chip. My chip is Atmega8A-PU. I found that it didn't work according to the modification in the data. I checked the fuse bits of the same model chip that can be used normally on hand. After changing it to the following content, I found that the chip was repaired normally.
#define HFUSE 0xDC
#define LFUSE 0xA4
After flashing the code, connect the perforated board and 12V power supply, the L light of UNO will light up, then press the switch on the perforated board, the light of UNO will turn off and then on, the chip should have been repaired normally, if the chip is still not repaired successfully, make sure the chip is not burned, check whether the fuse position is correct. Note that this device can only restore the fuse position, and cannot repair the burned chip. Finally, remind everyone to make sure that each soldering point is in place when soldering the perforated board, otherwise you will not know what the problem is when something goes wrong.
Previous article:atmega48 spi programming code
Next article:Atmega48 eeprom debug code
- Popular Resources
- Popular amplifiers
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
- Is 5G just about speed? Five aspects are more important than speed
- Search components
- [Shanghai Hangxin ACM32F070 development board + touch function evaluation board evaluation] + first look at the ACM32F070 development board
- Application of Sidelobe Blanking Technology in Radar
- [RVB2601 Creative Application Development] Dynamically load MBRE A fast implementation code of NTP with second-level accuracy
- Output waveform problem of integrator circuit
- Rockwell A4821 PMOS uC internal diagram
- ESP32-S2-Kaluga-1 Review Summary
- Some predictions about the national competition questions - about the quad
- Does anyone have a tutorial video on how to draw a PCB using Allegro? Can you share it?