Answer the question
In order to leave comments, you need to log in
What could be the error with atmega328p firmware?
There is an atmega328p microcontroller.
I connect usbasp according to this scheme:
Code for blinking LEDs:
#include <avr/io.h>
#include <util/delay.h>
#define MIG 300
#define VD PORTD
int main(void)
{
DDRD = 0b000000011;
while (1)
{
VD = 0b000000001;
_delay_ms(MIG);
VD = 0b000000000;
_delay_ms(MIG);
VD = 0b000000010;
_delay_ms(MIG);
VD = 0b000000000;
_delay_ms(MIG);
}
}
Answer the question
In order to leave comments, you need to log in
Zero - IC "clean-from-factory" or used? See comment mordo445 . If from the factory, then it works from an internal RC generator with a frequency of 1 MHz. If used - any options are possible. Try feeding the XTAL1 about 1 MHz through a 51-150 ohm resistor.
First of all , you should ensure that the IC identification is read correctly (signature = 0x1E 95 0F). This will show that the IC clock generator is working and that data is being exchanged between the programmer and the IC correctly. Please note that the clock frequency of the exchange between the programmer and the IC must be 4 or more times lower than the clock frequency of the IC. Try in the settings of the programmer to reduce the exchange rate to a minimum.
Two - check the IC configuration (read the fuse bit). See comment mordo445. If necessary, change. Seven times measure cut once. There is a risk of "bricking" the IC. Especially - an incorrect setting of the RSTDISBL bit.
Three - profit?
Use the advice of Armenian Radio .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question