Dukebats / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

tone command does not work correctly on ATmega8 #292

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. load and run a tone example script, f.e. toneMelody.pde

What is the expected output? What do you see instead?

You can hear the melody correctly on a Arduino Duemilanove with ATmega328.
On a board with ATmega8 you can only hear one tone (NOTE_B3 I think??). 

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

Arduino018 on Windows 7. myAVR USB MKII board with ATmega8 3.6864MHz Quarz.

Please provide any additional information below.
Only the following frequencies give a correct signal: 61Hz, 244Hz, 976Hz, 
3.9KHz. Any other frequency gives no signal (PWM output signal measured with 
oscilloscope) 

Original issue reported on code.google.com by p.reckte...@gmail.com on 15 Jul 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Looking into this now.

Original comment by rogue.bh...@gmail.com on 16 Jul 2010 at 3:37

GoogleCodeExporter commented 9 years ago
Since I don't have an ATmega8 handy, I need some help with testing.  See 
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1279295681/

Original comment by rogue.bh...@gmail.com on 16 Jul 2010 at 3:57

GoogleCodeExporter commented 9 years ago
Pete62 @ the Arduino.cc forums found the bugs.  The later 8 bit AVR's use two 
registers (TCCRxA, TCCRxB) whereas the ATmega8 only uses a single register 
(TCCR2) to house the control bits for Timer 2.  Bits were inadvertently being 
cleared.

Attached is the fixed version of Tone.cpp.

Those with ATmega8's, please verify the changes.

Original comment by rogue.bh...@gmail.com on 17 Jul 2010 at 7:15

Attachments:

GoogleCodeExporter commented 9 years ago
Thank you for teaching me into the right direction to find the bugs in the Tone 
lib. Pete62 is my Arduino.cc username. 

Thread can be closed.

Original comment by p.reckte...@gmail.com on 18 Jul 2010 at 9:59

GoogleCodeExporter commented 9 years ago
Hi,

Will this corrective be included in the arduino's release versions one day ?
I'm using the 1.0.5 and the version 0007 with is supposed to be this correction 
was replaced by this one: 0007    M Sproul    10/08/29 Changed #ifdefs from cpu 
to register

The actual release version of the Tone.cpp does not work with an atmega8.
Thanks.

Original comment by jeison.s...@gmail.com on 10 Nov 2014 at 2:52

GoogleCodeExporter commented 9 years ago
Hi,

I'm currently facing the same problem. I've still some ATmega8s in stock which 
I'd like to use as "minimal Arduinos", and the tone library simply doesn't work.

As the presented bugfix is quite old and can't easily be merged into the 
current Arduino IDE version, I've rebased the bugfix to work with Arduino 1.6.1 
(and probably also the later versions).

Even if ATmega8s are pretty outdated now and not used in "official" Arduino 
boards, the IDE claims that they are still supported (Arduino NG is still an 
official target platform). So I hope that one of the devs picks up this bugfix 
and includes it in the next version.

Or should I rather fork the project on GitHub and create a pull request?

Original comment by jan.reuc...@gmail.com on 10 Apr 2015 at 6:58

Attachments: