LED stops flashing after removing programmer - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 01:45:15 pm
content: I am venturing into the AVR world, after much effort I got a led to flash, so long as the AVRISP2 remains connected (just powered, does not need any PC program running)What the blinking hell happened ?

author: dr_p
author_rank: Frequent Contributor
timestamp: December 04, 2012, 01:53:45 pm
content: I don't know AVRs but look into the reset pin and how it works. My PIC used to do that.

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 01:57:47 pm
content: The reset is pulled high with a 10K resistor

author: dr_p
author_rank: Frequent Contributor
timestamp: December 04, 2012, 02:23:46 pm
content: You do have external power, right?

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 02:36:59 pm
content: yes,Could it be fuse settings ? maybe the programmer is providing the clock or something ? or I'm in some sort of debug mode ?

author: free_electron
author_rank: Super Contributor
timestamp: December 04, 2012, 04:19:05 pm
content: It could be the clock that is not running. Check fuse settings

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 04:32:11 pm
content: So the programmer is providing the clock ? this is an atmega48

author: madworm
author_rank: Frequent Contributor
timestamp: December 04, 2012, 04:45:32 pm
content: There is _no_ system clock provided via the ISP header.Make sure the FUSE settings are right (brown-out-reset, clock-source etc.), don't forget decoupling caps.http://www.engbedded.com/fusecalc

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 06:07:33 pm
content: But oddly the led flashed as directed with the programmer powered as soon as it is unplugged or powered off the led stops, could it be that the watchdog does not work when the programmer is plugged in allowing the program to keep running, but then dose,'t the chip reset on the whatch dog timeout meaning that it would hardly affect a "flasher"

author: hlavac
author_rank: Frequent Contributor
timestamp: December 04, 2012, 06:32:44 pm
content: Common causes of simple led flashers not working:- power supply pins not connected (duh! will still run with at least one input high and one low: other circuitry powering it thru protection diodes)- floating reset pin- watchdog enabled but not cleared periodically (some bootloaders like the USB DFU in atmega32u4 use watchdog to reset the device, it needs to be disabled in init code even that it is disabled in fuses )- too low supply voltage & brownout reset enabled- led pin not set for output properly- some peripheral overriding the gpio functionality od the pin (like comparator output on some pics)- floating input pin for button & software loop waiting for it to be released (internal pullup not enabled)

author: deephaven
author_rank: Frequent Contributor
timestamp: December 04, 2012, 06:43:30 pm
content: I suggest you do a 'sanity check' by probing round all the pins with your scope. That will answer a lot of guesses like reset line level, power and ground, oscillator running etc.

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 07:41:43 pm
content: good idea, but to clarify, this DOES flash the led with the programmer connected, it stops when the programmer is removed, so it's not something like loss of power etc. The circuit is powered.

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 07:46:21 pm
content: just removed the programmer wires one by one and now it keeps flashing ! removed power, shorted power leads on chip (discharging the by pass cap) put power back and now it DOES work, what was that all about ? why does the chip need "weaning" off the programmer ?

author: madworm
author_rank: Frequent Contributor
timestamp: December 04, 2012, 08:26:16 pm
content: Normally it doesn't.Is this on a breadboard?The only occurrence of erratic hardware-based (resets) AVR behaviour I've observed so far was caused by a broken brown-out module - a bad chip. Under normal conditions a floating reset pin shouldn't be an issue (internal pull-up), but who knows what environment you're in.

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: December 04, 2012, 09:17:09 pm
content: Is there a voltage regulator on the board? I had similar troubles once when the DC input voltage to the regulator was marginal.

author: Simon
author_rank: Unknown
timestamp: December 04, 2012, 10:22:33 pm
content: nope running it off a 5 Volt mains adapter

author: TriodeTiger
author_rank: Regular Contributor
timestamp: December 04, 2012, 11:04:11 pm
content: Quote from: Simon on December 04, 2012, 10:22:33 pmErm, you sure it's 5V regulated and won't jump around? Maybe the programmer provides a cleaner source from the USB, jumping to wallwart takes a sec to regulate and cuts out...schematic would help...

author: Psi
author_rank: Super Contributor
timestamp: December 04, 2012, 11:08:50 pm
content: This thread needs a pic of the circuit

author: Simon
author_rank: Unknown
timestamp: December 05, 2012, 07:03:05 am
content: well it is still working, turned it off last night and back on this morning and it works fine. Maybe the problem was diconecting the programmer from usb while it remained connected to the AVR ?

author: 8086
author_rank: Super Contributor
timestamp: December 05, 2012, 09:37:37 am
content: Quote from: Simon on December 05, 2012, 07:03:05 amCould very possibly be. You can't really rely on those sort of things that are 'off' to be in any state you expect them to be in.

author: Simon
author_rank: Unknown
timestamp: December 05, 2012, 12:34:39 pm
content: Of course, maybe the programmer was holding the chip in reset

author: Kremmen
author_rank: Super Contributor
timestamp: December 05, 2012, 01:05:23 pm
content: I didn't see a mention of what processor specifically you are using. Anyway, The AVRISP uses the 6 pin ISP interface and specifically the reset signal to connect to several types of AVR processor. For some more modern chips the reset pin is the actual data line for single wire debugging. If you power the AVRISP down but keep it connected it is very possible that the reset line is pulled low, preventing the processor from starting at all.

author: deephaven
author_rank: Frequent Contributor
timestamp: December 05, 2012, 01:28:58 pm
content: As I mentioned earlier, a quick scope probe round all the pins would remove some of the mystery.

author: Kremmen
author_rank: Super Contributor
timestamp: December 05, 2012, 01:56:29 pm
content: Yes sure, but if we think specifically why disconnecting the programmer allows the chip to function, this is the likely reason as far as i understand.

author: Simon
author_rank: Unknown
timestamp: December 05, 2012, 02:11:06 pm
content: ATmega48

author: Kremmen
author_rank: Super Contributor
timestamp: December 05, 2012, 07:15:28 pm
content: Yup, uses debugWire as one of the optional protocols. That in turn communicates over the reset pin so you do not want to leave the debugger/programmer pulling reset down when powered off.debugWire is used for debugging and ISP for flash programming; both connections are made using the 6 pin header so you would want to disconnect the prog cable when starting normally with the programmer off.