I would like to be able to use some off-the-shelf SPI to RS45 transceivers to make extra long cables.
The transceivers require you to set one transceiver in master mode and one in slave, and I don't see any sort of slave select on the connector.
How do games usually arbitrate which is master and which is slave?
I have a stupid question about the dmg-01 serial port interface
-
- Posts: 40
- Joined: Wed Jan 19, 2022 9:52 am
Re: I have a stupid question about the dmg-01 serial port interface
Timing. Whoever happens to contact at the right time. The protocol can be seen in the official GB doc.
-
- Posts: 40
- Joined: Wed Jan 19, 2022 9:52 am
Re: I have a stupid question about the dmg-01 serial port interface
I see. It looks like I might need to design a small bus sniffer that checks for writes to the serial control register in order to arbitrate direction of the clock.
Re: I have a stupid question about the dmg-01 serial port interface
ISSOtm wrote in gbdev Discord server: "I think the handshake is attempt to exchange as master, if it matched an expected value you are the master; otherwise, write that expected value into SB, and attempt to exchange as a slave (with timeout)"
A bus sniffer may help even if it doesn't provide quite as much useful information as it does on the NES for a couple reasons. One is that writes to registers and HRAM do not show up on the external bus. You could trace it by watching opcode fetches, but then a lot of I/O writes are done through [HL] and [$FF00+C], meaning your bus sniffer would also have to track the address values loaded into those registers.
A bus sniffer may help even if it doesn't provide quite as much useful information as it does on the NES for a couple reasons. One is that writes to registers and HRAM do not show up on the external bus. You could trace it by watching opcode fetches, but then a lot of I/O writes are done through [HL] and [$FF00+C], meaning your bus sniffer would also have to track the address values loaded into those registers.
-
- Posts: 40
- Joined: Wed Jan 19, 2022 9:52 am
Re: I have a stupid question about the dmg-01 serial port interface
Most differential transceivers with auto direction just use a 555 as a timeout when switching the direction.
I could try to use a micro to read the line states and implement something similar. Since the gameboy's SPI clock is only about 8 khz, even a slow micro running at a few mhz would be fast enough to arbitrate.
I could try to use a micro to read the line states and implement something similar. Since the gameboy's SPI clock is only about 8 khz, even a slow micro running at a few mhz would be fast enough to arbitrate.
- Jarhmander
- Formerly ~J-@D!~
- Posts: 569
- Joined: Sun Mar 12, 2006 12:36 am
- Location: Rive nord de Montréal
Re: I have a stupid question about the dmg-01 serial port interface
Fun anecdote: I once designed an embedded system with a SoC using RS485 to communicate with other sensors via Modbus, and ended up using a small PIC12F to switch the communication direction because it was cheaper (!) and I could change the timeout by reflashing the microcontroller with the SoC if I needed to.
((λ (x) (x x)) (λ (x) (x x)))