Controller port to serial cable
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
Re: Controller port to serial cable
Is bit-bang really going to have low enough latency to do a decent transfer rate? It seems it'd really stress USB and use a lot of CPU on the host side. This is assuming by bit bang you basically mean that you treat the FTD as a glorified I/O port and do each bit on the host side.
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Ok, forget the FTDI chip. Even still, a Teensy++2.0 is basically just a breakout for an Atmega32U4 microcontroller, which is a $6 chip. On top of that, since all you're using it for is the USART, I'm pretty sure you could do the same with the Atmega16U2, which is $3-4.
And yes, you're right about the extension cable, I made the assumption based on the existence of the male pins.
And yes, you're right about the extension cable, I made the assumption based on the existence of the male pins.
Re: Controller port to serial cable
Or microchip sells the SPI+USB PIC16F1455 for $1.50. Most of the $80 seem to be due to wanting someone else to do all the soldering and using off-the-shelf modules. Not that there's anything wrong with that; it just makes it awkward to complain about cost.qwertymodo wrote:On top of that, since all you're using it for is the USART, I'm pretty sure you could do the same with the Atmega16U2, which is $3-4.
- infiniteneslives
- Posts: 2102
- Joined: Mon Apr 04, 2011 11:49 am
- Location: WhereverIparkIt, USA
- Contact:
Re: no$sns - new SNES emulator
The teensy is just an easy to program/develop $2-3 AVR mcu. All the schematics and everything are there. Not sure what their how it's licensed but you could easily reproduce the schematic into your adapter. Looking at thier site, it's obvious they have a hardspot for clones... But since how it's a development kit I'd imagine they have some plan/tolerance for when you're ready to produce/market your finished product as something besides a teensy alone.tepples wrote:So in other words, the Teensy is acting as an SPI slave. Isn't there anything cheaper that can act as an SPI slave and a USB device?
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
USART =/= SPI. I'm not sure if you can directly connect to SPI via a virtual COM port the way you can with a U(S)ART. Also, U(S)ART allows for true bi-directional communication, where SPI has to be driven by the master, though I'm not sure if that makes any difference in this configuration. I just looked at the Teensy code package, and I think you might even be able to get it to build for the Atmega8U2, since the main difference between it and the Atmega32U4 found in the Teensy as far as this application is concerned is Flash memory space, and 8kb should be enough...lidnariq wrote:Or microchip sells the SPI+USB PIC16F1455 for $1.50. Most of the $80 seem to be due to wanting someone else to do all the soldering and using off-the-shelf modules. Not that there's anything wrong with that; it just makes it awkward to complain about cost.qwertymodo wrote:On top of that, since all you're using it for is the USART, I'm pretty sure you could do the same with the Atmega16U2, which is $3-4.
Re: Controller port to serial cable
I'm not 100% clear on all the distinctions.
UART
USART
RS232
SPI
I2C
Bit-Bang
Lots of stuff. My basic requirements: the SNES side code is not using any kind of timed writes. I want to write one bit (for controllers) and one byte (for the expansion port.) I would like the controller fast enough to handle 40KB/s (320kbit/s) worth of data, and the expansion port to handle 2.68MB/s worth of data. Controller and expansion port chip do not have to be the same. I want it to be bidirectional. I want the PC side to be able to open /dev/ttyUSBx, and start using read/write to send and receive data. No third-party drivers, no proprietary USB driver code to be written by me, no extra kernel drivers to load. Plug and play.
Cost really isn't an issue. Sure, I pay way more to have breadboard compatible stuff, but then I am mostly prototyping now anyway. Nobody's buying these things, so it's stupid to do a run of 100 PCBs, then decide I want to add something, and have to order more.
If we got it all nice and finalized (honestly the controller port one mostly is), and there is demand from at least 10 people on buying one, then we can look into that. If you can MacGuyver your own out of two 74LS chips, bailing wire, and a pack of chewing gum, fantastic! Make your own
And preferably sell them to people so we can get more devices out there, heh.
UART
USART
RS232
SPI
I2C
Bit-Bang
Lots of stuff. My basic requirements: the SNES side code is not using any kind of timed writes. I want to write one bit (for controllers) and one byte (for the expansion port.) I would like the controller fast enough to handle 40KB/s (320kbit/s) worth of data, and the expansion port to handle 2.68MB/s worth of data. Controller and expansion port chip do not have to be the same. I want it to be bidirectional. I want the PC side to be able to open /dev/ttyUSBx, and start using read/write to send and receive data. No third-party drivers, no proprietary USB driver code to be written by me, no extra kernel drivers to load. Plug and play.
Cost really isn't an issue. Sure, I pay way more to have breadboard compatible stuff, but then I am mostly prototyping now anyway. Nobody's buying these things, so it's stupid to do a run of 100 PCBs, then decide I want to add something, and have to order more.
If we got it all nice and finalized (honestly the controller port one mostly is), and there is demand from at least 10 people on buying one, then we can look into that. If you can MacGuyver your own out of two 74LS chips, bailing wire, and a pack of chewing gum, fantastic! Make your own
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Well, for your purposes, it sounds like a low-cost USB microcontroller is the way to go. Then you can easily reconfigure it if you decide to go with the expansion port device. From your speed requirements, I would guess that 16MHz would be sufficient (I think?). If you're using a microcontroller that enumerates as a virtual COM port, I suppose it really doesn't matter what protocol you use out from there to communicate with the SNES (so ignore my previous comment about SPI not being able to do that...). If you do move to an expansion port device, you'll have to write the SNES<->uC communication code yourself, as I don't think there are any hardware-based 8-bit parallel interfaces in the AVR's, but it would be trivial to write the code to do it with GPIO's. Any of the AtmegaXuX's should be sufficient for this task, or you could go with a PIC if you prefer (though I'm not familiar enough with them myself to be able to suggest one).
Based on your initial design, I came up with this. I know I need some more passive components, and probably need to connect some of the other various AVR pins to VCC or ground. I haven't taken the time to look through the AVR datasheet, most likely I'll need some decoupling caps and some resistors on the USB lines. Also, I'm not sure if you need an external crystal in this configuration since you're using an external clock line. I decided to connect the output controller and ISL to the SNES 5V line so that they receive power regardless of whether or not the USB cable is plugged in.
http://i45.tinypic.com/35lav06.png
Based on your initial design, I came up with this. I know I need some more passive components, and probably need to connect some of the other various AVR pins to VCC or ground. I haven't taken the time to look through the AVR datasheet, most likely I'll need some decoupling caps and some resistors on the USB lines. Also, I'm not sure if you need an external crystal in this configuration since you're using an external clock line. I decided to connect the output controller and ISL to the SNES 5V line so that they receive power regardless of whether or not the USB cable is plugged in.
http://i45.tinypic.com/35lav06.png
Re: Controller port to serial cable
PICs have what's called a "Parallel Slave Port" for just this purpose; I'd be really surprised if Atmel didn't have something equivalent.qwertymodo wrote:I don't think there are any hardware-based 8-bit parallel interfaces in the AVR's, but it would be trivial to write the code to do it with GPIO's. Any of the AtmegaXuX's should be sufficient for this task, or you could go with a PIC if you prefer (though I'm not familiar enough with them myself to be able to suggest one).
Re: Controller port to serial cable
Somehow I'd failed to completely think this through the first time. That's actually fast enough to exceed USB "full speed" and require USB2 high speed instead. I'm not certain if there are any 8-bit microcontrollers that would be able to keep up with that, although something like the Atari 2600 Harmony cart definitely would. (Or an 8-bit micro could be used if it were ok to reduce the DMA chunk size to small enough and use handshaking such that each packet could be downloaded to the microcontroller's RAM before the SNES push/pulled data)byuu wrote:the expansion port to handle 2.68MB/s worth of data
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Just for kicks, I'm going to build myself a controller port based one around an Atmega16U2, seeing as I have a few of those laying around at the moment. I'm not sure exactly what I'm going to do with it, since I don't have a flashcart (I've been meaning to buy myself an SD2SNES, but I can't afford it right now) but I'm in a building mood... I'll let you know how it goes.
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Getting the code to compile for the Teensy was fairly trivial (there was only 1 incompatibility vs. the Teensy++), but targeting the 16U2 is going to require a bit of hunting through datasheets. In the meantime, I drew up a schematic (which I'll need to double and triple-check, especially for differences vs the 32U4, but I know it's at least close). Here's the tentative board layout, sans traces. I'm planning to use one of my spare controller ports off of one of the broken multitaps I have laying around, rather than using a cable for that end. You think YOURS looks awesome? 


Re: Controller port to serial cable
> Getting the code to compile for the Teensy was fairly trivial (there was only 1 incompatibility vs. the Teensy++)
The main reason I used the ++ was because the Teensy put one of the UART pins (D5) on the side, so it wouldn't be accessible from the breadboard mountable version.
> You think YOURS looks awesome?
Yes =)
Yours looks fun, too, of course.
I'm curious how interested you'd be in adapting this for the SNES expansion port. I'm still chasing after companies and oddball parts to get a connector fabbed for that port. My current target is 1mm connectors and using 2:1 pinouts (SNES exp pins are between 0.078" and 2mm)
The main reason I used the ++ was because the Teensy put one of the UART pins (D5) on the side, so it wouldn't be accessible from the breadboard mountable version.
> You think YOURS looks awesome?
Yes =)
Yours looks fun, too, of course.
I'm curious how interested you'd be in adapting this for the SNES expansion port. I'm still chasing after companies and oddball parts to get a connector fabbed for that port. My current target is 1mm connectors and using 2:1 pinouts (SNES exp pins are between 0.078" and 2mm)
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Well, as lidnariq mentioned, this design is limited to USB full-speed 12Mbit speeds. Otherwise, it shouldn't be too incredibly difficult to make this work with the expansion port, you just won't hit your speed goal (though it should still be considerably faster than the controller port model). I still haven't found anything in the datasheets to indicate that the Atmega16U2 has a dedicated 8-bit parallel interface, but it shouldn't be too hard to whip up a bit-bang protocol. The Atmega16U2 has plenty of GPIO's, so that's not a problem. We'll see how this goes, I'm still asking around on AVRFreaks to figure out the code changes for porting to the smaller uC. Right now, I'm in the middle of a couple of projects, one of which is building non-volatile N64 controller paks (if anybody's interested in one, I'm selling them; shoot me a PM), plus I have school and work, so my focus is a bit split right now.
-
qwertymodo
- Posts: 775
- Joined: Mon Jul 02, 2012 7:46 am
Re: Controller port to serial cable
Here's something that might be made to work for the expansion port connector. You'd have to buy a 40-pin version and take a hacksaw to it, maybe a dremel as well if the plastic housing was too wide... http://www.samtec.com/ProductInformatio ... es=MEC2-DV
Edit: You can even order free samples. I'll order one and see if it works.
Edit: You can even order free samples. I'll order one and see if it works.
Re: Controller port to serial cable
If I'm reading the sheet right, the MEC2-30-01-(L-)DV should do the job. The -20 has the polarized piece such that we'd get 7+12 rows. The -30 gives us 10+19 rows. The -40 gives us 15+24 rows. The -50 gives us 20+29 rows.
I'm fine with cutting the connector down to size if it can be done more reliably, eg with a table saw or something.
I am less fine with it being a surface mount connector. Getting that wired up to a breadboard for prototyping will be an absolute nightmare.
I'd much prefer a through hole design, preferably one that's amenable to an IDC cable being put on the end :/
I don't know what the -K option is talking about. They also don't give you the critical measurements of the top of the connector's width and length. We need it to fit into the ~3.2cm x ~0.8cm slot on the SNES deck.
Still, amazing that you found a 2mm card edge connector. Props there.
I'm fine with cutting the connector down to size if it can be done more reliably, eg with a table saw or something.
I am less fine with it being a surface mount connector. Getting that wired up to a breadboard for prototyping will be an absolute nightmare.
I'd much prefer a through hole design, preferably one that's amenable to an IDC cable being put on the end :/
I don't know what the -K option is talking about. They also don't give you the critical measurements of the top of the connector's width and length. We need it to fit into the ~3.2cm x ~0.8cm slot on the SNES deck.
Still, amazing that you found a 2mm card edge connector. Props there.