nummy
Posts: 35
Joined: Tue Aug 14, 2012 12:07 am

ATMega Clearing

Tue Aug 06, 2013 11:51 pm

I was able to successfully load blinky.c on the ATMega on the gertboard and can program it just fine.

Now, how do I clear the program and stop the lights from blinking?

I tried rebooting the pi, but the program is still running. Tried moving pin 5 of programming header (J23) to ground to reset it, but that just restarts the program, thought it would clear it.

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: ATMega Clearing

Wed Aug 07, 2013 7:44 am

That is how computers work: when you remove the reset they start running a program**
You can clear the processor FLASH memory by but it will still run a program, the only difference will be
that it does not blink an LED so you don't see it running.

You can erase the flash by running the 'avrdude' program with the -e options (together with the other options)
I think the total command is:
avrdude -p m328 -c gpio -e

But as I said: the CPU will still be running after that,
you just have the illusion of it doing nothing.

**Provided all other conditions are met like power, X-tal present etc.

nummy
Posts: 35
Joined: Tue Aug 14, 2012 12:07 am

Re: ATMega Clearing

Wed Aug 07, 2013 1:04 pm

Thanks Gert, that lead me in the right direction. This is what I had to do to get it to erase:

Code: Select all

avrdude -p m328p -c gpio -e

Return to “HATs and other add-ons”