Atmel studio flashes and verfies upload but code dosen't seem to execute

Hi, new to the bare metal scene. i am using the atmel studio 7 with a usbasp programmer and i am having the same problem. here is my code.

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    /*Set to one the fifth bit of DDRB to one
    **Set digital pin 13 to output mode */
    DDRD = 0xFF;
    /* Replace with your application code */
    while (1)
    {

        PORTD  = 0xFF;

        _delay_ms(50);

PORTD = 0x00;

_delay_ms(50);
}
}

the output console gives this message but the port D LED does not flash.

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude.exe: Device signature = 0x1e9502 (probably m32)
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: reading input file "Debug\GccApplication1.hex"
avrdude.exe: input file Debug\GccApplication1.hex auto detected as Intel Hex
avrdude.exe: writing flash (162 bytes):

Writing | ################################################## | 100% 0.27s

avrdude.exe: 162 bytes of flash written
avrdude.exe: verifying flash memory against Debug\GccApplication1.hex:
avrdude.exe: load data flash data from input file Debug\GccApplication1.hex:
avrdude.exe: input file Debug\GccApplication1.hex auto detected as Intel Hex
avrdude.exe: input file Debug\GccApplication1.hex contains 162 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 0.13s

avrdude.exe: verifying ...
avrdude.exe: 162 bytes of flash verified

avrdude.exe: safemode: Fuses OK (E:FF, H:99, L:E1)

avrdude.exe done.  Thank you.

Please help. thank you so much.

What is board you are using?

im using a standalone atmega32 avr chip with just the external crystal. im sorry i didnt know where tro post this problem and was kinda desperate lol.

Your statement "port D LED" is rather strange. The LED is not connects to the whole port, it is connects to a separate pin. In your program, you also change the state of the entire port at a time. Do you understand the difference between a port and a pin?

What pin do you use to test either code runs or not?

i used the pin PD6. I mean if the entire port is turned on shouldnt the pins be turned on too?
srry i am not an engineer .im learniung this stuff only now.

Yes, you are right, it is normal if you understand how it works.

Sorry my question, i was just wondering if you are connecting LED to the port D pin.

And also - do you use a resistor for the led?

im sorry i dont understand.please help me any ideas why this might be happening?

As far as I can see you understand correctly - turning whole the port ON is turning each pin also

oh ok. thanks. but the problem still persistes. the LED dosent blink this means that the code is not being executed as yoiu said the pins are active.

do you use a resistor for the led?

no. but i have noticed the led can take the digital output even without a current limiter in other circuits. ill try nevertheless. just tried, not working

as far as i understand the chip dosent require a bootloader right? if im using usbasp. just asking so i can rule that out as an issue

these were erroneous circuits.
If you use led without resister you can easily fry the pin of your controller.
Add the resistor of 300-500 Ohm and change the pin, may be you damaged it already.

just tried, not working.

Sorry, no more ideas

oh its ok. thanks for your time. really appreciate it

bro got it working. it was a wiring problem. god dammit its always a wiring problem.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.