Page 1 of 2
ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 1:28 pm
by cbmeeks
I've been using the DS1813 in some of my circuits for resetting the 65C02. Works great but they are a little pricey at around $2.43 each.
I'm also going to start learning the NXP SC28 UART which, IIRC, has an active-high reset (vs. active-low for 6502). Just use an inverter...no problem.
So instead of the DS1813 and an inverter, why not use an ATtiny13 for around $0.85? It has 6 I/O and can run 20 MHz (IIRC).
Could the ATtiny13 do the following?:
1) Monitor (and de-bounce) the reset button (1 I/O)
2) Hold 6502 reset high when button not pressed (1 I/O)
3) Hold NXP reset low when button not pressed (1 I/O)
4) Provide 1 MHz clock (1 I/O) for devices
That's 4 I/O lines.
Now, I'm not sure if it can really push a 1 MHz square wave externally. Of course, this limits has fast your machine can run but I'm building a 1 MHz machine anyway.
Even if I didn't use it for the clock, seems like a no-brainer for the reset lines.
Thoughts?
ATtiny13
https://www.mouser.com/ProductDetail/Mi ... NJHUXxU%3d
Datasheet
https://www.mouser.com/datasheet/2/268/ ... 315482.pdf
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 1:38 pm
by Martin A
Another option for reset supervisor for less than the cost of the ATTiny13 is the TL7705.
It's got active high and active low resets. It's available in hobby friendly DIP packaging too.
I've used it with the 65C02 and 82C55 PPI.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 1:44 pm
by cbmeeks
Ah, not a bad idea. Haven't seen those. They are a little cheaper.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 1:49 pm
by BitWise
The internal oscillator runs a funny speed (4.8MHz or 9.6MHz) which might be awkward to scale down to 1MHz. I've never used Atmel chips directly.
I got a PIC16F18313 doing the same kind of thing a while back.
https://github.com/andrew-jacobs/hz-maker
The PIC has a 8MHz clock which can be divide down into 1, 2, 4 or 8Mhz output. It has a numerically controlled oscillator that is used to generate a 1.8432MHz signal for a 6551 ACIA but could produce other baud rate frequencies.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 1:54 pm
by cbmeeks
I believe the Atmel chips can take an external clock up to 20MHz and then divide that down more evenly.
Ah, that's a good point about the ACIA clock too. For my UART, I think I need another clock of 3.6864 MHz. So perhaps I skip the ATtiny for clock generation, use a 3.6864 MHz crystal and just divide by 2 for the CPU clock. A little faster than 1 MHz but it would be in lock-step with the UART.
Not sure how important that is, however.
1 MHz makes the math easy.

Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 2:18 pm
by Druzyek
I have been thinking about something very similar. Those Atmel parts are very attractive since they work at up to 5v and cost around a dollar.
Looking at the datasheet, I did not find an option to reroute the system clock to one of the pins, so you would have to flip the clock pin yourself with code. With 9.6 MHz as the internal oscillator frequency, so you would have 9-10 cycles to flip the pin and jump back to the beginning of the flip routine. This might just be doable since the AVRs are supposed to have mostly single cycle instructions. I have never tried, though, so I'm not sure. If you want the 20 MHz frequency the datasheet mentions, you need to supply that signal to the chip yourself, since it doesn't have the circuitry to support a crystal.
I have been looking at another chip in that line called the ATtiny2313A, which is $1.36 and comes in DIP20:
http://ww1.microchip.com/downloads/en/D ... oc8246.pdf
On page 27 you can see that it has an 8 MHz internal oscillator that can be divided by 8, which gives you 1 MHz. Page 32 shows that you can output this signal on a pin, so you don't have to execute any code to generate the clock. It can run from an external clock like the ATtiny13 or from a crystal connected directly to the chip. This would let you generate any clock up to 20 MHz depending on the crystal you use if you want to build a faster 6502 system.
Another option with similar capability is the ATmega48 for $1.79 in DIP28:
https://www.mouser.com/datasheet/2/268/ ... 315337.pdf
You could replace a of functionality in the VIA and other chips since these have SPI/I2C/PWN/timers/ADC/USART built in.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 2:37 pm
by floobydust
Another option for reset supervisor for less than the cost of the ATTiny13 is the TL7705.
It's got active high and active low resets. It's available in hobby friendly DIP packaging too.
I've used it with the 65C02 and 82C55 PPI.
I also used the TL7705B in my recent C02 Pocket SBC. There are a small number of additional components, resistors/capacitors required but it's been a very good choice, as I also used a NXP UART, hence the positive going Reset signal requirement. Attached is a partial schematic showing the TL7705B Reset and a DS-1813 NMI Panic.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 4:56 pm
by BigDumbDinosaur
For my UART, I think I need another clock of 3.6864 MHz.
You do.
So perhaps I skip the ATtiny for clock generation, use a 3.6864 MHz crystal and just divide by 2 for the CPU clock. A little faster than 1 MHz but it would be in lock-step with the UART.
Not sure how important that is, however.
NXP UARTs operate asynchronously to the MPU and only know about the 3.6864 MHz clock. Hence the MPU's Ø2 rate can be anything you want.
Incidentally, I recommend you use a can oscillator, not a crystal, to generate your clocks.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 5:58 pm
by whartung
There's just something about using a micro controller made with ~50,000 transistors to run as a clock and reset circuit for a 3500 transistor CPU.
Re: ATtiny13 for clock and resets?
Posted: Fri Aug 24, 2018 6:24 pm
by cbmeeks
Incidentally, I recommend you use a can oscillator, not a crystal, to generate your clocks.
Yeah, that's actually what I meant. Just came out as crystal.
There's just something about using a micro controller made with ~50,000 transistors to run as a clock and reset circuit for a 3500 transistor CPU.
Then there's that. lol.
That thought hasn't escaped me. However, I guess the same could be said about using any PLD's as well. Especially the larger ones.
Re: ATtiny13 for clock and resets?
Posted: Sat Aug 25, 2018 12:00 am
by LIV2
That's not a bad idea, I wish I'd thought of it
My computer has an attiny861a working as the keyboard controller, with one spare pin. I could've just used it as my reset controller instead of the 1813
Re: ATtiny13 for clock and resets?
Posted: Sat Aug 25, 2018 9:05 pm
by whartung
Then there's that. lol.
That thought hasn't escaped me. However, I guess the same could be said about using any PLD's as well. Especially the larger ones.
Yea, it's just funny.
Just the state of the world today.
I was reading on another forum about a guy who made something that plugged in to his cars CAN bus.
On the car, if you reach in the door handle, its supposed to unlock automatically. Sometimes it takes a few tries.
He made something that would detect the door handle activity, and if it didn't see the "unlock door" request "quickly", it would send the door request again.
Now, I'm sure its more sophisticated than monitor the CAN traffic for a "2" and then sending a "3" after a timer, but it's not much more than that.
But the thing is he's using a Raspberry Pi Zero and a CAN bus controller. Basically ~$10 in hardware.
And now you have a machine with a GHz processor and hundreds of MBs of RAM....listening for a "2" so it can send a "3".
Just like Marvin the robot in Hitchhikers Guide.
“Here I am, brain the size of a planet and they ask me to take you down to the bridge. Call that job satisfaction? ‘Cos I don’t.” –Marvin
Re: ATtiny13 for clock and resets?
Posted: Mon Aug 27, 2018 6:54 pm
by cbmeeks
My computer has an attiny861a working as the keyboard controller, with one spare pin. I could've just used it as my reset controller instead of the 1813
Yep, I have absolutely convinced myself to use some micro-controller for the reset logic. Then the question becomes...ATtiny for just resets or go all-out and put an Arduino compatible circuit onboard (minus the headers) so that I can get some easy SD/FAT libraries, easy EEPROM access, etc.
I was reading on another forum about a guy who made something that plugged in to his cars CAN bus.
On the car, if you reach in the door handle, its supposed to unlock automatically. Sometimes it takes a few tries.
He made something that would detect the door handle activity, and if it didn't see the "unlock door" request "quickly", it would send the door request again.
Now, I'm sure its more sophisticated than monitor the CAN traffic for a "2" and then sending a "3" after a timer, but it's not much more than that.
But the thing is he's using a Raspberry Pi Zero and a CAN bus controller. Basically ~$10 in hardware.
And now you have a machine with a GHz processor and hundreds of MBs of RAM....listening for a "2" so it can send a "3".
I feel the same way. But like you said, that's where the "action" is these days. I've been blasted in other forums because I said I was tired of hearing about RPi projects. Now don't get me wrong, RPi is a great ecosystem, great device, etc. I'm just tired of hearing it over and over. lol.
Re: ATtiny13 for clock and resets?
Posted: Wed Aug 29, 2018 7:05 pm
by Dr Jefyll
I was reading on another forum about a guy who made something that plugged in to his cars CAN bus.
Bill, can you tell me please, what forum was that?
I PM'd you Monday with this question but for some reason the PM hasn't yet been read.
TIA,
Jeff
Re: ATtiny13 for clock and resets?
Posted: Thu Aug 30, 2018 11:21 am
by unclouded
Now, I'm not sure if it can really push a 1 MHz square wave externally. Of course, this limits has fast your machine can run but I'm building a 1 MHz machine anyway.
It
should be possible. I used C not assembler and used a software loop to manage PHI2 for simulating bus devices and got around 250 kHz from memory.
As others have said, many AVR devices other than the ATtiny13 can get a precise clock with only a crystal and a couple of capacitors such as in this board:
https://github.com/neilstockbridge/6502 ... /master/R1
The ATtiny85 is another part also in DIP8 but with more program memory and peripherals and can use an external crystal (at the expense of losing two pins).
There's just something about using a micro controller made with ~50,000 transistors to run as a clock and reset circuit for a 3500 transistor CPU.
I started with AVRs in my 6502 system but then replaced them with FPGAs and finally period-correct logic in pursuit of purity. I think they're all different adventures though.