0

I have a custom PCB with an ATMega 2560 microcontroller on it. To test if the ATMega was working properly, I uploaded the following code:

void setup() {
  Serial.begin(9600);
  Serial.println("Test setup");
  pinMode(6, OUTPUT);
  pinMode(30, OUTPUT);
  pinMode(31, OUTPUT);
  pinMode(32, OUTPUT);
}

void loop() {
  digitalWrite(6, HIGH);
  digitalWrite(30, HIGH);
  digitalWrite(31, LOW);
  digitalWrite(32, HIGH);
}

The mentioned ports are connected to LEDs, 6 to an external LED and 30, 31 and 32 to LEDs on the PCB. Each connected in series with a 220 Ohm resistor.

The board is setup like this:

enter image description here enter image description here enter image description here

When uploading I am using a Arduino UNO as ISP and after uploading the Arduino IDE says 'Done uploading' without any errors, but the board is not showing any sign of executing the code. I have checked that VCC is 5V and RESET is HIGH after uploading. The text "Test setup" is also not shown on the serial monitor.

Does anybody have a clue why the board is not working?

Thanks on forehand.

6
  • There could be many reasons - the most common of which is that your crystal isn't running right. You'll have to show us your schematic and images of your PCB for us to help you.
    – Majenko
    Commented Jul 23, 2016 at 17:58
  • Edited, good point on the crystal, I will check if it is functioning well.
    – nicolaasb
    Commented Jul 23, 2016 at 18:07
  • Also make sure that your fuses are burned correct for your crystal source.
    – Majenko
    Commented Jul 23, 2016 at 18:08
  • The crystal itself is working. I have added a picture of the board as well. A problem I found myself is that maybe the loop of the crystal and its capacitors is rather large, which may cause the problem.
    – nicolaasb
    Commented Jul 23, 2016 at 18:32
  • As was pointed out the first time you posted this, your description doesn't really make sense. If you are using ISP, then what does the bootloader have to do with it? If you loaded the bootloader via ISP, you don't have a test program on there, and if you loaded the test program via ISP, you no longer have a bootloader... Commented Jul 24, 2016 at 4:28

1 Answer 1

0

When using an empty ATMega2560 you need to change the fuse settings, otherwise it will just upload your code but it won't execute. This tutorial explains it very clearly: Programming ATMega 2560 with Arduino UNO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.