Go Down

Topic: LED Blinks much faster than it should (Read 174 times) previous topic - next topic

vasci

Hi all,

I'm a student working on a research project. For this project, a custom arduino was made on a PCB with a gyroscope, and magnetometer. The problem I'm having is that when uploading the simple Blink demo code to the atMega 2560 through a USBtiny programmer, the led on the PCB, which corresponds to pin 13 like on a standard Arduino does not blink every 1000ms. At first it blinked about 15 times slower, i.e every 15 seconds. After some more trials, the LED started blinking sporadically.

I tried using the programmer with a standard Arduino and everything worked as it should so, I know the problem shouldn't be the programmer.

What could be responsible for the incorrect rate of the blinking light?

CrossRoads

Did you burn the fuses?
Use the IDE and program a Mega2560 bootloader on the part, that will set the fuses for external 16 MHz crystal, and things should run like a normal Mega after that.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

fungus


What could be responsible for the incorrect rate of the blinking light?


You didn't do "burn bootloader" (to set the CPU clock speed).

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

vasci

When I use the "burn bootloader" option, I get this error.

avrdude: verification error, first mismatch at byte 0x0000
         0x0c != 0x00
avrdude: verification error; content mismatch

Could it be that the USBtiny programmer does not work with atMega 2560?

Also, the sporadic blinking light is now blinking at a different rate again, but still not with the correct 1000ms delay.

Here is a picture of my setup.

CrossRoads

When you select Tools:programmer, which one you select?
Perhaps there is a driver issue?
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.


vasci

I'm trying to use this http://www.gammon.com.au/forum/?id=11635 to burn the bootloader..
Is it necessary to cut out the 5th wire and have it as a reset pin?

CrossRoads

That code is for using one Arduino running a sketch to bootload another Arduino.
Not for using an AVR ISP Programmer to bootload a device/Arduino.
If you want to use that sketch, then yes, reset needs to come from pin 10 on the Arduino that is running the bootloading sketch.

I am not sure what the problem is with the USB Tiny device.
Some programmers do have problems with the large memory devices like a Mega2560.

I do a lot of messing around; after the first couple of projects, you come to realize that good tools make a world of difference. I use Atmel AVR ISP MKii for all my bootloading and thus do not have all the issues that come up way too often here with folks trying to get other methods to work.

http://www.mouser.com/ProductDetail/Atmel/ATAVRISP2/?qs=%2fha2pyFadujqFzV%252bExzQOlFEGuFbE5zkYm9OzGvRqkjeoy23MLFzjw%3d%3d

Price has been creeping up, about $1/year since I bought mine in early 2011.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

CrossRoads

The stock MKii does not provide power to the device being programmed, it only monitors it. The only time I have had a problem was when I forgot that - the indicator lights make it pretty obvious that something is not right.
I usually have a USB interface as part of the project, either connected to a header or mounted on board, so PC power via USB powers the board.
So connect both up, install the bootloader, then install blink, gives a pretty good indication that the board is off to a good start.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up