Strange behavior (ATMEGA2560 16AU)

Hello All,

You guys always come to the rescue when my microcontroller isn't working properly. I recently built a new design that uses the ATMEGA2560 16AU. Put this chip on a board just like an off the shelf Arduino Mega board. I am loading programs on using the ICSP header through SPI. I have an Arduino Uno loading the program on running ArduinoISP. This programmer is what I use for many other boards as well and verified this does work.

My problem is that the bootloader and my code load on the processor without any errors, but the mega does not do anything. I have serial UARTs on this board which I can look at and I do not see any outputs on UART0,1,2. As well as I have a few board LEDs which I attempted to blink, but no luck either.

I believe that this problem is due to my configuration of the megas fuses. I used the default settings in my board.txt file.

##############################################################

mega.name=Arduino Mega or Mega 2560

mega.vid.0=0x2341
mega.pid.0=0x0010
mega.vid.1=0x2341
mega.pid.1=0x0042
mega.vid.2=0x2A03
mega.pid.2=0x0010
mega.vid.3=0x2A03
mega.pid.3=0x0042

mega.upload.tool=avrdude
mega.upload.maximum_data_size=8192

mega.bootloader.tool=avrdude
mega.bootloader.low_fuses=0xFF
mega.bootloader.unlock_bits=0x3F
mega.bootloader.lock_bits=0x0F

mega.build.f_cpu=16000000L
mega.build.core=arduino
mega.build.variant=mega

default board may be overridden by the cpu menu

mega.build.board=AVR_MEGA2560

Arduino Mega w/ ATmega2560

-------------------------

mega.menu.cpu.atmega2560=ATmega2560 (Mega 2560)

mega.menu.cpu.atmega2560.upload.protocol=wiring
mega.menu.cpu.atmega2560.upload.maximum_size=253952
mega.menu.cpu.atmega2560.upload.speed=115200

mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD8
mega.menu.cpu.atmega2560.bootloader.extended_fuses=0xFD
mega.menu.cpu.atmega2560.bootloader.file=stk500v2/stk500boot_v2_mega2560.hex

mega.menu.cpu.atmega2560.build.mcu=atmega2560
mega.menu.cpu.atmega2560.build.board=AVR_MEGA2560

I will try to add the verbose output when uploading a simple program. Kind of annoying, but the IDE is wiping out the important upload data with statements like:

avrdude: avr_read(): skipping page 1022: no interesting data

Any help is greatly appreciated. Usually, these are simple things. Hope it can be fixed.

Thanks in advance!

Post the schematic of your board. Possibly you have a hardware problem.
I designed a built a 2560-based board recently also, bootloaded it with 1.6.9 and wrote Blink to flash all 86 IO no problem.

Sent you a PM Crossroads.

The MEGA uses SPI pins PB1 (SCK), PB2 (MOSI), PB3 (MISO), RESET, +5V, and GND. These are used to program the chip with ArduinoISP.

I have pins PC7,PC6,PC5,and PC4 as board LEDs which are active low. The LEDs do not turn on when using digitalWrite(led0,0).

Additionally, I have a buzzer attached to PC2 which is controlled with a small FET and the buzzer doesn't work.

I measured the clock on the processor and it is running at 16 MHz. No idea why the processor does not want to do anything.

Confirmed this is happening on multiple boards. Looks like it could be design related or the fuses are set incorrectly, but I am using the default mega settings from the Arduino IDE.

Hopefully, this is something I can sort out. I'm starting to think I should be using Atmel's tools to dive deeper into the processor and see if it is getting hung up somewhere.

-NB

I'd expand the bottom of the IDE window, turn on verbose outputs, and see what is being reported. Maybe the bootloaded didn't really take. The listing above for boards.txt has a lot of stuff I wasn't expecting to see.

Hmm. guess I haven't looked at boards,txt in a while, even 1.6.5-r5 has all that stuff in it.
1.0.5 and 1.0.6 I think are much simpler:

mega2560.name=Arduino Mega 2560 or Mega ADK

 mega2560.upload.protocol=wiring

 mega2560.upload.maximum_size=258048

 mega2560.upload.speed=115200

 mega2560.bootloader.low_fuses=0xFF

 mega2560.bootloader.high_fuses=0xD8

 mega2560.bootloader.extended_fuses=0xFD

 mega2560.bootloader.path=stk500v2

 mega2560.bootloader.file=stk500boot_v2_mega2560.hex

 mega2560.bootloader.unlock_bits=0x3F

 mega2560.bootloader.lock_bits=0x0F

 mega2560.build.mcu=atmega2560

 mega2560.build.f_cpu=16000000L

 mega2560.build.core=arduino

 mega2560.build.variant=mega

Update:

The 2560 processor is now working like a charm. Turns out the IDE software version 1.5.6 r2 didn't like the 2560. I was not able to program my board or another mega board with Arduino ISP. But I upgraded to 1.8.1 and the program burned the firmware/loaded the program without any errors.

But I have no idea why this is? Could anyone provide their infinite wisdom to help avoiding this problem in the future?

It looked like 1.5.6 R2 completed the firmware burn and finished uploading, but I guess it was getting hung up somewhere. Very odd, I will be using 1.8.1 for now on.

-NB