Disabling attiny45 Clock Divide (CKDIV8) using arduinoISP + AVRDude

I tried everything, i can now upload with arduino tiny core but the servo still goes to one corner with little steps.... :0

Select the "ATtiny85 @ 8 MHz" board. Execute Tools / Burn Bootloder / Arduino as ISP. Try the servo sketch. Any change?

When i select attiny85 @8Mhz and burn bootloader it says the signature is wrong (witch is making sense) and when i select attiny45 @8Mhz and select burn bootloader it says:

avrdude: failed to read all of lock memory, rc=-2

please? i'm already waaay too late with this project and would like to finish it tonight..

If it makes it any easier, i have a 16MHz crystal+2 22pf capacitors lying around here…

lyron:
When i select attiny85 @8Mhz and burn bootloader it says the signature is wrong (witch is making sense)

Sorry about that.

and when i select attiny45 @8Mhz and select burn bootloader it says:

avrdude: failed to read all of lock memory, rc=-2

Locate the avrdude.conf file in the directory tree where you installed the Arduino IDE. It should be located in…

  {ArduinoRoot}\hardware\tools\avr\etc\

Open the file in a text editor. I believe the file has Unix line-endings so Notepad may not work. Locate the ATtiny45 section. The lock memory section should look like this…

     memory "lock"
         size            = 1;
         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                           "x x x x  x x x x  1 1 i i  i i i i";
        min_write_delay = 9000;
        max_write_delay = 9000;
       ;

Change it to this…

     memory "lock"
         size            = 1;
         write           = "1 0 1 0  1 1 0 0  1 1 1 x  x x x x",
                           "x x x x  x x x x  1 1 i i  i i i i";
[glow=yellow,2,300]         read            = "0 1 0 1  1 0 0 0  0 0 0 0  0 0 0 0",
                           "0 0 0 0  0 0 0 0  o o o o  o o o o";[/glow]
        min_write_delay = 9000;
        max_write_delay = 9000;
       ;

Save and close the avrdude.conf file. Try again to burn the “bootloader”.

Thanks,

I changed the avrdude.conf file and succesfully boatloaded the IC but now i encountered another problem: when i plugged the servo in, it just goes to one side but doesn't turn back, i'm using this code btw:

#include "Servo8Bit.h"


Servo8Bit myServo;  //create a servo object.
                    //a maximum of five servo objects can be created


void setup()
{
    myServo.attach(1);  //attach the servo to pin PB1
}


void loop()
{

        myServo.write(180);           
        delay(1000);                    
         myServo.write(0); 
         delay(1000);

}

lyron: Thanks,

You are welcome.

I changed the avrdude.conf file and succesfully boatloaded the IC

Excellent. You now have an ATtiny45 running at 8 MHz and a way to upload code.

include "Servo8Bit.h"

Servo8Bit myServo; //create a servo object.

Is Servo8Bit a "soft servo" implementation or does it use a timer? If it uses a timer, which one?

I don't know, i should still have my noobie title :(

I got the library from http://www.cunningturtle.com/attiny4585-servo-library/

on the site it says

Uses timer0 by default with no easy way to configure it to use another timer.

Unfortunately, the Servo8Bit author assumed timer 0 is in the default state from reset / power-up.

Try this...

• Locate the

core_build_options.h

file in the Tiny Core.

• Open the

core_build_options.h

file using your favourite text / source editor.

• Locate

INITIALIZE_SECONDARY_TIMERS

.

• Change the line of code to this (basically, change the one to a zero)...

    #define INITIALIZE_SECONDARY_TIMERS               [glow=yellow,2,300]0[/glow]

• Save

core_build_options.h

and close the editor.

• If the Arduino IDE is running, close and restart it.

• Upload your sketch.

Thanks again for your help,

but no: changed the 0 to a 1 and it still just writes one position (either 0 or 180) to the servo and nothing else..

You could try the SoftwareServo. I have tried it with success on am attiny85 running 8mhz

@Ernie

What code did you exactly use? i'm trying to get softwareservo to work but it compiles and programs the chip but when i hook up a servo nothing happens :S

Hi Lyrun

Here is my code.
I was told that you could not use delay() and SoftwareServo at the same time !!, therefore the “blink without delay” code.
I didn’t change the core_build_options.h

#include <SoftwareServo.h>

SoftwareServo servo;

int potpin = 3;  
int val;
long previousMillis = 0;        // will store last time LED was updated
long interval = 100;           // interval at which to blink (milliseconds)


void setup()
{
 pinMode(1, OUTPUT);
 pinMode(3, INPUT);
 servo.attach(1);
}

void loop()
{
  
    unsigned long currentMillis = millis();
    val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023) 
    val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 

 if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;  
    servo.write(val);    // sets the servo position according to the scaled value 
    SoftwareServo::refresh();

 } //if

} //loop

I undid the change to the core file and tried your code but the servo still won't move :S

How is the servo powered?

[quote author=Coding Badly link=topic=79300.msg602435#msg602435 date=1321862537]

How is the servo powered?

[/quote]

It's powered off the same 5v from my normal arduino that the attiny is hooked up to

Are you able to control the servo using your "normal Arduino"?

yep, it's not the servo, i also tried other servo's...