0
\$\begingroup\$

i program my atmega with USBasp ,and i set the fuse bits hfuse:0xC9 and lfuse :0xff. when i upload my simple code

int main(void)
   {
       DDRB |= 1<< PINB1 ;

       PORTB|= 1<<PINB1;
       while (1) 
            {


            }
  }

the MCU keeps resetting(led keeps blinking), i tried using usbasp as power supply and also i tried using 9v volt battery with regulator but still the same problem ( and i have 0.1uf capacitor between vcc and ground and pullup resistor in the reset pin). i also bought a new atemga328p ( i thaught the other is dead) but always the same problem.

\$\endgroup\$
  • 7
    \$\begingroup\$ Is the watchdog (de-)activated? \$\endgroup\$ – Janka Jan 22 '18 at 10:52
  • \$\begingroup\$ thanks man , i changed hfuse to 0xD9 then reset it and it worked fine \$\endgroup\$ – Mourad Jan 22 '18 at 11:20
  • \$\begingroup\$ @Janka your comment was spot-on. Perhaps you could post an answer so that OP can choose whether to accept it \$\endgroup\$ – clabacchio Jan 22 '18 at 15:09
  • \$\begingroup\$ It was a lucky guess … nothing more. \$\endgroup\$ – Janka Jan 22 '18 at 15:31
2
\$\begingroup\$

Solution is set to set hfuse to hfuse:0xD9 instead of 0xC9 , to unprogram the watchdog

\$\endgroup\$
  • \$\begingroup\$ You can mark your own answer as accepted. \$\endgroup\$ – Bence Kaulics Feb 4 '18 at 11:16

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.