0

I have got my own PCB with "some stuff" on it and first I want to make it run a simple "turn on LED".

My setup:

  • Atmega 2560
  • LED connected to PE4 (D2 in Arduino language) => PE4 - LED - 1K resistor - 5V
  • ceramic resonator (CSTCE16M0V53-R0 16MHZ) connected to XTAL1 + XTAL2 with 1MOhm resistor inbetween
  • all VINs are pulled to GND with capacitors

resonator VINs GNDs RESET circuit status LEDs

Upload is working through ICSP (MISO, MOSI, SCK, RESET, 5V, GND) with an USBasp

Here is my Arduino sketch, which I upload through the Arduino software:

void setup() {
  pinMode(2, OUTPUT);
}

void loop() {
  digitalWrite(2, LOW);    
}

I checked the fuses on the atmega as well:

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (H:FD, E:D8, L:FF)

avrdude uploads successfully: (output truncated!)

avrdude: auto set sck period (because given equals null)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9801
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: writing flash (1518 bytes):
Writing | ################################################## | 100% 5.47s
avrdude: 1518 bytes of flash written
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 3.45s
avrdude: verifying ...
avrdude: 1518 bytes of flash verified

avrdude done.  Thank you.

Problem: the LED doesn't work. It is OFF all the time.

Any ideas why it is not working?

Cheers Hendrik

  • You have forgotten to mention what the problem even is. – Ignacio Vazquez-Abrams Jul 13 '15 at 8:14
  • You're right. I edited my post. The LED isnt blinking. – jblaze Jul 13 '15 at 8:21
  • Have you tested the voltage at the pin? – Ignacio Vazquez-Abrams Jul 13 '15 at 8:35
  • When you say it doesn't blink, can you clarify: Is it on all the time, or off all the time? – Nick Gammon Jul 13 '15 at 8:37
  • it is off all the time. @NickGammon // which pin do you mean – jblaze Jul 13 '15 at 8:40
0

You are saying that the LED lights if you write LOW to it.

I need to pull the output pin to LOW to make the LED work

That's exactly what you expect.

LED wiring

Since the other end of the LED is wired to +5 V, then you need to drive the pin low to have a voltage difference over the LED, and for it to light.


I double checked the Atmega and it is a ATmega2560V, which is rated for 8Mhz. Any chance to fix this with the existing PCB? Change the Fuses to use the internal clock?

Yes, I suggest you do that.

Look at Engbedded Atmel AVR® Fuse Calculator to see what to set them to. I suggest the internal 8 MHz oscillator.

  • Yes, I have to pull it LOW but nothing happens. – jblaze Jul 13 '15 at 11:25
  • Well it shouldn't take long to change the sketch to refer to pin 52 (SCK), upload that, jumper your LED to the SCK pin, and test. – Nick Gammon Jul 13 '15 at 11:51
  • Unfortunatly this doesn't work :-( – jblaze Jul 13 '15 at 14:05
  • Please measure the pin with a multimeter. Upload your earlier "blink" sketch. See whether or not the pin changes voltage. – Nick Gammon Jul 13 '15 at 20:36
  • 1
    See amended answer. – Nick Gammon Jul 14 '15 at 9:37

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.