I sent off the mini pcb with a spare pin grounded and I toyed with the spacing of the DB9 connector a little more, trying to get enough space to see the keyboard vs. mouse labeling for the PS2 connectors.
I also was able to make the USB detection more reliable for the USB/ADB adapter. I rewrote the timing code to use the timer I was already using for the ADB and pre-ADB protocols.
USB mouse or keyboard to ADB is working right now. I'm still working on bringing the pre-ADB code over, and haven't soldered those connectors on quite yet.
I've got USB mouse to pre-ADB mouse working now, in addition to ADB mouse and ADB keyboard. I just need to port over the pre-ADB keyboard.
I've found a couple things to improve with another PCB spin on this too. Since you can only do one of keyboard or mouse with this board, a passthrough ADB port seems reasonably important.
I also realized that if I added a second GPIO for the ADB line, I could read and write the bus simultaneously, in order to implement collision detection.
pre-ADB keyboard working now too, so all the major pieces are in place. I haven't implemented the ADB power button yet, but that is pretty straightforward.
I think I'm going to go ahead with the last (usbadb1.zip) version of the PCB tomorrow, since things seem to be working.
Yeah, I've been thinking about asking olePigeon about a 3D case, since it seems like he has access to a printer.
The two major downsides to the USB at the moment are: 1) no hubs, so two adapters are necessary, 2) fallout from #1 is many (most?) keyboards are really hubs that have the keyboard hanging off of the internal hub. So for keyboards, you need to get a keyboard without any extra USB ports on it.
Hub support would be nice, but there's a lot I need to learn to understand if it's even possible on the discovery board's hardware. Plus, the existing ST sample code is not at all structured for multiple devices. Internally it assumes there is "a", singular, device in all its datastructures. So, basically all the USB code would need to be rewritten. There's several (RT)OS' out there that support the chip, so maybe at some point it might be interesting to try getting one of those running.
Current status on the USB: I'm having some difficulty getting reliable device enumeration. It'll see a device attached, and then fail to retrieve the descriptors. It seems to be timing dependent, since I can tweak the timing and get 100% reliable enumeration of my mouse, and then the keyboard will only successfully enumerate about 1/5th of the time. I'm still poking at it though.
I rearranged some of the pins, since I was using some of the pins that are also used for the discovery board's LEDs, and I actually wanted to use some of the LEDs to indicate status. I'm now using an LED to indicate successful device enumeration, so you can see the status there without needing a serial connection, or if your device doesn't have any way of indicating it's working.
I ordered the PCBs yesterday, but within a couple hours I realized I left the RJ11 wired for straight through instead of telephone cables. Sigh.
Would looking at something like LUFA or AVR USB be any help for understanding how to support multiple devices? They're designed for a different microcontroller and so not directly usable, but they seem to be well-supported and well-documented. Maybe a peek at the source code would help explain how things are supposed to work with a USB hub.
Well, it'd probably help understanding, but pretty much none of the existing code will work because of the assumptions of a single device. So maybe something like Coocox that already supports the mcu and usb and everything, then just port the adb & pre-adb to that.
I got the taller female headers to get the ps2 adapter board higher up off the jumpers of the discovery board. It works with the minipcb I've already got, and I just soldered a single wire to ground to match the detection pin I added to the new revision that isn't here yet.
So the only real difference is the newer board will be slightly larger and hopefully the DB9 won't be as crowded.
I modified the code to check for that pin, and I've tested it with both this minipcb and the older fullsized one, and it works. It's committed to the svn repository here on mac68k.info.
Here's some pictures of it all together:
Anyone that wants one of this batch, let me know and I can send it off.
Well, I just went to radio shack and picked up a regular handset cord from them, and it was 4 conductor. The keyboard works, although I found that I grounded one of the mouse pins for some reason. I just had to cut that trace and the mouse worked. oops.