core13: An Arduino core for the Attiny13 *testers wanted*

OK, i find solution for Arduino as ISP and ATTINY13 on 128 KHz :

open in some text editor:

sketchbook\hardware\tiny13\avr\boards.txt

Close IDE and change Attiny13 @ 128 KHz section with this :

attiny13.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
attiny13.upload.tool=arduino:avrdude
attiny13.upload.using=arduino:arduinoisp
attiny13.upload.maximum_size=1024
attiny13.upload.maximum_data_size=64
attiny13.upload.speed=250

attiny13.bootloader.tool=arduino:avrdude
attiny13.bootloader.low_fuses=0x7B
attiny13.bootloader.high_fuses=0xFF

attiny13.build.mcu=attiny13
attiny13.build.f_cpu=128000
attiny13.build.core=core13

download zipped Arduino_slow_ISP sketch, then start IDE ( i tried on 1.6.1 only ) and install sketch on your arduino programmer ( i tried on breadboard atmega328 on 8MHz ) connect attiny13 as you usual do
and this version of - Arduino_slow_ISP sketch - is sufficiently slow to burn 128KHz fuse and upload sketch, and also change to other fuses as well, I just tried all options.

Arduino_slow_ISP.zip (3.78 KB)

common_ground:
OK, i find solution for Arduino as ISP and ATTINY13 on 128 KHz :

No change. I think it's time to try something new. Tomorrow I'll take another attiny13 to replace the current one and see if it is going to programmed, just in case I screwed something with schematic or managed to shortcut my poor attiny :). I will also try to find an AVR-fan-neighbor to borrow an external programmer.

grigorym:
No change. I think it's time to try something new. Tomorrow I'll take another attiny13 to replace the current one and see if it is going to programmed, just in case I screwed something with schematic or managed to shortcut my poor attiny :). I will also try to find an AVR-fan-neighbor to borrow an external programmer.

Only if you damage attiny13.Try with new one.

I just lock one ATTiny13 with standard ArduinoISP and unlock with Arduino_slow_ISP , work 100%. That makes using Arduino as excellent ISP programmer of choice.
I'll make one to be permanent, no need to buy anything else.

I program them at 128K all the time. I modified the Ardunio ISP program to run at a very low SPI rate
and it works with no problems. Make sure your wire connections are good.

smeezekitty:
I program them at 128K all the time. I modified the Ardunio ISP program to run at a very low SPI rate
and it works with no problems. Make sure your wire connections are good.

I was planning to disappear silently, but bad conscience brought me back to report my stupidity. Common_ground, I was trying to recover with your slow ISP not the attiny13, but the 555 timer chip :)). Surprisingly, it refused to be programmed :). @@@@!

So, reporting. Slow version of Arduino ISP successfully sets the fuses back and programs the chip. After that I was able to switch back to ordinary Arduino ISP. I went the whole process once again: programming with ordinary Arduino ISP the fuses for 128KHz, loosing control of the chip, uploading slow version of Arduino ISP and reprogramming the fuses and the sketch back.

Thank you very much for your assistance and patience. I'll mention the solution on a couple of places, where beginners like me stumbled upon 128KHz option.

As for USBTinyISP programmers, we do not have to change default_bitclock only in avrdude.conf, but we can change the parameters directly from the IDE environment (at least from 1.6.1), without changing avrdude.conf.

Open arduino-1.6.1\hardware\arduino\avr\programmers.txt in some text editor and change usbtiny section with this :

usbtinyisp.name=USBtinyISP -B10 (Default)
usbtinyisp.protocol=usbtiny
usbtinyisp.program.tool=avrdude
usbtinyisp.program.extra_params=

############ > 4.8 MHz ##################

usbtinyisp_2.name=USBtinyISP -B2 (> 4.8 MHz)
usbtinyisp_2.protocol=usbtiny
usbtinyisp_2.program.tool=avrdude
usbtinyisp_2.program.speed=2
usbtinyisp_2.program.extra_params=-B{program.speed}

############ < 4.8 MHz ##################

usbtinyisp_4.name=USBtinyISP -B4 (> 0.6 <= 4.8 MHz)
usbtinyisp_4.protocol=usbtiny
usbtinyisp_4.program.tool=avrdude
usbtinyisp_4.program.speed=4
usbtinyisp_4.program.extra_params=-B{program.speed}

############ 128 KHz ##################

usbtinyisp_50.name=USBtinyISP -B50 (= 128 KHz)
usbtinyisp_50.protocol=usbtiny
usbtinyisp_50.program.tool=avrdude
usbtinyisp_50.program.speed=50
usbtinyisp_50.program.extra_params=-B{program.speed}

##########################################

restart IDE and we have USBTinyISP options for diferrent bitclocks :

I just try some values and this is empirical result ( no upload error ) i get.

2us for > 4.8 MHz
4us for > 0.6 <= 4.8 MHz
10us - default settings for => 0.6 MHz
50us - for 128 KHz

Because i use often usbtiny for ATTINY85 too, upload speed improving the lot, for example :

avrdude: Using SCK period of 10 usec
avrdude: writing flash (8070 bytes):
Writing | ######################################### | 100% 21.05s
Reading | ########################################  | 100% 24.73s

avrdude: Setting SCK period to 2 usec
avrdude: writing flash (8070 bytes):
Writing | ######################################### | 100% 7.33s
Reading | ########################################  | 100% 8.19s

instead of 46 seconds I get the upload for 16 seconds for 8 Kb .hex file on 8 MHz attiny85.

With only 1K of memory, upload time isn't a big deal.

ElectroNick:
1.2K is a lot of bytes for a blink! The code must be not well optimized or sometin' . You can do plenty of useful things with 1K of command space. For example, here is a code for a 10-LED light chaser (can convert it into Cylon eyes or some other such blinking toy) and it compiles into only 562 bytes. In fact, there might even be some saving there still, I just didn't have too much time to optimize it.

I agree, 1.2k is a lot, i put an entire irrigation system in  some 700 bytes in an attiny13  AND it has a blinking LED :-)

Can anyone share with their boards.txt file?

gneil90:
Can anyone share with their boards.txt file?

There are quite a few floating around the internet. Here's one I've made up. It works as of today on Arduino 1.6.3.

menu.cpu=Processor
menu.clock=Clock

attiny.name=ATtiny
attiny.bootloader.tool=arduino:avrdude
attiny.bootloader.unlock_bits=0xFF
attiny.bootloader.lock_bits=0xFF
attiny.build.core=arduino:arduino
attiny.build.board=attiny
attiny.upload.tool=arduino:avrdude
 
attiny.menu.cpu.attiny45=ATtiny45
attiny.menu.cpu.attiny45.upload.maximum_size=4096
attiny.menu.cpu.attiny45.build.mcu=attiny45
attiny.menu.cpu.attiny45.build.variant=tiny8

###############################################################
 
attiny.menu.cpu.attiny85=ATtiny85
attiny.menu.cpu.attiny85.upload.maximum_size=8192
attiny.menu.cpu.attiny85.build.mcu=attiny85
attiny.menu.cpu.attiny85.build.variant=tiny8

###############################################################
 
attiny.menu.cpu.attiny44=ATtiny44
attiny.menu.cpu.attiny44.upload.maximum_size=4096
attiny.menu.cpu.attiny44.build.mcu=attiny44
attiny.menu.cpu.attiny44.build.variant=tiny14

###############################################################
 
attiny.menu.cpu.attiny84=ATtiny84
attiny.menu.cpu.attiny84.upload.maximum_size=8192
attiny.menu.cpu.attiny84.build.mcu=attiny84
attiny.menu.cpu.attiny84.build.variant=tiny14

###############################################################
 
attiny.menu.clock.internal1=1 MHz (internal)
attiny.menu.clock.internal1.bootloader.low_fuses=0x62
attiny.menu.clock.internal1.bootloader.high_fuses=0xDF
attiny.menu.clock.internal1.bootloader.extended_fuses=0xFF
attiny.menu.clock.internal1.build.f_cpu=1000000L

###############################################################
 
attiny.menu.clock.internal8=8 MHz (internal)
attiny.menu.clock.internal8.bootloader.low_fuses=0xE2
attiny.menu.clock.internal8.bootloader.high_fuses=0xDF
attiny.menu.clock.internal8.bootloader.extended_fuses=0xFF
attiny.menu.clock.internal8.build.f_cpu=8000000L

###############################################################
 
attiny.menu.clock.external8=8 MHz (external)
attiny.menu.clock.external8.bootloader.low_fuses=0xFE
attiny.menu.clock.external8.bootloader.high_fuses=0xDF
attiny.menu.clock.external8.bootloader.extended_fuses=0xFF
attiny.menu.clock.external8.build.f_cpu=8000000L

###############################################################
 
attiny.menu.clock.external16=16 MHz (external)
attiny.menu.clock.external16.bootloader.low_fuses=0xFE
attiny.menu.clock.external16.bootloader.high_fuses=0xDF
attiny.menu.clock.external16.bootloader.extended_fuses=0xFF
attiny.menu.clock.external16.build.f_cpu=16000000L

###############################################################
 
attiny.menu.clock.external20=20 MHz (external)
attiny.menu.clock.external20.bootloader.low_fuses=0xFE
attiny.menu.clock.external20.bootloader.high_fuses=0xDF
attiny.menu.clock.external20.bootloader.extended_fuses=0xFF
attiny.menu.clock.external20.build.f_cpu=20000000L

#################################################

attiny13.name=ATtiny13
attiny13.bootloader.tool=arduino:avrdude
attiny13.bootloader.unlock_bits=0xFF
attiny13.bootloader.lock_bits=0xFF
attiny13.build.core=arduino:arduino
attiny13.build.board=attiny
attiny13.upload.tool=arduino:avrdude
attiny13.upload.using=arduino:arduinoisp
attiny13.build.mcu=attiny13

attiny13.menu.cpu.attiny13=ATtiny13
attiny13.menu.cpu.attiny13.upload.maximum_size=1024
attiny13.menu.cpu.attiny13.build.mcu=attiny13
attiny13.menu.cpu.attiny13.build.variant=core13

#################################################
attiny13.menu.clock.internal128=128KHz (internal)
attiny13.menu.clock.internal128.bootloader.low_fuses=0x7B
attiny13.menu.clock.internal128.bootloader.high_fuses=0xFF
attiny13.menu.clock.internal128.bootloader.extended_fuses=0xFF
attiny13.menu.clock.internal128.build.f_cpu=128000L

################################################

attiny13.menu.clock.internal600=600KHz (internal)
attiny13.menu.clock.internal600.bootloader.low_fuses=0x69
attiny13.menu.clock.internal600.bootloader.high_fuses=0xFF
attiny13.menu.clock.internal600.bootloader.extended_fuses=0xFF
attiny13.menu.clock.internal600.build.f_cpu=600000L

################################################

attiny13.menu.clock.internal12=1.2MHz (internal)
attiny13.menu.clock.internal12.bootloader.low_fuses=0x6A
attiny13.menu.clock.internal12.bootloader.high_fuses=0xFF
attiny13.menu.clock.internal12.bootloader.extended_fuses=0xFF
attiny13.menu.clock.internal12.build.f_cpu=1200000L

################################################


attiny13.menu.clock.internal48=4.8MHz (internal)
attiny13.menu.clock.internal48.bootloader.low_fuses=0x79
attiny13.menu.clock.internal48.bootloader.high_fuses=0xFF
attiny13.menu.clock.internal48.bootloader.extended_fuses=0xFF
attiny13.menu.clock.internal48.build.f_cpu=4800000L

################################################

attiny13.menu.clock.internal96=9.6MHz (internal)
attiny13.menu.clock.internal96.bootloader.low_fuses=0x7A
attiny13.menu.clock.internal96.bootloader.high_fuses=0xFF
attiny13.menu.clock.internal96.bootloader.extended_fuses=0xFF
attiny13.menu.clock.internal96.build.f_cpu=9600000L

################################################

Hi all, I am about to start some t13 work again, is everything stable for me to use the cores with 1.6.3 ?
have there been any t13 core updates in the last 6 months or so ?

Its a big ole thread now isnt it !!

:slight_smile:

mcnobby:
Hi all, I am about to start some t13 work again, is everything stable for me to use the cores with 1.6.3 ?
have there been any t13 core updates in the last 6 months or so ?

Its a big ole thread now isnt it !!

:slight_smile:

The last update was in January. I have no idea about 1.6.x. I am always slow to upgrade Arduino
versions since they always seem to bork something lately.

Cheers Smeezekitty, I shall tentatively give it a go :slight_smile:

Since there is a difference between version 1.6.3 and 1.6.4 in relation to the earlier 1.6.x versions, i decided to make the installation file for 1.6.4 (1.6.3) version only.
Just unpack file in ...\sketchbook\hardware folder.

Boards included :

I added some GCC Flags ( can be used from IDE menu - choose default if you do not like to use extra optimisation flags ) :

And i added millis() , micros(), delayMicroseconds() and set ADC clock for 16 KHz ( it is not set for 16 kHz originally )

If you use 128 KHz - default_bitclock must be slow down to -B50 and for 16 KHz to -B250 ( USBTinyISP)

tiny13_for_1.6.4.zip (46.2 KB)

common_ground:
I add attiny13 install file for 1.6.4 IDE :
ATTiny13 for 1.6.4

Since the pins_arduino.h is blank, does someone know the exact pin configuration for the Attiny13? I added a dummy below :slight_smile:

// ATMEL ATTINY13 - ARDUINO
//
//                  +-\/-+
// AinX (D X) PB5  1|    |8  Vcc
// AinX (D X) PB3  2|    |7  PB2 (D X)  AinX
// AinX (D X) PB4  3|    |6  PB1 (D X) PWM
//            GND  4|    |5  PB0 (D X) PWM
//                  +----+

common_ground:
Since there is a difference between version 1.6.3 and 1.6.4 in relation to the earlier 1.6.x versions, i decided to make the installation file for 1.6.4 (1.6.3) version only.
Just unpack file in ...\sketchbook\hardware folder.

Boards included :

I added some GCC Flags ( can be used from IDE menu - choose default if you do not like to use extra optimisation flags ) :

And i added millis() , micros(), delayMicroseconds() and set ADC clock for 16 KHz ( it is not set for 16 kHz originally )

If you use 128 KHz - default_bitclock must be slow down to -B50 and for 16 KHz to -B250 ( USBTinyISP)

Thanks for that brilliant setup!
One thing that is not really streamlined is the categories. I changed that. So now it is ATtiny13 with all the clock speed and all compiler options (only listed once for all speeds of course). Only 9.6MHz tested.

boards.txt (4.26 KB)

Yes, excellent solution, Thanks nicnac.

hansibull:
Since the pins_arduino.h is blank, does someone know the exact pin configuration for the Attiny13? I added a dummy below :slight_smile:

// ATMEL ATTINY13 - ARDUINO

//
//                  +-/-+
// AinX (D X) PB5  1|    |8  Vcc
// AinX (D X) PB3  2|    |7  PB2 (D X)  AinX
// AinX (D X) PB4  3|    |6  PB1 (D X) PWM
//            GND  4|    |5  PB0 (D X) PWM
//                  +----+

The pins are internally converted hence no need for pins_arduino. If you don't mind, I can add this to the next release for reference purposes. After I check it for accuracy at least

smeezekitty:
The pins are internally converted hence no need for pins_arduino. If you don't mind, I can add this to the next release for reference purposes. After I check it for accuracy at least

Yes, please add the pinout to the next core13 version :slight_smile:
Buy why have you just uploaded the core files, and not a complete set of folders, including boards.txt?
The setup would be much simpler if you wouldn't need to dig through the whole forum post to find the correct files :slight_smile:

hansibull:
Buy why have you just uploaded the core files, and not a complete set of folders, including boards.txt?
The setup would be much simpler if you wouldn't need to dig through the whole forum post to find the correct files :slight_smile:

Because it is a royal pain in the BUTT to work with the *.txt that Arduino uses. When I wrote it, I couldn't figure it out myself. I kind of have it figured now but there are already working boards.txt out there.

Please help me out. I was expecting neoPixel lib to be able to handle 9.6MHz but looks like its not.

The neopixel code is unportable (it calls internal core functions rather than just the external ones)
It would need to be rewritten.