Issues getting ATMEGA2560V-8AU to work with Arduino - Page 1
Forum section: electronics / projects

author: konfu
author_rank: Contributor
timestamp: June 08, 2013, 06:50:43 pm
content: Hi,I am trying to get a project of mine working without luck for weeks now.The setup is quite easy: A circuit around an Atmel ATMEGA2560V-8AU. Pretty basic circuit (see attachment).I can program the MCU with my ISP programmer without any error messages. I am also able to read out the flash & eeprom and verification is fine. So it seems the AVR is powered up properly and is generally working.There are a few LEDs connected to some of the IO pins. i.e. Port PC0 which is pin 53. At Arduino IDE that pin is being named Digital 37.The LED is connected using a BSS123 mosfet circuit:A 1k Ohm in series between gate and AVR Port PC0. 100k between Gate and GND. Source directly to GND. Drain with some series R to the LED and the LED to 3.3V.Applying 3.3V to the gate of the mosfet (at the AVR pin) will light up the led, removing 3.3V shuts it down. So the LED circuit is fine.The PCB seems to be fine - I've checked with my microscope. No shorts, clean connections, solder joints are clean and well done.The MCU fuses are:Low: 0xffHigh: 0xd0Extended: 0xfdmeaning: brown out at 2.7V, SPI enabled, Preserve EEprom during chip erase, Boot flash size 4096, Boot reset vector enabled, Ext. Crystal Oscillator, 8MHz+ Start up 16k+65I've checked the crystal with my scope - 8MHZ with a nice sine wave. Looks good.Power supply is the ISP. Works good, quite clean 3.3V, no spikes, peaks, bumps during operation ...I can prog and read fuses, flash, eeprom without any error messages.I've tried another Mega2560V Chip - same issue. The 2560V chip is capable of being run with 3.3V.Ground and 3.3V are applied to all pins needed - i've checked that with my scope as well. Every single pin.I've monitored the port PC0 with my scope after uploading the code. Nothing.I've tried using the classic "mega2560" Arduino board code as well as some code from Sparkfun having the exact same MCU. No difference. No function.Serial pins do not put out any signal once being activated in the code.I ran out of ideas. Anyone got some left?

author: miceuz
author_rank: Frequent Contributor
timestamp: June 08, 2013, 07:32:30 pm
content: Since you have an ISP programmer and fully built circuit based on AVR microcontroller, why don't you try to program it in AVR C - you'll avoid a layer of uncertainity by doing that.Something like#include <avr/io.h>void main(){DDRC |= _BV(PC0);PORTC |= _BV(PC0);}will light up the led.You'll need an avr gcc compiler and avrdude. You already have those in Arduino software really. Then you'll know the hardware is ok.

author: konfu
author_rank: Contributor
timestamp: June 08, 2013, 08:40:00 pm
content: *head-->desk*Okay. used Avr Studio 6 to smash code onto the mega. LED is on now. So the hardware is just fine.Sometimes stuff you think you have checked already needs to be checked once again. I immediately have the desire to cry and say something bad about the wasted evenings during last weeks.Thanks miceuz - you just saved me!So it's an Arduino issue. That's gonna be a nut to break now

author: Len
author_rank: Frequent Contributor
timestamp: June 09, 2013, 12:04:07 am
content: Do you have an Arduino Mega you can use to test your sketch? If it were me, I'd say it's time to rule out any silly programming errors.

author: miceuz
author_rank: Frequent Contributor
timestamp: June 09, 2013, 12:27:16 am
content: Quote from: konfu on June 08, 2013, 08:40:00 pmwill you tell us what the culprit was?otherwise - welcome to real programming, arduino is ok for quick and dirty, but I would really suggest you to open your atmega datasheet and start programming in C at this pointit's not that difficult compared to arduino-speak, you just learn more of the hardware that is hidden by all the *inos

author: cosminnci
author_rank: Regular Contributor
timestamp: June 11, 2013, 06:46:04 pm
content: I also had a similar problem but I tried to put the arduino fusebits, than the bootloader and than a blink, all by the programmer, and it did not work.I putted the bootloader with the programmer and then the blink by serial and worked.so as I noticed with my programmer avrisp when programming from the IDE it overrites somthing (maybe the bootloader) and it does not work.anyways it`s good it works.