I'm looking to "upgrade" to the Arduino Tiny base since it looks like the shared work is headed in a direction more aligned with what I'm trying to do.
Initially I'd like to use 3 PWM channels to control an RGB LED. When looking at the tinyX5 core set, there are two timers, both of which can drive PWM outputs. Only timer0 can do phase correct PWM. That's ok, for LED brightness control phase is not a problem. So I should be able to use both timers, and theoretically have 4 PWM outputs, but...
It looks like the PWM outputs of the two timers overlap. Pin 6 has OC0B, pin5 has both OC0A and OC1A, pin 3 has OC1B. Sharing OC0A and OC1A on pin 5 is unfortunate if you want more PWM outputs
Has anyone else experimented with more PWM channels on the tinyX5 series?
Three is about it for the ATtiny85 I believe. Not 100% positive on that.
Three however is quite doable, and is exactly how many you need for an RGBLED.
The attiny2313 says it has four PWM channels, I haven't looked at the datasheet to see whether some overlap though.
@Codingbadly: just a side note, but this is now my favorite way of developing apps for the Tiny. Excellent work, and wholehearted thanks for sharing. It's really enabled me to make a lot more crazy devices with my tinys without having to resort to AVR studio.
When looking at the tinyX5 core set, there are two timers
Yup.
both of which can drive PWM outputs
Yup.
Only timer0 can do phase correct PWM
Yup. By default, the Tiny Core is configured with two phase correct outputs and one fast output. There is a compile-time option to switch to one phase and two fast.
It looks like the PWM outputs of the two timers overlap
Yup. And I vaguely recall that you can have both outputs enabled creating a rather strange situation. The Tiny Core, however, only enables one of the outputs.
buzzdavidson: @Codingbadly: just a side note, but this is now my favorite way of developing apps for the Tiny.
Mine, too.
Excellent work
Thanks. Got some other goodies in the pipe: Arduino ISP version that better supports ISP development. Dramatically improved Tiny Tuner. Addition of fast*Digital. Support for ATtiny13 and ATtiny4313. But, work is getting in the way.
and wholehearted thanks for sharing
You are quite welcome. And, if you're interested, I suspect we can find a way for you to give back.
It's really enabled me to make a lot more crazy devices with my tinys without having to resort to AVR studio
Using the Arduino ISP programmer I got the annoying messages from avrdude asking to define PAGEL and BS2. Since the ATtinyX5 family doesn't have these pins, and I guess we don't actually need them, I defined them in AVRDUDE.CONF to be pins/ports that don't exist - no more error messages.
# PAGEL and BS2 defined by --RL so we don't get a warning error from avrdude n/a on attiny85
pagel = 0xD0; # these don't exist on the ATtinyX5 series
bs2 = 0xD1; # these don't exist on the ATtinyX5 series
i trying to get my attiny85 to run at 8mhz. but i cant get it to work..
when i upload the blink sketch at 1mhz it will blink like it is supposed to. but when i upload it at 8mhz it will blink much slower. so i assume the attiny thinks it is running at 8mhz but it is actually running at 1mhz..
i read somewhere in this threat that you need to set the fuse buts by burning the bootloader. but this is not working for me, when i do i get this error message
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avr_read(): error reading address 0x0000
read operation not supported for memory "lock"
avrdude: failed to read all of lock memory, rc=-2
Locate the memory lock section. It looks like it starts 134 lines below the start of the ATtiny85 section.
Add "read" data...
memory "lock"
size = 1;
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
"x x x x x x x x 1 1 i i i i i i";
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
"0 0 0 0 0 0 0 0 o o o o o o o o";
min_write_delay = 9000;
max_write_delay = 9000;
;
Sometimes ago, while searching info about Attiny and RGB Leds, I found this code which does PWM software on 3 pin with the timer0.
I don't remember where I found this code and the author did not write his name on it.
Maybe It could help to create a small lib to handle rgb leds.
I think Coding Badly's core enables all three PWM outputs by default, two on timer0 and one on timer1. Unless of course you start editing config files and swapping what is where.
@Coding Badly what about the incoming structural changes in the arduino ide?
i mean the arduino.h instead of wprogram.h and the external pins file etc....
We are building a "large family" arduino ide called ArduOpen ( a kind of arduino on steroids) and we would like to include your core, beside the arduino-extras and the original one, so we need to know what you are planning to do.
BrainBooster: @Coding Badly what about the incoming structural changes in the arduino ide? i mean the arduino.h instead of wprogram.h and the external pins file etc....
I've been following progress on the Developer's List. From what I can tell, the only required change is to rename "WProgram.h" to "Arduino.h".
We are building a "large family" arduino ide called ArduOpen ( a kind of arduino on steroids) and we would like to include your core, beside the arduino-extras and the original one, so we need to know what you are planning to do.
Sounds good.
My policy is to deliver an update as soon as possible after a release of the Arduino IDE. I believe the Arduino crew is targeting Sep 15. Usually, I perform a complete review and, when possible, ensure the Tiny Core is "highly compatible". This time around I probably won't have time to do that until mid-October. So, just after the Arduino 1.0 release, I plan to make just enough changes so the Tiny Core, as it is now, can be used with the new IDE.
BrainBooster:
..and about the extetnal pins configuration file?
The intent is to make it easier to port the Standard Core to other processors. Unfortunately, the idea falls considerably short with the Tiny processors. In the short term, I intend to mostly ignore / workaround the feature.
can i try to patch myself the core files, just to see if it can work in the new ide?
Please do. And please let me know how you progress or if you get stuck.
@Coding Badly i did the 1st experiment with arduino 1 beta 3 and the modded arduinotiny and i succeded in compile the blink example for the attiny85 at 1mhz as selected board XD.
i'm not at home now so i can't try to upload the sketch, but i would say that a big step has been done
i'm planning to allot some time in the weekend to do further tests...
stay tuned
Rick Kimball:
For using Arduino as ISP, I need to disable Auto Reset capabilities. Therefore I inserted 110 ohms (330 ohms / 3) resistor between Reset-pin and 5V-pin. This resistor should be above 110 ohms and below 124 in accordance with this document: DisablingAutoResetOnSerialConnection.
Is it correct that this resistor goes between +5V (from Arduino pin with 5V) and reset pin on ATTiny?