Is there any particular reason that the core files for the attiny85 would object to my using a 10mhz external resonator?The sketch in question doesn't use delay at all, and millis is only used for button debouncing, easy enough to change the numbers to make things work right.

I need (ok, want) two 20khz or so PWM outputs (independant of each other, so using the two PWM registers to count only to 200 wouldn't work as it disables the second PWM pin), setting the prescaler to full blast at 8mhz gives me 15khz or so, 10.5mhz would give me 20khz on the PWM in theory. It looks like it might be possible to user OCCAL (i think that's it, the calibration register) to wind the clock up that high, though at the sacrifice of EEPROM and flash writability in-sketch.

Anyway, I want to double check that the core files won't flip out or something!

• Any other fuses (like BOD) for your application. The clock fuses are already correct.

Quote

The sketch in question doesn't use delay at all, and millis is only used for button debouncing,

That's good because millis / micros will not longer be accurate. The count will be a bit lower than it should be. Probably about 1%.

Quote

easy enough to change the numbers to make things work right.

I doubt millis will be that different that you'll notice for button debouncing.

Quote

I need (ok, want) two 20khz or so PWM outputs (independant of each other, so using the two PWM registers to count only to 200 wouldn't work as it disables the second PWM pin), setting the prescaler to full blast at 8mhz gives me 15khz or so, 10.5mhz would give me 20khz on the PWM in theory.

If you're willing to learn about a new type of timer, timer 1 may give you what you need without resorting to a 10 MHz clock speed. Timer 1 was built for high-speed PWM.

If you decide experiment with timer 1...

• Locate and open the "core_build_options.h" header file

• Change the INITIALIZE_SECONDARY_TIMERS #define to be "0" (without the quotes)

• In the ATtiny85 section, change the TIMER_TO_USE_FOR_MILLIS #define to be "0" (without the quotes)

• Timer 1 is now free to use as you please

Quote

It looks like it might be possible to user OCCAL (i think that's it, the calibration register) to wind the clock up that high, though at the sacrifice of EEPROM and flash writability in-sketch.

I'm definitely down for playing with the high speed timer if that can get me 20-25khz pwm on two pins (and separate duty cycles on the two pins), I've been trying to convince the 328 to do it, but I'm missing something.Thanks for the specifics on that. Now I have something to play with while I wait for a couple $0.50 10mhz oscillators to show up (I need to make a digikey order anyway). 1% on the millis/delay/etc. isn't bad at all, I doubt that'd screw me up even if I were doing something beyond debouncing input buttons.

On OSCCAL: It's not so much that adjusting it can cause issues as it is that trying to crank the CPU clock way up using it can cause issues. The OSCCAL datasheet page says that using OSCCAL to get >8.8mhz operation isn't recommended as it doesn't give the EEPROM enough time to write correctly in some cases. If it's like most things they probably mean it'll drop one write in a thousand or some such thing.

Editing the boards.txt sounds easy enough, thanks for the specific instructions, that'll make my life easier!

Also, a general thank you! for creating the port in the first place and jumping in to help us with odd stuff like this. It's appreciated!

if that can get me 20-25khz pwm on two pins (and separate duty cycles on the two pins),

Timer 1 is very PWM versatile so i'd be very surprised if you could not get what you want.

Quote

I've been trying to convince the 328 to do it, but I'm missing something.

Timer 1 will do it. I think you need to use "mode 14". Search for a topic about 10 KHz PWM and "Coding Badly" and "ICR1". I vaguely recall helping two people so there may be two topics.

Quote

Thanks for the specifics on that. Now I have something to play with while I wait for a couple $0.50 10mhz oscillators to show up (I need to make a digikey order anyway).

If you do play with the 85 / timer 1, please follow-up with your experience. I've wanted to play with the various esoteric ATtiny timers. They are definitely interesting critters. I'd really like to here about your experience with it.

Quote

The OSCCAL datasheet page says that using OSCCAL to get >8.8mhz operation isn't recommended as it doesn't give the EEPROM enough time to write correctly in some cases

Got it. Thanks.

Quote

Also, a general thank you! for creating the port in the first place and jumping in to help us with odd stuff like this. It's appreciated!

I found the thread you were talking about, it looks like if I can make it work in the tiny (the thread was about a 168 or 328) I can have pretty much any PWM speed I want! The key is that there is another different register that the TOP count value can be compared to, one that isn't the duty cycle register for the other PWM output.I'm hoping the tiny85 can do it also, that'd be perfect!

Haven't had a chance to play with it, I did get the prototype fan controller perfboarded though. Might have some time this weekend.Whenever I do get a chance I will definitely report in with what I find!

If you're willing to learn about a new type of timer, timer 1 may give you what you need without resorting to a 10 MHz clock speed. Timer 1 was built for high-speed PWM.

If you decide experiment with timer 1...

• Locate and open the "core_build_options.h" header file

• Change the INITIALIZE_SECONDARY_TIMERS #define to be "0" (without the quotes)

• In the ATtiny85 section, change the TIMER_TO_USE_FOR_MILLIS #define to be "0" (without the quotes)

• Timer 1 is now free to use as you please.

Did this, my PWM frequency doubled to 31.something khz, slightly higher than needed but not badly.My millis are toooootally out to lunch, I get about the same debounceness with it set to 1500 millis as I used to with 30, so around 50 times as many millis per second, maybe 60ish. This isn't really a problem, as that debounce routine is literally the only place I use millis, and delay isn't used at all.It got rid of the whine in one of two fans tested so far, I call it a success!(Oddly, millis behaves the same way regardless of whether I upload it with the board set to attiny85@8mhz or @1mhz, something weird there. Doesn't make a difference to me, but it's strange)

EDIT:I spent some time with OSCCAL, and got myself an absolutely perfect 25.5khz signal. It's running the core at 6.5-6.6mhz, right around the ATTINY15 compatibility speed amusingly enough.

First a disclaimer, I'm on Ubuntu 11.4, I don't know if that changes things or not.

Fuses are (manually) set to 8mhz internal operation, using the burn-bootload function wouldn't change them for some reason. I haven't gone back and tried again as I've been working on other issues.Now I have a decent stack of attiny85s I'll start playing with a fresh one and see what happens at some point here.

Yes, selecting 1mhz and 8mhz without burning a bootloader or manually changing fuses and then re-uploading an identical sketch doesn't change the behavior of millis.

First a disclaimer, I'm on Ubuntu 11.4, I don't know if that changes things or not.

It may. There is problem with the AVR GCC compiler on Linux. I vaguely recall that delay was effected but I don't remember any mention of millis. You may want to spend a few minutes searching the forum. If you do find the the culprit, please report back. My suspicion is that it is a bug in the core.

Quote

Fuses are (manually) set to 8mhz internal operation, using the burn-bootload function wouldn't change them for some reason.

Bummer. I love being able to do that. I switched a processor to 1 MHz just a few minutes ago.

Quote

Yes, selecting 1mhz and 8mhz without burning a bootloader or manually changing fuses and then re-uploading an identical sketch doesn't change the behavior of millis.

That is strange. I suspect curiosity will get the better of me and I'll end up working on it over the weekend. I'll let you know if I have any more questions.

Is there any documentation, example or post to point me to on using TinyDebugSerial?

TinyDebugSerial is a write-only software serial implementation. It is meant to be a drop-in replacement for Serial. No one has complained about it so I assume it really is a drop-in replacement. So, any Arduino Serial examples should compile and run just as they do for other processors.

There is usage information here...http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/25#25

Some information about the ATtiny2313 processor and TinyDebugSerial here...http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285218245/26#26

This is important for saving precious SRAM or if you plan to use a crystal on your Tiny processor...http://arduino.cc/forum/index.php/topic,51984.msg370691.html#msg370691

Quote

If it matters, I will be using it with my Pololu USB Programmer as a serial monitor?

Nice! You will be able to keep your terminal application running and connected while you upload! I am a big fan of the Pololu USB Programmer!