Arduino Tiny

Excellent. I'm glad you have it working.

This is a good place to make suggestions...
http://code.google.com/p/arduino-tiny/issues/list

I've already added an entry...
http://code.google.com/p/arduino-tiny/issues/detail?id=12

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.

attiny85_rgb_led.c (2.97 KB)

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.

But, work has a bad habit of getting in the way.

..and about the extetnal pins configuration file?
can i try to patch myself the core files, just to see if it can work in 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.

ok thank you.
it will be done :slight_smile: asap

@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 :slight_smile:
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?

(deleted)

Hello.
I'm writing a library that utilizes timers and is portable on several micros.
My library doesn't work with Attiny84. I am not able to make ISRs routines work, nor with INT0/Timer0 or INT1/Timer1.
This is the issue that I've opened yesterday on Tiny Core site.
http://code.google.com/p/arduino-tiny/issues/detail?id=19

To replicate the problem simply get a Tiny84, put it on a breadboard with a R+LED on digital pin 0 (phisical pin #2) and compile and upload the following code:

int counterT=0;
int starterT=0;
byte state=1;
#define LED 0

void setupTimer() {
    float prescaler;

    //during setup, disable all the interrupts based on timer 0
    TIMSK0 &= ~(1<<TOIE0);
    TIMSK0 &= ~((1<<OCIE0A) | (1<<OCIE0B));
    //normal mode: increment counter until overflow
    TCCR0B &= ~(1<<WGM02);
    TCCR0A &= ~((1<<WGM01) | (1<<WGM00));
    //normal mode: no pwm generation
    TCCR0A &= ~((1<<COM0A0) | (1<<COM0A1));
    TCCR0A &= ~((1<<COM0B0) | (1<<COM0B1));
    //the following code sets the prescaler depending on the system clock
    if ((F_CPU == 16000000UL) || (F_CPU == 8000000UL)) {   // prescaler set to 64
        TCCR0B &= ~(1<<CS02);
        TCCR0B |= ((1<<CS01) | (1<<CS00));
        prescaler = 64.0;
    } else if (F_CPU == 1000000UL) { // prescaler set to 8
	TCCR0B &= ~((1<<CS02) | (1<<CS00));
	TCCR0B |= (1<<CS01);
	prescaler = 8.0;
    }
    starterT = 256 - (int)((float)F_CPU * 0.001 / prescaler);

    TCNT0 = starterT;
    TIMSK0 |= (1<<TOIE0);
}

ISR(TIMER0_OVF_vect) {
    TCNT0 = starterT;
    counterT++;
    if (counterT>999) { 
        state ^=1; 
        counterT=0;
        digitalWrite(LED, state);
    }
}

void setup() {
    pinMode(LED, OUTPUT);
    digitalWrite(LED, state);
    setupTimer();
}

void loop() {
}

The led lights up forever.

ISR(TIMER0_OVF_vect) {

ISR(TIM0_OVF_vect) {

THank you for your replay but it didn't work.
I've already tested your solution but in the IDE terminal I get:

core.a(wiring.c.o): In function 'init':
/home/...(patch).../hardware/tiny/cores/wiring.c:234: multiple definition of '__vector_11'
int_timer0_attiny84.cpp.o:int_timer0_attiny84.cpp:38: first defined here

For the ATtiny84 processor (and family), timer 0 is used by millis, micros, delay, and delayMicroseconds so you will not be able to override the overflow interrupt vector. Timer 1 is initialized for PWM but you are otherwise free to do whatever you want with it.

There are compile-time switches in "core_build_options.h" that may be of interest. If INITIALIZE_SECONDARY_TIMERS is set to 0, timer 1 is left alone. TIMER_TO_USE_FOR_MILLIS (in the ATtiny84 section) can be used to switch millis to timer 1.

If you are building a library specifically for the Tiny Core, the code in "UserTimer.h" (and "core_timers.h") may help.

I've followed your suggestions and now it works. Thanks.

But without any help I wouldn't be able to make my code running. Tiny core is good but the documentation lacks a little bit :sweat_smile:

You are welcome. I'm glad you have it working.

PS:
I'm working on a multi-micro library. The library will be widely available soon.

Sorry, one question. What about Arduino IDE 1.0 and Tiny core?
I mean, when the Arduino IDE 1.0 will be released, will the actual Tiny core be compatible with it or should we wait for a Tiny core 1.0?

I'm using Tiny85 and Tiny84 and I would like to know about Tiny core upgrades :wink:

Sorry, one question.

No need to apologize. The point of the forum is to ask questions.

What about Arduino IDE 1.0 and Tiny core?

I've been tracking, reviewing, and testing against the changes to the Arduino IDE. As far as I can tell, there is just one change required. Basically, an "Arduino.h" file has to be added to the core directory that includes "WProgram.h"...
http://code.google.com/p/arduino-tiny/issues/detail?id=21

In general, I will always wait until after the next IDE has been released before releasing a compatible Tiny Core.

I'm using Tiny85 and Tiny84 and I would like to know about Tiny core upgrades

I have lots of goodies planned for the next release. The work is progressing nicely. Unfortunately, it may be a few weeks before its ready.

? Variation of the digital*Fast functions designed to minimize the Flash consumed
? Inlined versions of the other core functions (tone, analogWrite, analogRead, etcetera) also designed to minimize the Flash consumed
? Dramatically improved Tiny Tuner
? Improvements the the Arduino ISP (aka Mega ISP) sketch
? Nice support for the ATtiny13
? Portability improvements

I mean, when the Arduino IDE 1.0 will be released, will the actual Tiny core be compatible with it or should we wait for a Tiny core 1.0?

No reason to wait. The one change is enough that you can start using the 1.0 IDE.