0
\$\begingroup\$

I tried to build a test circuit based on the Book "AVR Programming". It is very simple and shown here:

enter image description here

The circuit itself is working and the upload of my code as well:

#include <avr/io.h>                        /* Defines pins, ports, etc */
#define F_CPU 1000000UL
#include <util/delay.h>                     /* Functions to waste time */


int main(void) {

  DDRB |= 0b00000001;            

  while (1) {

    PORTB = 0b00000001;
    _delay_ms(1000);
    PORTB = 0b00000000;
    _delay_ms(1000);                                              

  }                                       
  return 0;                            
}

but the LED is not blinking. The LED in the lower right is lighting up so the circuit seems fine. There are no error messages in ATMEL Studio and the circuit setup seems fine to me. The hex file flashes correctly onto the chip. I even changed the LED and the ATMEL chip to a new one and still the same result. I am running out of debugging ideas.

enter image description here

The fuse settings and avrdude output:

avrdude.exe: Version 6.3, compiled on Feb 17 2016 at 09:25:53
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

             Using Port                    : usb
             Using Programmer              : usbtiny
avrdude.exe: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
             AVR Part                      : ATmega328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 200
             StabDelay                     : 100
             CmdexeDelay                   : 25
             SyncLoops                     : 32
             ByteDelay                     : 0
             PollIndex                     : 3
             PollValue                     : 0x53
             Memory Detail                 :

                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

             Programmer Type : USBtiny
             Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude.exe: programmer operation not supported

avrdude.exe: Using SCK period of 10 usec
CMD: [ac 53 00 00] [ac 52 53 00]
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | CMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 95]
################CMD: [30 00 02 00] [00 30 00 0f]
################################## | 100% 0.01s

avrdude.exe: Device signature = 0x1e950f (probably m328p)

avrdude.exe done.  Thank you.

The AVRDUDE command line I am using:

avrdude -c usbtiny -p m328p -v -v -v -u flash:w:Test.hex:i
\$\endgroup\$
  • 1
    \$\begingroup\$ Possible reasons: Broken Led or Led not wired correctly. What does your actual circuit look like. A in focus picture of your breadboard is important. \$\endgroup\$ – Passerby Apr 22 '17 at 18:34
  • \$\begingroup\$ Just added the picture \$\endgroup\$ – sesc360 Apr 22 '17 at 18:41
  • \$\begingroup\$ it is so strange that there is no error showing up. Neither when programming the chip nor das the wiring and schematic seems abnormal. \$\endgroup\$ – sesc360 Apr 22 '17 at 18:42
  • \$\begingroup\$ Swap the red and green leds. Does anything change? \$\endgroup\$ – Passerby Apr 22 '17 at 18:45
  • 1
    \$\begingroup\$ The ATmega168 (/328/328p, etc) has two supply pins (AVCC and VCC) and two ground pins, and you must connect all of them. Even when you are not using the "analog" features, you still must power that part of the chip. \$\endgroup\$ – Chris Stratton Sep 14 at 5:19
0
\$\begingroup\$

Make sure the nRESET line is not floating after the programming has finished.

Typically you want a 10k pull-up resistor from pin 1 to VCC.

\$\endgroup\$
  • \$\begingroup\$ Hm... as I have the MOSFET in there it should not float right? \$\endgroup\$ – sesc360 Apr 22 '17 at 18:45
  • \$\begingroup\$ I just removed the MOSET and now it is exactly the same as the schematic. Still no change \$\endgroup\$ – sesc360 Apr 22 '17 at 18:53
  • \$\begingroup\$ @sesc360, Then try adding the pull-up resistor. Failing that, it could be your fuse settings. What fuses are you using? \$\endgroup\$ – Wossname Apr 22 '17 at 18:54
  • \$\begingroup\$ added the avrdude output \$\endgroup\$ – sesc360 Apr 22 '17 at 18:57
  • 1
    \$\begingroup\$ really strange thing just happened. used AVR from CMD and now its running \$\endgroup\$ – sesc360 Apr 22 '17 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.