32kHz crystal with ATtiny85 - Invalid device signature

I tried connecting a 32kHz crystal to my ATtiny85 via this youtube tutorial: Using a 32KHz watch crystal on an ATtiny85 - YouTube

I'm using my Arduino UNO as ISP
Ever since I changed the fuses I've gotten an Invalid device signature.
I have tried slowing the baud rate, changing the bit clk period, using newer versions of the ArduinoISP sketch and changing the crystal. I have 3 crystals lying around of which I think are 32kHz, 2 of them I am sure of it that they are 32khz.

This is trying to upload a blink program:

and trying it with -F:

This is the programmer's sketch:

If you need any other information, please ask.

I suspect it's trying to talk to it too fast for the chip to respond. You need to crank it WAY down, since you've got it clocked at ~1/34th of the default 1mhz clock. The SCK clock needs to give the chip 6 clock cycles per SCK clock so... ~5kHz max?

Did you include the appropriate loading caps with the crystal? (see pg 29 sec. 6.2.5 Low-Frequency Crystal Oscillator in datasheet)

That's what I thought too, I tried lowering the sck period to 200 microseconds, that should be exactly 5kHz.
In the tutorial the guys says that the ATtiny85 has capacitance built-in at those chips so those should not be needed. I'll take a look around and see if I have some capacitors laying around and test those out.

I also downloaded these and tried the avrdude config. That seemed(?) to help, since I now get some response from the chip, instead of just zeros. Again, I'm not an expert at this so I don't know what difference it makes. GitHub - SpenceKonde/ATTinyCore: Arduino core for ATtiny 1634, 828, x313, x4, x41, x5, x61, x7 and x8

Results:

I used 2 22 pF capacitors, and it changed nothing.

I noticed, and I don't think this has anything to do with the capacitors, but -B 200 does not seem to work to set the SCK period. It still says 0.1 us at the bottom.

Where are you doing -B200?? That sounds like an avrdude parameter - the SCK period is set in the ArduinoAsISP sketch...

More bad news though - the SPI clock is made by dividing the system clock, but even the maximum SPI speed divisor, unless I'm misreading table 19-5 and page 168 of the datasheet, is still way too high... 16mhz / 128 = ~125khz... which is way too fast...

Though I don't have the arduinoasisp code handy to check whether they've got a way to work around this (bitbang SPI or something?)

How'd the guy who did the youtube video program his?

Yes, I was using it with avrdude. I don't know where to set the SCK period in the arduinoISP sketch, I searched for it but couldn't find it. Any hint?

The guy in the youtube video was using avrdude. All he did was set the fuses, connect the crystal and he used -B 250 and it worked. I always thought that would set the SCK period but apparently it does something completely else.

Then again, I just noticed that the guy wasn't using Arduino as ISP so his programmer was probably the reason why it worked right away.

If you want to take a look at the newer ArduinoISP sketch/program that I'm using:

Can you try this one? It uses software spi and can go arbitrarily slow.
Modify the define into

#define SPI_CLOCK            (34000/3)

PeterVH:
Can you try this one? It uses software spi and can go arbitrarily slow.
Modify the define into

#define SPI_CLOCK            (34000/3)

Yes, that definitely seems to work with avrdude! Except it doesn't work with the Arduino 'IDE'

EDIT: Nvm, I did something wrong in the arduino software. It works. Now let's see if the blink program is steady.

Alright uploading and everything works. Thank you.

Now. Next problem :frowning: The timing doesn't 'line up' with the timing I give in the arduino software. delay(20) gives me about 0.6 seconds of delay. I kinda expected this, but I don't know how to fix it. Maybe the fuses are wrong or there's something wrong in the software.

EDIT: Actually, this is exactly what the video explained. I can figure this out on my own. Thank you guys.

castoer:
Alright uploading and everything works. Thank you.

Now. Next problem :frowning: The timing doesn't 'line up' with the timing I give in the arduino software. delay(20) gives me about 0.6 seconds of delay. I kinda expected this, but I don't know how to fix it. Maybe the fuses are wrong or there's something wrong in the software.

EDIT: Actually, this is exactly what the video explained. I can figure this out on my own. Thank you guys.

ya, you just need a new boards.txt entry with the appropriate speed there.

If you're using my core (the one linked from my sig, you mentioned it above), you can add it to the clock speed menu like so:

attinyx5.menu.clock.32external=32.768 khz (external)
attinyx5.menu.clock.32external.bootloader.low_fuses=0xC6
attinyx5.menu.clock.32external.build.f_cpu=32768L
attinyx5.menu.clock.32external.bootloader.file=empty/empty_all.hex