sburrow wrote:
drogon wrote:
PC -> USB -> Arduino -> SBC
Maybe I'm missing something but if this is the case, then the Arduino is just acting as a USB serial adapter. (Using hardware serial on the input pins and softSerial on the output pin?) So why not just use a USB serial adapter directly from the PC to the SO pin? without the Arduino?
The challenge isn't the USB serial side it's getting serial in/out of the SBC - Then a UART chip or something else - 2 pins on the 6522 to implement software serial or Talk SPI to the Arduino (3 wires from the 6522 to the Arduino + Gnd) and have the Arduino act as the UART - that needs software on the Arduino side. I think I'd use a W65C51 and implement a software timing loop though. (Then just connect the TTL output of that to the USB Serial adapter).
Polling the /SO pin (or any other soft of software serial on the 65xx side) is going to be problematic with interrupts going off...
-Gordon
Wow, lots of good stuff here Gordon, thank you!
1) Yes, that's the setup. The Arduino is only a USB serial adapter. Correct.
2) I could use a dedicated USB serial adapter, but I don't have one right now and I was just wanting to test this out. The Arduino is easy to manipulate with C++ code too.
3) EXCELLENT idea to have it act as the UART instead. Hm! So, the Arduino reads the serial data, and outputs parallel data. Genius!
4) I forgot about interrupts!!! Yes, indeed. What I could do is turn off /IRQ and then make /NMI count down on the delay timer some preset amount. It will not be pretty by any means. Hm, maybe the serial-to-parallel is the best idea for that then.
I'm not sold on the Arduino, I just got one and wanted to test some things out with it. I actually got it for my Serial VGA Module, which I'll be testing later this weekend, but I figured it was neat to have my PC talk to my SBC in the meantime.
Thank you for the suggestions!
Depending on the Arduino - it has a USB serial adapter built in.
If it's NOT a Leonardo (or anything with a 32U4), but a classic Uno then you're good to go. You need to upload a sketch that disables the Tx and Rx ports on the ATmega (don't load/use any serial and set pins 0 and 1 to input with the pull-ups off). Then you can use pins 0 (Rx) and 1 (Tx) on the Arduino headers as a TTL serial output to the SBC.
This works because the USB goes into a USB to serial adapter on the board (sometimes it's a genuine FTTD chip, sometimes a 32U2, but it's the same effect) and as long as you don't use those pins on the ATmega then you can use them for external use without running anything on the ATmega other than the dummy sketch... If the ATmega is in a socket (rare on new boards these days as they all use the SMT part) then you can just pop it out of the socket.
I use an ATmega as the serial adapter on my Ruby board, however it's interfaced in a somewhat interesting way, (mutually exclusive shared RAM), BUT you could use it directly to the SBC however it's not going to be fast enough to emulate a proper bus peripheral (unless your CPU clock is < 1Mhz), but you can use it as an 8-bit parallel device off a port on the VIA. You need to use a few more bits as handshake but it's very possible. Write a byte to the VIA, which sends the strobe signal out CAx the ATmega picks up the strobe, reads the data, sets the reply Ack which is read on CAx (I forget which way round they go) that's great for serial data out of the SBC - to get data IN, you need a bit that the SBC can read from the ATmega to say "I have data", then you turn the port direction round and read the byte and so on. I've been experimenting with something like this for another application and it can be very fast. It's a bit like a very very cut-down SCSI...
I run the serial port on my ATmega at 115200 baud - more than fast enough for my graphics terminal use. I can also send data to the ATmega faster than it can clock it out so there is a nice bit of overlap possible too with careful buffering and interrupt driven sending on the ATmega side.
For development, I actually use a little adapter from Pololu which has both a serial port and an SPI programming port so I can program the ATmega with just one cable going back to my (Linux) desktop. No need to do it this way if you want to keep the serial bootloader in the ATmega though.
There is the whole dilemma of using a relatively modern MCU to host a retro project though, but I'll leave that for you to decide if it's appropriate for your system
Cheers,
-Gordon
Ps. Picture of my system with the USB serial adapter at the very bottom. The grey ribbon cable is the ATmega programming SPI cable, the coloured one is the serial port. (The other coloured ribbon is going to an LCD display connected to the VIA at the top-right of the photo) The bottom most 40-pin IC is the ATmega 1284p.
Attachment:
IMG_20230420_170832_DRO.jpg [ 167.03 KiB | Viewed 2715 times ]
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/