Go Down

Topic: core13: An Arduino core for the Attiny13 *testers wanted* (Read 162488 times) previous topic - next topic

Erni

Quote
No, the new version is 0.18.


Thanks, what I meant to ask was: where to get it.

This links leads me to version 0.17

http://sourceforge.net/projects/ard-core13/

smeezekitty


Sorry for the slow response.

http://sourceforge.net/projects/ard-core13/files/
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

ProfePaco

Hi There:

Attiny13 is employed in flashlight drivers to control the led. For example, using PWM for obtaining different amount of light (high, medium, low) and for flashing/strobing.

Some drivers using the Attiny13 are very versatile. You can change the modes available, just employing the switch, and some of them show that the battery is low.

I am very interested in this project, as I would like to develop my own software for the flashlight driver, and there is a large community of people (flashlight lovers) interested in this topic.

Therefore, I will have a look to this thread.

Just one quick question. Is PWM fully implemented? Which is the pin for PWM? I think only one is available.

Erni

Quote
Which is the pin for PWM? I think only one is available


There are two, PB0 and PB1

smeezekitty

Yes that is correct PB0 and PB1 support PWM. PWM is fully implemented although the next version should improve PWM performance.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

ProfePaco

Thanks for the answers. I am waiting for some Attiny13 for beginning to write the software for the led driver.

Let me show the driver that it is used in many good flashlights:



You can see in the picture the Attiny13 and 4 AMC7135 current regulators, that are controlled via PWM. There are more AMC7135 on the other side.

The stars 2, 3 and 4 are used to modify the program on the Attiny13. Soldering one start to ground, i.e., one input is connected to ground, modify the light modes available.

It is a very interesting project for me and for many flashlight lovers. We want to improve the light modes.

One question, ... so no bootloader is loaded, so.. how much memory is available for the program since the maximum is 1K?




nanouser

hello, just wanted to share my success
after a day of fighting just made my atatiny13a run on 9.6 mhz (or is it rather 8?) (for batch fiile solution see end of the message)
i am using arduino nano v3.0 with a 10mf capacitor to programm the attiny13
following the instructions at http://arduinodiy.wordpress.com/2012/02/28/program-an-attiny-with-an-arduino-nano/
and using the great core13 v18 files and information provided here
the programming worked very well right away with one issue: the clock was somewhere
around one tenth of the 9.6 Mhz the led blink turned on or off every 10 secs instead of the every single second.
after playing with settings in boards.txt i realized that my arduino IDE 1.04 was not programming the fuses when uploading the program (no if this is by definition) so that my fuse settings to adjust the clock had no effect whatever)
when i tryed to upload the bootloader to change fuses avrdude called by the arduino ide complained with the verification error "first mismatch at byte 0x0000" and failed
here is my boards.txt
attiny13.name=Attiny 13A standalone
attiny13.upload.using=arduino:arduinoisp
attiny13.upload.maximum_size=1024
attiny13.upload.speed=19200
attiny13.bootloader.low_fuses=0x7a
attiny13.bootloader.high_fuses=0xff
attiny13.bootloader.path=empty
attiny13.bootloader.file=empty
attiny13.bootloader.unlock_bits=0xFF
attiny13.bootloader.lock_bits=0xFF
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=9600000
attiny13.build.core=core13

so after tinkering and trying i have crearted a batch file which directly calls the AVRDUDE from arduino to programm the fuses.
i used the http://www.engbedded.com/fusecalc/ to calculate the hex values for fuses
note: you might need to change the com18 to whatever comport your programmer is using (check it out in the arduino IDE) and the actual 0x7a and 0xff fuses accourding to frequency/configuration you need
also not forget to change the base path to your arduino ide folder
here is the batch-----------------------------------
c:
cd c:\arduino\arduino-1.0.4\hardware\tools\avr\bin
avrdude -C ..\etc\avrdude.conf -p attiny13 -P com18 -b 19200 -c arduino -U lfuse:w:0x7A:m -U hfuse:w:0xFF:m -B250
pause
--------------------------
hope that can help somebody else as well.
--------
p.s: a blink for 40 seconds now gives me around 44secs (at over 5 Volts)
so it looks to me  like it actually runsaround 10% slower on (9.6mhz -0.96) = at around 8.4 Mhz instead of the promised 9.6
is this normal?
but anyway it is fast enough, i dont care about the right timing so much
Peter

hiduino

#142
May 10, 2013, 12:36 am Last Edit: May 10, 2013, 01:17 am by hiduino Reason: 1
There is a way to slow down avrdude for the IDE programming but it is a global default setting, so it will affect all programming.

In the avrdude.conf file  look for this around line 314:
Code: [Select]

#
# Overall avrdude defaults
#
default_parallel   = "lpt1";
default_serial     = "com1";
# default_bitclock = 2.5


Change to at least:
Code: [Select]
default_bitclock = 150;

Note: don't forget the ';' to terminate the line.  The example comment left it out.

This worked fine programming an ATtiny13A @9.6MHz and even down to @ 128KHz.

Edit: Hehe, I actually was able to work the tiny13A @16KHz (128KHz/8).  I had to modify the wiring.c to add F_CPU = 16000.  It not very accurate, but Blink works reasonably.


Erni

Quote
p.s: a blink for 40 seconds now gives me around 44secs (at over 5 Volts)
so it looks to me  like it actually runsaround 10% slower on (9.6mhz -0.96) = at around 8.4 Mhz instead of the promised 9.6
is this normal?


The datasheet state the factory clock setting is within +-10%, so that is normal.

I was just playing with an ATtiny13 to see how close I could tune the osscillator, and it was quite easy to get within the +-2% mentioned in the datasheet by changing the OSCCAL value.
It is not very stable though, it jumps up and down.

One thing that surprised me:

Changing the OSCCAL dos not change the frequence of the 128 kHz internal Oscillator.

Coding Badly

Changing the OSCCAL dos not change the frequence of the 128 kHz internal Oscillator.


Two separate clocks.  The 128 kHz oscillator is the same clock used for the watchdog; which cannot be tuned.

Erni

Thanks Coding Badly,
Yes I can see it now, I just didn't think about it before.
On my particular t13 it is off by 8,8%, although it is not a problem.

smeezekitty

Internal clocks, being RC oscillators won't be too accurate.
They are not really stable over varying voltage either. Good enough for many cases though.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

ProfePaco

#147
May 17, 2013, 08:22 pm Last Edit: May 17, 2013, 08:38 pm by ProfePaco Reason: 1
One question about using the internal voltage reference...

Is it implemented? in which pin?

Could you please show me how to use it in this Arduino core?

I am employing analogReference(INTERNAL) and I obtain the following error:

"AnalogReference was not declared...."

Please, if it is not implemented, I really need it for my project. and it must be the internal reference.  =(

Thanks in advance

smeezekitty


One question about using the internal voltage reference...

Is it implemented? in which pin?

Could you please show me how to use it in this Arduino core?

I am employing analogReference(INTERNAL) and I obtain the following error:

"AnalogReference was not declared...."

Please, if it is not implemented, I really need it for my project. and it must be the internal reference.  =(

Thanks in advance

The two references supported are ~1.1v and VIN. External reference is not supported in hardware.

Make sure analogReference is spelled right. Make sure the core is installed properly. Before version 0.18 analogReference was stub so make sure you update.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

ProfePaco



One question about using the internal voltage reference...

Is it implemented? in which pin?

Could you please show me how to use it in this Arduino core?

I am employing analogReference(INTERNAL) and I obtain the following error:

"AnalogReference was not declared...."

Please, if it is not implemented, I really need it for my project. and it must be the internal reference.  =(

Thanks in advance

The two references supported are ~1.1v and VIN. External reference is not supported in hardware.

Make sure analogReference is spelled right. Make sure the core is installed properly. Before version 0.18 analogReference was stub so make sure you update.


This is very strange. I am using version 18. The same code can be compiled for Attint85, but it does not work for Attiny13. That means that it is correctly spelled. The code that fails follows:

void setup() {
analogReference(INTERNAL);
 // initialize the digital pin as an output.
 pinMode(led, OUTPUT);

time = millis();
memooculto = EEPROM.read(0); delay(80);
if (memooculto == 0) { maxmodereal = maxoculto;}
else  {maxmodereal = maxmode;}

mode = EEPROM.read(1);
delay(80);
if (mode == 0) {mode = 1;}
if (mode > maxmodereal) {mode = maxmodereal;}
}


Go Up