The strangest thing is happening to a standalone Arduino board that I designed and built. The board (whose schematics are below) has the following features:

  1. It has a ATmega328P with a 5V voltage regulator and usual circuitry when set up as a standalone controller.
  2. It controls a scoreboard with several 7-display digits linked through the connectors on the right (JP1 through JP12).
  3. It has cursor buttons decoded using a voltage ladder through ANALOG_0 (A0).
  4. It has a Real Time Clock to keep time when it's turned off.
  5. It has an RF receiver module.
  6. It has a UART header (JP17) so I can program the board using a serial port.
  7. It has a speaker attached to digital pin 3 (D3).

Controller schematics

I upload sketches to it using a RS232-to-TTL adapter that I've also built (schematics also below) and a Serial-to-USB cable. When programming it, the board behaves much like a Severino board.

enter image description here

What's strange is that, when I upload a sketch, the process is paused in the middle and then the speaker starts to beep continually. It pauses with the following avrdude messages:

avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch

     System wide configuration file is "C:\arduino-1.0.3\hardware/tools/avr/etc/avrdude.conf"

     Using Port                    : \\.\COM1
     Using Programmer              : arduino
     Overriding Baud Rate          : 115200

When I press reset on the board, avrdude continues outputting its messages (such as below), the beep stops, the upload continues and the sketch is uploaded successfully to the board.

avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
... messages and upload continue and completes successfully.

I don't have the rest of the messages handy here, but I hope you get the idea.

So, my questions are:

  1. What is making the upload process pause?
  2. Why is the buzzer beeping when the process pauses?
  • 1
    In the IDE's preferences turn on the Verbose for upload. This log should provide some insight, or more clues.
    – mpflaga
    Feb 12 '14 at 2:29
  • 1
    Stupid question: Have you programmed the ATmega328p with a bootloader? Feb 12 '14 at 7:26
  • 1
    "works perfectly in a UNO" -That is useful info. So your board must have a socket. If so - You can determine the source more specifically with a quick experiment. For each of the IO pins bend the pin out, as not to make contact. Floating! As you insert the IC into your socket. Eventually, with all pins floating your circuit will be out of the question. And as some point between the delay/beep should stop. And report back.
    – mpflaga
    Feb 12 '14 at 14:53
  • 1
    @jfpoilpret if the speaker is in fact a buzzer (piezo), then there's no induction, hence no diode needed. Forget my original comment.
    – jfpoilpret
    Feb 15 '14 at 12:29
  • 1
    One friend of mine who did a lot of electronics in his youth once told me: "if it does not work as you would expect, add a decoupling capacitor". On many occasions, I have followed this advice with great success! In your schematic, it's not clear to me, though, where you could add a decoupling capacity. Have you tried in // with the buzzer? You may also try 2 (one for low freqs, one for high freqs): one electrolytic at least 1uF, one ceramic 100nF. At worst, it won't have any effect :-)
    – jfpoilpret
    Feb 22 '14 at 18:47

What is making the upload process pause?

Well, given all the comments made under your question, this is definitely a tricky one. You might want to try to add a decoupling capacitor as suggested by @jfpoilpret, though your schematics look alright to me… (maybe ask a review of it on EE SE).

I'd also advice you to copy the avrdude command from Arduino IDE output (you'll find it at the top), and run it in the command shell with lower bitrate:

avrdude -v -v -v -v -C "C:\arduino-1.0.3\hardware/tools/avr/etc/avrdude.conf" -P COM1 -patmega328 -U… -B3 -b115200

the higher the -B value is the lower your bitrate is. and -b to the correct baudrate for your bootloader (are you sure this is 115200? it's more common to see 57600).

Did you also set fuses correctly? You might as well want to check the values of the fuses to see if the clocks are correctly set up:

avrdude -U lfuse:r:-:i -U hfuse:r:-:i -U efuse:r:-:i

which will output the values of the fuses. Then to make the values readable, put the values at the bottom of the form on the fuse calculator site, after choosing the Atmega328P MCU from the dropdown list.

Double check that:

  • you have enough size for the bootloader (usually the more you give it the better it is) ;
  • you have correctly set up the cristals configuration for your design (which may not be compatible with default Uno settings as setup by the Arduino IDE), checking if you correctly set up the external crystal at 16MHz…

Why is the buzzer beeping when the process pauses?

It's because when the processor does not have the output set up, the values within the registers are in an undefined and unpredictable state. Which means that usually it keeps the last value it had before a reset, or changed state because of some electrostatic weirdness, or is giving some weird PWM output because of the influence of a clock nearby.

So basically, there's something wrong happening when you're uploading your code and that wrong thing has an indirect effect on the audio. I wouldn't worry much about that stuff, but more about the cause of the pausing.

Sadly, I don't have a direct answer for you, but at best a few paths you should investigate more. HTH

  • +1 Thanks for the hints! Very useful. I'll try them all and report back in a couple of days.
    – Ricardo
    Mar 2 '14 at 16:56
  • Just wanted to let you know that I fixed the problem. See my answer to this question. Thanks anyway!
    – Ricardo
    May 3 '14 at 17:30

I finally found what was causing the problem: the reset signal from pin 4 (DTR - Data Terminal Ready) on the DB9-Female connector was spiking up to 10V before going to 0V and was triggering high-voltage programming on the ATmega. Below is a scope shot showing the situation:

Scope shot showing voltage spike to 10V

The yellow trace is DTR signal while the green trace is the RESET signal on the ATmega.

According to Atmel's Atmel AVR042: AVR Hardware Design Considerations application note, one should add an ESD diode between ATmega's RESET and Vcc to prevent the reset signal from triggering high-voltage programming mode, like so:

Recommended RESET pin connection for ATmegas

After adding such a small signal diode (1N4148) like the app note recommended, I got the issue fixed. See below the scope shot taken after the diode was added.

Scope shot after fixing the board

Now the 10V peak is gone.

That was a tricky one!! But I could never find what was wrong without research and the right tools. Money on a scope is money well spent!!

  • 1
    This comes about because your reset line does not have the sort of level translator applied to the serial data line. Most use a level translator ic and run the reset through a channel of that. May 4 '14 at 4:35
  • @Chris - Yeah, I remember you telling me to use the 2nd MAX232 converter to fix that. I'll take another look and see if I can fix that design. Thanks!!
    – Ricardo
    May 4 '14 at 12:04

I'm not sure but the problem may also be related to the auto-reset feature of the converter board.

I copied the converter board design from the Arduino Severino and according to its manual, the serial communication must be set to 19,200 bps for the auto-reset feature to work.

Be sure that computer COM Port speed is set to 19200bps otherwise auto reset will not work properly.

Well, I'm using 115,200, so that must be a problem.

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.