M
M
Maly2022-03-19 11:28:51
Electronics
Maly, 2022-03-19 11:28:51

What could be the error with atmega328p firmware?

There is an atmega328p microcontroller.

I connect usbasp according to this scheme: 623593fb560f5109774149.jpeg

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);    

  }

}


Firmware via avrdude 3.3.

Gives an error when reading mk. with the 'Error' box. Has anyone encountered a similar error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VT100, 2022-03-19
@VT100

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 question

Ask a Question

731 491 924 answers to any question