Tone with clock @ 1MHz sounds distorted/grainy #779
Replies: 2 comments 9 replies
-
Hmm, well, I definitely didn't have low speed operation in mind when I (re)wrote tone. Your enemy in porting that code you have from the 85 is that there is that a type B timer doesn't have an independent prescaler, while the type A timer is almost all your PWM pins, and the type D timer, which is the best suited to making tones, is the most complicated peripheral on the chip (and is used by default for timekeeping when present, on the logic that it's the hardest to work with and people are least likely to repurpose it - but that's just a menu option to move to a different timer) and is only present on 1-series parts. |
Beta Was this translation helpful? Give feedback.
-
any chance your project can have the MCU spend most of its time in SLEEP_MODE_STANDBY in which case the power consumption difference between 1Mhz and 4mhz may be negligible or the opposite of what you expect? |
Beta Was this translation helpful? Give feedback.
-
Hi Spence and all,
For the context, I was generating tones on an ATtiny85 at 1MHz (important for low power consumption) using a routine to make use of Timer 1 (to not affect 'delay') like this:
http://www.technoblogy.com/show?20MO
Now, I migrated to ATtiny1616 in my project and if I use tone from your library at 1MHz it sounds very grainy. I tried different timers in the Arduino tools and the best is the RTC, but still not as clean as playing in 4MHz and over.
Ideally, I would like to use the routine as before, but I'm not sure if it's possible to implement that code (I'm struggling to understand the datasheet for these new AVRs).
Any help would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions