Offline
CA

Let's also get back to Flashing LEDs solution - there he used 2-SPI bus uC. We could try that. Although I'm not sure we'll be able to send data to PC at the necessary speed...

rvan, you've mentioned that when you put a byte to the array it takes a lot of time. Have you tried sending data directly to PC? This might work but also might introduce some delays (e.g. buffered USB data sent later)

You can call me crazy but uXe's old idea with Play Station eye doesn't seem that bad now. This thing (well, PS3 version for sure) can record data with 60fps. And they are ridiculously cheap these days I've just ordered 2 for $20. They are heavily used by computer vision guys - this is exactly what we need. There are drivers for multiple platforms. So it's an interesting thing to mess with. But I'd call it a spin off of this project.

Offline
Melbourne, Australia

...or try PWM for the clock? Also, don't forget that even though the Teensy 3.1 is 5V tolerant, it only outputs 3.3V - which the GameBoy CPU may or may not like?

Last edited by uXe (May 7, 2014 3:25 am)

Offline
friendofmegaman wrote:

Sure, sorry guys I'm just loaded with work lately so things keep slipping off my mind. Here's the code (I know Jazz won't approve):

(Teensy only, won't work on Arduino)
Timer based

uXe has more or less said this, but I realized while I was out today that the reason your code doesn't work is probably because calling the timer ISR takes too long -- it will suffer from the same problems as external interrupts.

friendofmegaman wrote:

2. I PM'ed Nitro about clock master and here's how he'd go about it:

Nitro2k01 wrote:

You need a loop, where you do something like the following. This assumes digital pin 0 is connected to the clock input of the Gameboy.

PORTD |= 1; // Turn on clock signal
(Wait a little and/or do something.)
PORTD ^= ~1; // Turn off clock signal
(Wait a little and/or do something.)

PORTD ^= 1; // Flip clock signal (xor)
(Wait a little and/or do something.)
PORTD ^= 1; // Flip clock signal (xor)
(Wait a little and/or do something.)

This is right, but this code will (probably) only work on an actual Arduino.  PORTx is emulated on the Teensy, and so slow.  GIPOx_PTOR is what would be used on a Teensy, as uXe describes.

friendofmegaman wrote:

However he also mentions that he's not sure if after all it can help us to get the video and we gonna need to use assembly.

Yes, we're certainly going to need assembly for this approach.

friendofmegaman wrote:

The only one cheap enough viable option is using SGB. What I don't like about this approach (and rvan has already mentioned this) is that we end up with the de-digitized signal that we'll have to re-digitize.

If you're thinking about the SGB, do also consider the AGB + TV Adapter.  And I'm fairly confident that some post-processing on the PC side can give us an image very close to the original.

friendofmegaman wrote:

Apart from that it's either FPGA or some cam-corder type. Thoughts?

Using an FPGA sounds like the approach that is most likely to succeed, but I personally know nothing about FPGAs.  The learning curve seems more daunting that ARM assembler.

Other thoughts: Is there another means of getting the raw data (the five lines straight out of the Game Boy) into the PC?

uXe wrote:

Maybe direct control over the clock would be easier to achieve by having the microcontroller generate a variable signal that can be fed into the standard variable clock mod chip (what the potentiometer normally does - not sure if it is wired as a voltage divider or a variable resistor though?) as well as start / stop control over the clock mod - at least then there would be predictability?

I don't think that this would give us enough predictability.  What we need to know is more or less at exactly which clock cycle on the microcontroller the Game Boy pixel lines are ready to be read.  The microcontroller needs to clock the Game Boy relative to itself, rather than simply to a specific speed, as any clock drift would cause the data to potentially not be ready at the right time.

uXe wrote:

...or try PWM for the clock?

The Arduino's PWM frequencies are in the 1-10 kHz range, so I don't think this is much use to us.  I understand that the Teensy can reach at least 2 MHz, but that's pushing it.  I have no idea how much CPU it uses.

uXe wrote:

Also, don't forget that even though the Teensy 3.1 is 5V tolerant, it only outputs 3.3V - which the GameBoy CPU may or may not like?

A logic lever converter should work fine here, right?  Is there any issue with switching them at high frequencies?

friendofmegaman wrote:

Let's also get back to Flashing LEDs solution - there he used 2-SPI bus uC. We could try that. Although I'm not sure we'll be able to send data to PC at the necessary speed...

Getting the data into the microcontroller would still be a significant step forward.  What are good options on cheap microcontrollers with two SPI buses?

friendofmegaman wrote:

rvan, you've mentioned that when you put a byte to the array it takes a lot of time. Have you tried sending data directly to PC? This might work but also might introduce some delays (e.g. buffered USB data sent later)

I haven't tried this, but I don't imagine Serial.write((uint8_t)GPIOC_PDIR)
being faster than line[i]; = GPIOC_PDIR.  I'll see what happens, though.  I also
thought about unrolling the for loop and hardcoding the array item addresses,
but I think I would probably need assembly to make this worthwhile.  (This
paragraph exists in a code box thanks to a BBCode bug.)
friendofmegaman wrote:

You can call me crazy but uXe's old idea with Play Station eye doesn't seem that bad now. This thing (well, PS3 version for sure) can record data with 60fps. And they are ridiculously cheap these days I've just ordered 2 for $20. They are heavily used by computer vision guys - this is exactly what we need. There are drivers for multiple platforms. So it's an interesting thing to mess with. But I'd call it a spin off of this project.

I'm interested in seeing how this works out.  Good luck!

Offline
Melbourne, Australia
rvan wrote:
friendofmegaman wrote:

Let's also get back to Flashing LEDs solution - there he used 2-SPI bus uC. We could try that. Although I'm not sure we'll be able to send data to PC at the necessary speed...

Getting the data into the microcontroller would still be a significant step forward.  What are good options on cheap microcontrollers with two SPI buses?

Here's one:

http://www.digilentinc.com/Products/Det … IPKIT-CMOD

"SPI: Synchronous serial port. Pin 24 (SS), Pin 35 (MISO), Pin 25 (MOSI), Pin 16 (SCK). This uses SPI1 on the PIC32 Microcontroller. SPI2 is implemented as Pin 33 (SS), Pin 36 (MOSI), Pin 32 (MISO), and Pin 17 (SCK). When using the chipKIT Cmod with MPIDE, the SPI ports are accessed using either the standard chipKIT SPI library or using the Digilent DSPI library. The standard SPI library supports access to a single SPI port, SPI1. This is accessed using the SPI object.

The DSPI library supports access to both SPI ports. The DSPI0 object class is used to access the default SPI port, SPI1. The DSPI1 object class is used to access SPI2."

or you could just adapt Craig's source with the same board he used:

http://www.mattairtech.com/index.php/mt … board.html

(Edit: or a cheaper alternative? http://www.mikroe.com/mikroxmega/)

BeagleBone Black is supposed to have two SPI ports but a lot of people have reported trouble getting that working...

Last edited by uXe (May 8, 2014 2:08 am)

Offline
CA

Powerful uC's are kinda pricey pretty much as FPGA, I'd better buy the latter to be honest...

I've been thinking for some time about how do we simply get five signals directly to PC as rvan suggested. Because what we're trying to do now is to use a uC as middleware, which turns into a bottleneck.
I'm thinking of some sort of a shift register based circuit that would connect to the USB or something like that... Basically we need some solution that is clocked by LCD CLOCK signal... FPGA can be used for that but I wonder is there an easier way and maybe FPGA is an overkill for that...

Offline
Melbourne, Australia
friendofmegaman wrote:

Basically we need some solution that is clocked by LCD CLOCK signal...

the point of the SPI approach is that it is clocked by the LCD clock...

if you want some more ideas for getting those signals into the PC then spend some time here:

http://dangerousprototypes.com/docs/Main_Page

Offline

Thanks for the information, uXe.

Here is a brief rundown of the options I am considering at the moment.

Microcontroller with Two SPI Buses
This should get the data into the microcontroller, but then we need to think about how to get it out, i.e., to a computer or recording medium.  We could possibly try this method out with the one SPI bus on the Teensy, capturing half the pixel data.

FPGA
This is probably the best choice of hardware, but represents a substantial learning investment for me, so it may not be the best choice given limited time.

Logic Analyzer
This would seem to solve the problem of getting the raw data from the DMG to the computer (assuming that logic analyzers can capture data at a sufficient sample rate in non-bust mode).  It however doesn't achieve my long-term goal of computerless video capture from the DMG.

Other than the cost and time involved, the decision for me will be partly determined by how useful the hardware and knowledge I gain for a certain approach will be for other projects as well.  My time is somewhat limited at the moment, and I will probably do a fair bit of thinking / research before I chose which approach to take.

Offline
CA

Quick update on PS3 Eye capture. The cam itself is awesome! Captures video insanely fast with real good quality. But here's how it captures biverted DMG:

So, another dead end.

Offline
friendofmegaman wrote:

Quick update on PS3 Eye capture. The cam itself is awesome! Captures video insanely fast with real good quality. But here's how it captures biverted DMG:

You'll need a macro lens.  You could try the kind of adapter designed for smartphone cameras, like this one.

Offline

Wasn't the whole point to get a precie image straight from the hardware? If you're recording with a camera you should remove the screen cover and put the camera further away if it can't focus that close

Offline

What about taking the output from the ribbon cable and, if you can't process it fast enough, store the raw data and covert it later?

Offline
CA
rvan wrote:
friendofmegaman wrote:

Quick update on PS3 Eye capture. The cam itself is awesome! Captures video insanely fast with real good quality. But here's how it captures biverted DMG:

You'll need a macro lens.  You could try the kind of adapter designed for smartphone cameras, like this one.

Oh, interesting, definitely gonna try that!

Offline
CA
Dadibom wrote:

Wasn't the whole point to get a precie image straight from the hardware? If you're recording with a camera you should remove the screen cover and put the camera further away if it can't focus that close

If you read the thread attentively then you've probably noticed that I called the cam idea a spin off project.

And secondly the point is to make a small recording device. If I could cram a webcam and GB lcd in a tiny box then the goal was somewhat achieved. But then again - it's just a curious idea, I'm more interested in getting raw data to PC and building an image there.

Last edited by friendofmegaman (May 11, 2014 10:48 am)

Offline
CA

Duplicate post

Last edited by friendofmegaman (May 11, 2014 10:48 am)

Offline

Reading the Freescale Reference Manual, it turns out that the Teensy's chip does have two SPI ports.  We may yet be in luck...

Offline

http://www.flashingleds.net/gameboyLCD/gameboyLCD.html