Attiny13 with Arduino ISP - Electronics Forums

Author Topic: Attiny13 with Arduino ISP  (Read 20708 times)

lefty.crupps

  • Trusted Member
  • *
  • Posts: 6
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Attiny13 with Arduino ISP
« Reply #15 on: December 04, 2012, 10:46:41 AM »
> We still do not know which core they are using.

I've installed the 'tiny' and the 'core13' as discussed in the original blog post.  I also added the original text to the boards.txt file.  According to a comment on that post, the boards.txt example text may not be accurate:
http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/#comment-13913

but I've asked for accurate boards.txt entries for each of the core options (tiny and core13)
http://elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/#comment-18663

and no one has given any info about different boards.txt entries so I hoped things are fine.  Very possibly they are not.

Electronics Forums

Re: Attiny13 with Arduino ISP
« Reply #15 on: December 04, 2012, 10:46:41 AM »

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Attiny13 with Arduino ISP
« Reply #16 on: December 04, 2012, 12:08:05 PM »
and no one has given any info about different boards.txt entries so I hoped things are fine.  Very possibly they are not.

L.C., I had to edit the blog entry to fix the issue with 128kHz setting for the internal clock as well as a syntax error in the original boards.txt file . However, I am still having issues with burning fuses and communicating to the Attiny13 after switching it to 128kHz. So, at this point in time, I would have to say that it's probably better to stay away from running it at so low a clock speed because of the difficulties in establishing proper communication at such low speed. Unfortunately, I have a feeling that your Attiny13 (as well as mine at the moment) is stuck at 128kHz internal clock. Please enable verbose output in Arduino (File->Preferences->Show verbose output during -> upload) and post if you have any error reported.

Here is the boards.txt file that I have just verified every entry of except for 128kHz. In theory, all the 128kHz settings look OK but I'm still having issues with it, so please don't use it yet if you can avoid it. The 4.8MHz with an "8" divider gives a slow enough clock of 600kHz which is good for power consumption and yet still gives no headache in terms of communication to the chip. Here is the proper boards.txt for core13 (a.k.a. smeezekitty''s core):

Code: [Select]
###########################################################################

attiny13.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
attiny13.upload.using=arduino:arduinoisp
attiny13.upload.maximum_size=1024
attiny13.upload.speed=250
attiny13.bootloader.low_fuses=0x7B
attiny13.bootloader.high_fuses=0xFF
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=128000
attiny13.build.core=core13

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

attiny13at600.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock, divided by 8 - 600kHz)
attiny13at600.upload.using=arduino:arduinoisp
attiny13at600.bootloader.low_fuses=0x69
attiny13at600.bootloader.high_fuses=0xff
attiny13at600.upload.maximum_size=1024
attiny13at600.upload.speed=9600
attiny13at600.build.mcu=attiny13
attiny13at600.build.f_cpu=600000
attiny13at600.build.core=core13

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

attiny13at1200.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock, divided by 8 - 1.2MHz)
attiny13at1200.bootloader.low_fuses=0x6a
attiny13at1200.bootloader.high_fuses=0xff
attiny13at1200.upload.maximum_size=1024
attiny13at1200.build.mcu=attiny13
attiny13at1200.build.f_cpu=1200000
attiny13at1200.build.core=core13

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

attiny13at9m.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock)
attiny13at9m.bootloader.low_fuses=0x7a
attiny13at9m.bootloader.high_fuses=0xff
attiny13at9m.upload.maximum_size=1024
attiny13at9m.build.mcu=attiny13
attiny13at9m.build.f_cpu=9600000
attiny13at9m.build.core=core13

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


I also noted another quirk in the way Arduino ISP operates: sometimes it won't burn fuses and reports an error after you've uploaded a sketch into Attiny13 a few times. I don't know what it is, but there's probably some kind of a variable that gets populated with a value that should be empty or some such programming error/feature in the Arduino ISP. But I've found that burning of the fuses goes much more reliably (see the note about 128kHz above tho) if you switch the Boards entry to Uno, upload the Arduino ISP to your Uno again, then switch the Boards entry to the Attiny13's proper clock frequency (avoid 128kHz for now) and then burn the fuses and load the actual sketch for Attiny13. It's a hassle but, fortunately,   you only need to burn fuses once.

smeezekitty

  • Trusted Member
  • *
  • Posts: 14
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Attiny13 with Arduino ISP
« Reply #17 on: December 04, 2012, 01:41:22 PM »
###########################################################################
 
attiny13.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
 
attiny13.upload.using=arduino:arduinoisp
# attiny13.upload.protocol=avrispv2
# attiny2313at1.upload.using=pololu
 
attiny13.upload.maximum_size=1024
attiny13.upload.speed=250 # important for not losing connection to a slow processor
 
attiny13.bootloader.low_fuses=0x7B
attiny13.bootloader.high_fuses=0xFF
 
attiny13.bootloader.unlock_bits=0x3F
attiny13.bootloader.lock_bits=0x3F
 
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=128000
attiny13.build.core=core13
 
###############################################################
 
attiny13at4.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock)
attiny13at4.bootloader.low_fuses=0x69
attiny13at4.bootloader.high_fuses=0xff
attiny13at4.upload.maximum_size=1024
attiny13at4.build.mcu=attiny13
attiny13at4.build.f_cpu=600000
#
attiny13.build.core=arduino:arduino
attiny13.build.variant=tiny8


#attiny13at4.build.core=core13
###############################################################
 
attiny13.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock)
attiny13.bootloader.low_fuses=0x7a
attiny13.bootloader.high_fuses=0xff
attiny13.upload.maximum_size=1024
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=9600000L
attiny13.build.core=arduino:arduino
attiny13.build.variant=tiny8
###########################################################################

Bold part seems wrong

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Attiny13 with Arduino ISP
« Reply #18 on: December 04, 2012, 02:06:58 PM »
Bold part seems wrong
Yes, that and, unfortunately, something else was wrong with it: both 9.6MHz and 128kHz were using the same record name, which is a syntax error - they cannot have the same name "attiny13" :

To write them like this:
attiny13.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock)
...
attiny13.name=Attiny13 @ 128 KHz (internal watchdog oscillator)

was a big mistake on my part and I'm afraid this is how lefty.crupps has gotten into trouble in the first place - because if you're burning fuses at 128kHz and then compiling sketch for 9.6MHz , not only your timing will be wrong but also the chip will lose connection to the Arduino ISP (I just started another thread about that) .

The other issues you've highlighted in bold are remnants of my trying to joggle 3 different ATtiny-related cores at the same time. build.core = arduino:arduino came from the MIT core settings if I remember correctly and I ended up mixing the cores and their boards.txt together (I had all cores installed at the time). Now I've removed all cores except for your core13  and that's how I was able to verify this correct version of boards.txt for core13
Code: [Select]
###########################################################################

attiny13.name=Attiny13 @ 128 KHz (internal watchdog oscillator)
attiny13.upload.using=arduino:arduinoisp
attiny13.upload.maximum_size=1024
attiny13.upload.speed=250
attiny13.bootloader.low_fuses=0x7B
attiny13.bootloader.high_fuses=0xFF
attiny13.build.mcu=attiny13
attiny13.build.f_cpu=128000
attiny13.build.core=core13

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

attiny13at600.name=ATtiny13 @ 4.8MHz (internal 4.8 MHz clock, divided by 8 - 600kHz)
attiny13at600.upload.using=arduino:arduinoisp
attiny13at600.bootloader.low_fuses=0x69
attiny13at600.bootloader.high_fuses=0xff
attiny13at600.upload.maximum_size=1024
attiny13at600.upload.speed=9600
attiny13at600.build.mcu=attiny13
attiny13at600.build.f_cpu=600000
attiny13at600.build.core=core13

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

attiny13at1200.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock, divided by 8 - 1.2MHz)
attiny13at1200.bootloader.low_fuses=0x6a
attiny13at1200.bootloader.high_fuses=0xff
attiny13at1200.upload.maximum_size=1024
attiny13at1200.build.mcu=attiny13
attiny13at1200.build.f_cpu=1200000
attiny13at1200.build.core=core13

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

attiny13at9m.name=ATtiny13 @ 9.6MHz (internal 9.6 MHz clock)
attiny13at9m.bootloader.low_fuses=0x7a
attiny13at9m.bootloader.high_fuses=0xff
attiny13at9m.upload.maximum_size=1024
attiny13at9m.build.mcu=attiny13
attiny13at9m.build.f_cpu=9600000
attiny13at9m.build.core=core13

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

I've also updated the original post.

lefty.crupps

  • Trusted Member
  • *
  • Posts: 6
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Attiny13 with Arduino ISP
« Reply #19 on: December 04, 2012, 09:42:00 PM »
Awesome finds!  I've replaced my boards.txt file and the various boards are available (all 4 of them now).

Still, upload errors.  The attached screenshot shows that I uploaded ArduinoISP onto the Uno, (added my capacitor), changed to the Board > ATtiny13, uploaded the bootloader, opened the Blink code, changed to Pin4, and tried to upload using 'Upload using Programmer':
Code: [Select]
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=attiny13 -DF_CPU=600000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 -I/home/eljefe/sketchbook/hardware/attiny/cores/core13 /tmp/build1188657047714373045.tmp/Blink.cpp -o /tmp/build1188657047714373045.tmp/Blink.cpp.o
Blink.cpp:10:21: fatal error: Arduino.h: No such file or directory
compilation terminated.

:) I know I'm close tho!  Any more ideas?

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Attiny13 with Arduino ISP
« Reply #20 on: December 04, 2012, 10:30:17 PM »
Awesome finds!  I've replaced my boards.txt file and the various boards are available (all 4 of them now).

Still, upload errors.  The attached screenshot shows that I uploaded ArduinoISP onto the Uno, (added my capacitor), changed to the Board > ATtiny13, uploaded the bootloader, opened the Blink code, changed to Pin4, and tried to upload using 'Upload using Programmer':
Code: [Select]
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=attiny13 -DF_CPU=600000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=101 -I/home/eljefe/sketchbook/hardware/attiny/cores/core13 /tmp/build1188657047714373045.tmp/Blink.cpp -o /tmp/build1188657047714373045.tmp/Blink.cpp.o
Blink.cpp:10:21: fatal error: Arduino.h: No such file or directory
compilation terminated.

:) I know I'm close tho!  Any more ideas?

Lefty, good news/bad news: those are not upload errors, those are compilation errors (i.e. C++ cannot compile a binary file using a proper core and hence for the proper MCU - Attiny13). Also, if you were able to burn the fuses (which did you choose, BTW?) then for troubleshooting you don't even need to use "Upload using Programmer", just hit the "Verify" button (or Ctrl+R) and when you see no errors, you are good to go. After making sure "Verify" works,  you can "Upload". 

So, the good news is that the Tiny is hooked up to the Uno properly and the Uno's ArduinoISP sketch is working fine.

The actual error you are getting is caused by the core13 file's  located in a wrong directory.

There are two places for them (in Linux notation):
~/sketchbook/hardware/tiny/cores/core13  (preferred 'cause it will survive Arduino IDE upgrade)

or

[arduino binary's location]/hardware/arduino/cores/core13

The bold parts are actually arbitrary (can be anything for as long as the right boards.txt file is in there), the rest has to be like that. I could not see quite clearly on your printscreen if you're actually using the /hardware/ after your ~/sketchbook but I can see that you are missing one subdirectory /cores/  before your /core13/. Just make sure the core files are under ~/sketchbook/hardware/attiny/cores/core13/ and you should be good to go!
 
« Last Edit: December 04, 2012, 10:49:05 PM by ElectroNick »

lefty.crupps

  • Trusted Member
  • *
  • Posts: 6
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: Attiny13 with Arduino ISP
« Reply #21 on: December 04, 2012, 11:07:49 PM »
OH YEAH.  Doin' the bull dance, feelin' the flow!   ;D I got my blink on!  (and off, and on again!).  I uploaded using the 4.8/8 (600MHz), fwiw.

The location was the final piece to this puzzle; I now have these directories and files at:
~/sketchbook/hardware/tiny/cores/core13/
~/sketchbook/hardware/tiny/cores/attiny/
~/sketchbook/hardware/tiny/cores/boards.txt

My upload now works, my blink() sketch now runs, etc!  What a learning experience and thank you all for the help!  I cannot wait to get my project moving forward...  I look forward to posting it to the Accomplishments board :)  And learning more about these types of chips and figuring out uses for them...

See you here in the forums :)  I'm sure to have more questions!

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: Attiny13 with Arduino ISP
« Reply #22 on: December 04, 2012, 11:37:03 PM »
You got it! I am very much looking forward to seeing your creation in the Post your Project (a.k.a Accomplishments - I like that!  ;) )  board.
Your question has actually revived my own interest in these little MCUs (I needed many more I/Os lately) and I've started a project with ATtiny13 myself. Glorified blinker, of course, but that's what these are so great for, so I'm using it.

Another  thing your question helped with was to motivate me to clean my own mess of multiple Arduino IDE versions/ Multiple Tiny cores / two boards.txt files both with errors  etc. I now finally have a stable enough development platform. I am also glad I've downloaded the newer version of smeezekitty's core13 because I can see it has improved since I first posted that blog post, so I'm sticking with his core for Attiny13 chips.

So, thanks for stopping by, best of luck with your project and do check in here if you have a question and definitely to show your accomplishments! 

Cheers!

 

Related Topics

  Subject / Started by Replies Last post
11 Replies
11480 Views
Last post December 13, 2012, 02:02:30 PM
by smeezekitty
2 Replies
33926 Views
Last post July 29, 2013, 01:51:24 PM
by Akshay
9 Replies
21644 Views
Last post December 16, 2015, 12:03:18 PM
by PaulBailey
0 Replies
1909 Views
Last post July 11, 2017, 04:41:56 AM
by mishmalik
0 Replies
2073 Views
Last post July 11, 2017, 05:07:13 AM
by mishmalik

anything