It is currently Sun Dec 17, 2017 3:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Tue Aug 15, 2017 12:20 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
rainwarrior wrote:
Ah, so Krzysiobal's cartridge triggers an IRQ each time a byte is finished buffering.
A little less clever, I think? The keyboard's data line itself can pull /IRQ low ... and extra hardware appears to keep it low until the keyboard has clocked something in 9 times (i.e. ignoring the parity bit). So /IRQ appears to be asserted for the entire transmission. At 11 bits and 30-50µs per bit, each keyboard transmission will take 330-550µs, or roughly 600-1000 CPU cycles. The hardware assist does deserialize the bits—reads from (mask $F001) $5001 and $5000 return the most recent 4 bits clocked in or the 4 bits before that, respectively.

Quote:
More minimally, the buffer could be done in software? If we just trigger an IRQ on each falling edge of the clock and let the CPU read the data line directly.
Yeah? Might be able to just connect Kbd Clock to /IRQ ... I don't think the lack of acknowledgement will be a major flaw?

NMI, other IRQs, and OAMDMA will interfere with keyboard receipt, but that's basically guaranteed of any solution that doesn't buffer the entire stream.

Quote:
Requires the expansion port or cartridge access for the IRQ, but maybe not as bad as polling the clock, and relatively few parts?
Really depends on whether you consider that an acceptable cost, of course.

I'll note that in the NES expansion port, 11 of the 15 signals of the Famicom expansion port (including /IRQ; notably NOT including OUT0,1,or 2) are on the same side as the Audio In pin. Seems like it would be practical to extend INL's audio mixing board.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 12:36 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 264
Location: Poland
Quote:
So /IRQ appears to be asserted for the entire transmission

Not true, it is only low after all other bytes have been clocked and latched in buffer.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 12:54 pm 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1941
Location: WhereverIparkIt, USA
lidnariq wrote:
I'll note that in the NES expansion port, 11 of the 15 signals of the Famicom expansion port (including /IRQ; notably NOT including OUT0,1,or 2) are on the same side as the Audio In pin. Seems like it would be practical to extend INL's audio mixing board.


Part of the issue is that it's also challenging to use my method to mate with two pins which are directly next to each other. It may be possible to make it work by staggering even and odd pins at different heights so neighboring pins don't short out with each other where the contact solders to the board. It wouldn't be too hard to expand my method to having a board on each side of the EXP port connector if one were already going try and mate with all 11 or more pins. I just saw that as beyond the scope when designing the board.

My method could probably work with all 48 pins, I'm just not sure it's the best solution when mating with more than a few pins. It's still not compatible with toploaders or clones. As more an more high end clones become popular in the market the EXP port starts to become less appealing.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 1:04 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
So ... КД522 would pull /IRQ low whenever KBD DATA is low ... but that actually gets in a fight with the КР1533ТМ2 which isn't open-collector...

A read from $5002 reset all 8 bits of the shift register to 0 and the 74'74's output to high... I've got to be confusing myself. The inverter should mean that /IRQ is only driven low by the 74'74 9 clocks after the first time KbdClock falls while KbdData is high ... i.e. not including the start bit?

infiniteneslives wrote:
Part of the issue is that it's also challenging to use my method to mate with two pins which are directly next to each other. It may be possible to make it work by staggering even and odd pins at different heights so neighboring pins don't short out with each other where the contact solders to the board. It wouldn't be too hard to expand my method to having a board on each side of the EXP port connector if one were already going try and mate with all 11 or more pins.
I was more thinking of just grabbing +5V, ground, and two random signals on that same side. I don't think there's any point in bothering getting 11 of the 15 famicom expansion port pins and not making the full connector.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 1:31 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 264
Location: Poland
Quote:
So ... КД522 would pull /IRQ low whenever KBD DATA is low

This diode is not soldered (what the russian text below says)

Quote:
A read from $5002 reset all 8 bits of the shift register to 0 and the 74'74's output to high... I've got to be confusing myself. The inverter should mean that /IRQ is only driven low by the 74'74 9 clocks after the first time KbdClock falls while KbdData is high ... i.e. not including the start bit?

This cartridge is compatible only with XT keyboards, which consist of 9 bit transfers (start+8 bits, without parity and stop bit), data valid on falling edge of clock.
On XT keyboards start is high and this is what is clocked into 74'74 input after 9 clocks.

More info at 5.4 from:
http://ilkerf.tripod.com/c64tower/F_Keyboard_FAQ.html

I did myself AT->XT converter (based on attiny 13) which makes it compatible with almost any PS/2 or DIN5 AT keyboard.

Now according to yours thread - Atmega8 + VUSB should be enough to communicate with USB mouse/keyboard as USB host and translate it to more NES friendly protocol.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 1:42 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
krzysiobal wrote:
This cartridge is compatible only with XT keyboards, which consist of 9 bit transfers (start+8 bits, without parity and stop bit), data valid on falling edge of clock.
On XT keyboards start is high and this is what is clocked into 74'74 input after 9 clocks.
Ah-hah. And most pertinently, the idle voltage is low and the start bit is high. So 9 clocks later, the high start bit has been inverted and latched and is now pulling /IRQ low. Got it.

Quote:
Now according to yours thread - Atmega8 + VUSB should be enough to communicate with USB mouse/keyboard as USB host and translate it to more NES friendly protocol.
V-USB is a device-only firmware, not able to be a host.

Honestly, it feels like it "should" be possible to bit-bang a minimal host implementation that can only talk to a keyboard, but... or even to use a micro with actual USB PHY hardware to do the same ... but there's no evidence that anyone has done so.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 1:48 pm 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1941
Location: WhereverIparkIt, USA
lidnariq wrote:
Honestly, it feels like it "should" be possible to bit-bang a minimal host implementation that can only talk to a keyboard, but... or even to use a micro with actual USB PHY hardware to do the same ... but there's no evidence that anyone has done so.


I think bit-banging is your only option unless the mcu USB phy specifically supports hosting/OTG. Many mcus with USB phy only support device operations I would assume. In my experience with a STM32 mcu which has USB, but lacks OTG, the abstraction that the hardware provides doesn't give you enough control to act as a host.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 2:00 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 264
Location: Poland
Why just not spend 0.33$ instead of reinventing wheel?
https://pl.aliexpress.com/item/MOSUNX-F ... 18151.html

Implementing simple USB Host for HID devices on AVR sounds like cool topic for project for holidays =)


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 2:02 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
But what would you use a keyboard for, other than a BASIC interpreter? I ask because the PS/2 to controller port adapter implementation by tpw_rules got hung up on making a demonstration app that was a player for Z-machine (Infocom interactive fiction) story files.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 2:06 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 264
Location: Poland
There are lot of russian cartridges for famiclones with built-in keyboard (even with possibility to connect LPT printer) that uses keyboard for:
* word processor,
* game menu navigation,

There are also some funny Windows remakes (mouse cursor is controller via joypad), but it contains MS-DOS with possiblity for keyb typing :D


Attachments:
Windows 2000 (Ch)[!].png
Windows 2000 (Ch)[!].png [ 35.62 KiB | Viewed 452 times ]
Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 2:07 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
krzysiobal wrote:
Why just not spend 0.33$ instead of reinventing wheel? [MOSUNX Futural USB Female to PS/2 Male Adapter]
That's one of those passive converters that relies on the microcontroller inside the keyboard/mouse still being able to speak PS/2.

I mean, I do still think it's a surprisingly large number of the available USB keyboards and mice ... but a passive converter won't help if the user tries to use a USB keyboard that can't.

From a semantic point of view, it does help set expectations.


Top
 Profile  
 
PostPosted: Tue Aug 15, 2017 2:24 pm 
Offline

Joined: Sun Jun 12, 2011 12:06 pm
Posts: 264
Location: Poland
Lol, true, I measured two adapters I have (one for PS2 keyboard, one for PS2 mice) and there is direct connection between:
PS/2 data -> USB D-
PS/2 clock -> USB D+

I have same adapter for PS/2->DB9 and I remember that it worked ONLY with the mouse it was shipped with so not dual PS/2 / DB9 mouse exists. What about PS2 / USB i dont know because all USB keyboards I've tested worked without problems.


BTW. Whats the cheapest way to make USB hub? :D
Image

For STM4 there exist USB Host library (STM 4 Discovery board contains USB host socket)
https://stm32f4-discovery.net/2014/08/l ... x-devices/

I think this chip is all you need:
https://www.maximintegrated.com/en/prod ... 3421E.html
SPI can be bit-bangled using expansion port OUT0-OUT3 pins.

But somebody DID software USB Host in Atmega32:
http://people.ece.cornell.edu/land/cour ... odelisting


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group