ATTiny85 port (work in progress)

heh, god bless the search box

and the find of bbedit is fabulous!
pfew. i'm half way through the files. have to call it a night now. maybe tomorrow more.

i had to guess with the timers because obviously the attiny has less of them. well we will find out later.

well I know I appreciate the work people put into porting the arduino functionality to these tiny chips

and even though I dont have a application where a 85 would fit in, I know it probably wont be long before I do

Thanks for your efforts, and keep up the good work

And of course, there's always the other extreme -- I'm currently working on a 1284 port, now I have my hands on a few 1284P DIPs.

Of course, the 644 port helps, but there are other differences apart from FLASH size and RAM.

well. i got a compile without errors now, but i had to disable some functions in tone.cpp and others because i lack the time to do it propperly. it means digging in the amount of timers and their functions. the tiny has less timers so it could get crowded.

next thing is actually uploading the sketch to the little beast and see if it works. unfortunate all my breadboards are at my workplace tonight. >:( Ohh well maybe I start reading into the workings of the timers and how they are used in the arduino...

I would not dare upload the unfinished cores before i have proof of its functionality. so please be patient.

:slight_smile: :slight_smile: :slight_smile:

of course i let myself not ne hampered by missing hardware. that is what a junk box is for.

i needed to change a thing to the boards.txt file:

attiny85.upload.using=avrispmk2

was wrong. it should be

attiny85.upload.using=avrispmkii

and after successfully uploading the blink sketch the led blinked 8 times to slow. this with a virgin attiny85. that is set from the fatory @ 1Mhz so i had to flash the fuses with

avrdude -c avrispmkII -P usb -p attiny85 -U hfuse:w:0xDF:m -U lfuse:w:0xE2:m

then it works.

so the main production stream is smooth now. next step will be trying several procedures like pwm and analog in...

Ok. so with pwm i get some errors in the

Arduino-0018.app/Contents/Resources/Java/libraries/Servo/Servo.cpp

file.

It can't find TCCR1A declared. Hmm. that was something i did'nt have time to look into. is there someone with timer knowledge around to help me out?

Nice! I am keeping my eye on this.

I have a Tiny85 version of Bitlash here that's not ready for release, but I'm happy to share the arduino hardware interface code, including serial tx/rx, pwm on one timer, and analog input handling:

http://bitlash.net/wiki/_media/bitlash-hardware-attiny85.c

Caveat: this is collated from several bits of work-in-progress and I can't testify it even compiles. But it may help with this excellent project.

Good luck. Happy to answer questions.

-br

http://entropymouse.com

Why would this work on the tiny85 and not the 45? I don't want the bootloader or anything, so 4k should be fine.... Or am I missing something?

did someone say it doesnt work on a attiny45?

What's the smallest ATtiny that works? Even the ATtiny13(A)?

the 13a has the same footprint as a tiny85. specs are different. less ram, eeprom or flash. it should be doable, but after finding the tiny85 more worthwile i abandoned the 13a. i choose the tiny because of its physical size. the soic-8 is just 7.7 x 5.5 x 1.5 mm and with a internal rc clock you only need one external resistor to make it run.

I just hadn't seen anybody mention anything about stuff besides the attiny85. I'll try harder to get this working later.

EDIT:
I got rid of some errors by changing simple stuff (like trying to identify the chip as attiny85v and not attiny85). Now I get

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:49: error: conflicting types for 'port_to_mode_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:54: error: previous declaration of 'port_to_mode_PGM' was here

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:55: error: conflicting types for 'port_to_output_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:56: error: previous declaration of 'port_to_output_PGM' was here

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.c:61: error: conflicting types for 'port_to_input_PGM'

/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/pins_arduino.h:55: error: previous declaration of 'port_to_input_PGM' was here

Have you gotten around this yet?

I want to use a Tiny45 for a tiny robot that uses 3 servos and 2 LDR sensors. For that I need the analog conversion to work and perhaps software servo, or I guess I'll just generate the servo pulses in my code, because the Servo library uses Timer1 that is 16bit in the mega, but 8 bit in the tiny. 8 bit PWM does not give a good enough resolution for servos.

So, I need to find out how to make it possible to compile and upload the sketches from the IDE (windows 7). I have tried in the past to port a Tiny861 but failed due to numerous libraries that do not work properly. I will be using a AVR ISP programmer to upload the sketches. Can someone point me what files I need to modify to make this work?

Thank you in advance.

@Wyager: i did'nt have those errors so i cannot tell. at the moment i'm fixing tone.cpp. a lot to do with remapping timers because the attiny heas less. i think i fixed analogread pwm and analogwrite, but still without hardware proof.

attiny85 + avrstudio + avrdude = much less pain.

have you seen this port

it should be vary similar to this one

That last one there worked for me, it was very simple to change boards.txt. I have to actually try putting it on the chip though, I only compiled. Another thing is that the size of the arduino sketch is HUGE compared to the same program in avr-c, like 700 bytes vs probably under 100. Still, it could be useful.

well it has been really busy last week, so i finally have the time to test some things. blink works, fade works, if only on pin 0. and i upload it directly from the ide with a avrusbmkII. i have to compare my cores with that from the above link to see what are the differences.

the problems still exist with includes to other libraries :frowning: servo.h does not work (yet!)