ATtiny13 for clock and resets?
ATtiny13 for clock and resets?
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
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
Cat; the other white meat.
Re: ATtiny13 for clock and resets?
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.
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?
Ah, not a bad idea. Haven't seen those. They are a little cheaper.
Cat; the other white meat.
- BitWise
- In Memoriam
- Posts: 996
- Joined: 02 Mar 2004
- Location: Berkshire, UK
- Contact:
Re: ATtiny13 for clock and resets?
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.
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.
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
Re: ATtiny13 for clock and resets?
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.
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.
Cat; the other white meat.
Re: ATtiny13 for clock and resets?
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.
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.
- floobydust
- Posts: 1394
- Joined: 05 Mar 2013
Re: ATtiny13 for clock and resets?
Martin A wrote:
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.
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.
Regards, KM
https://github.com/floobydust
https://github.com/floobydust
- BigDumbDinosaur
- Posts: 9426
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: ATtiny13 for clock and resets?
cbmeeks wrote:
For my UART, I think I need another clock of 3.6864 MHz.
Quote:
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.
Not sure how important that is, however.
Incidentally, I recommend you use a can oscillator, not a crystal, to generate your clocks.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: ATtiny13 for clock and resets?
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?
BigDumbDinosaur wrote:
Incidentally, I recommend you use a can oscillator, not a crystal, to generate your clocks.
whartung wrote:
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.
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.
Cat; the other white meat.
Re: ATtiny13 for clock and resets?
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
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?
cbmeeks wrote:
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.
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.
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.
Quote:
“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?
LIV2 wrote:
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
whartung wrote:
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".
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".
Cat; the other white meat.
Re: ATtiny13 for clock and resets?
whartung wrote:
I was reading on another forum about a guy who made something that plugged in to his cars CAN bus.
I PM'd you Monday with this question but for some reason the PM hasn't yet been read.
TIA,
Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: ATtiny13 for clock and resets?
cbmeeks wrote:
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.
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).
whartung wrote:
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.