Emulating bits and bobs with a microcontroller...

Talk about non-Acorn classic computers/hardware/software here (including retro consoles)
Post Reply
User avatar
danielj
Posts: 6491
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Emulating bits and bobs with a microcontroller...

Post by danielj » Tue Feb 27, 2018 10:09 pm

I've been toying with re-building the super serial card for the Apple II series, but am approaching the conclusion that given they are 10-a-penny in the states (although rare here), that it might make more sense to produce something a bit more interesting that can emulate the super serial, but also has a bit more welly.

I was considering using an ARM microcontroller (STM32F446R) as it's got built in UARTs, lots of memory and isn't very expensive... It would need to emulate a 6551 ACIA and possibly the 2k eprom too. It seems like it should be feasible to me, but having never done something of this ilk before, are there any gotchas I should be aware of? Is there any essential reading/sample code that would be worth looking at in the first instance? And is the mbed framework suitable or do I need to try and use libopencm3?

d.

User avatar
martinw
Posts: 1301
Joined: Sat Nov 13, 2010 10:31 am
Location: Aberdeenshire, Scotland
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by martinw » Wed Feb 28, 2018 11:25 am

danielj wrote:I've been toying with re-building the super serial card for the Apple II series, but am approaching the conclusion that given they are 10-a-penny in the states (although rare here), that it might make more sense to produce something a bit more interesting that can emulate the super serial, but also has a bit more welly.

I was considering using an ARM microcontroller (STM32F446R) as it's got built in UARTs, lots of memory and isn't very expensive... It would need to emulate a 6551 ACIA and possibly the 2k eprom too. It seems like it should be feasible to me, but having never done something of this ilk before, are there any gotchas I should be aware of? Is there any essential reading/sample code that would be worth looking at in the first instance? And is the mbed framework suitable or do I need to try and use libopencm3?

d.
2x UARTs running at up to 11.25 Mbit/s :shock: :D

Martin

mph1708
Posts: 11
Joined: Thu Jun 28, 2012 6:17 pm
Location: Manchester
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by mph1708 » Wed Feb 28, 2018 11:35 am

I cannot really help you with your Apple serial project.
But on the subject of Emulating bits and bobs with a microcontroller a random thought occurred :-
The Gotek uses a STM32F105 and is programable and available, so perhaps it is a platform that could be used for other applications.
I do realise that this is a bit off the wall given the Gotek / Flashfloppy combination has not reached its full potential.

User avatar
danielj
Posts: 6491
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by danielj » Wed Feb 28, 2018 11:43 am

I'm quite sure it can/could :D

This will ultimately be a new circuit with the relevant buffers, and I'd think we could get the cost down to well under £20 per unit. The added bonus of it being a microcontroller is that if people think of other things to do with it, they can just reprogram it :D

d.

Prime
Posts: 2537
Joined: Sun May 31, 2009 11:52 pm
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by Prime » Wed Feb 28, 2018 3:19 pm

Daniel,

A few thoughts due to actually having done projects with such a setup e.g. DragonMMC etc.

1) You are going to need some sort of interface circuitry with a protocol to talk between your main CPU e.g. 6502 and your microcontroller. This may just be a port on the microcontroller talking to a latch on the main CPU, or may be something more complicated. DragonMMC has a pair of latches built into a CPLD, with status / int lines so each side can tell when the outbound latch is empty and the inbound latch has data available. Think of it like a very much cut-down version of the tube.

2) ROM emulation is probably not going to be feasable, there is no way a microcontroller is going to be able to meet the setup time of even a 1MHz 6502, remember that you only have 500ns of access time (phi high), in that time you have to decode the incomming address, look up the byte of data and then output it soon enough that the 6502 will have time to latch it. The buffering in the Apple only makes this worse as it introduces a few ns propogation delay. What you may be able to do is have a small RAM that is programmed by the microcontroller and read by the main CPU. but IMHO, it's easier to just put a ROM on there.

3) Don't rely on software timing loops for communication between the CPU and microcontroller, as these have a tendency to break whe someone decides to run their machine at a non-stock speed. This for example required modification of the AtoMMC code when the Atom RAMROM board was produced that allowed the main CPU to run at 1.7Mhz, as this ended up with the 6502 not waiting long enough for the PIC. Use propper handshaking.

Not trying to put you off just give you the benefit of someone who has done this sort of stuff a couple of times now :)

Cheers.

Phill.

User avatar
danielj
Posts: 6491
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by danielj » Wed Feb 28, 2018 4:03 pm

So, to effectively be a 6551, there are 5x8 bit registers, each of which exists at a different address, so only one register will ever be accessed at a time. The whole thing is clocked off /DEVSEL from the Apple II bus. To emulate those without latches you'd have to read address, get the relevant register on the pins, or show the relevant register on the pins within the time /DEVSEL cycled its thingies...

Following your points, would it therefore make more sense to put the registers in a CPLD which acts as the go-between?

d.

User avatar
1024MAK
Posts: 7796
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Emulating bits and bobs with a microcontroller...

Post by 1024MAK » Wed Feb 28, 2018 5:02 pm

Yes. I believe that is what Phill was saying in his point 1 above.

Use a CPLD to act as the registers as seen from the main CPU's point of view. With the microcontroller updating the registers in the CPLD when the main CPU is not accessing memory.

Mark
For a "Complete BBC Games Archive" visit www.bbcmicro.co.uk NOW!
BeebWiki‬ - for answers to many questions...

Post Reply