VSYNC pulse

TL;DR

  • Signal description for the WonderSwan and WonderSwan Color
  • Pinouts for the display connectors on both versions
  • Different capture drivers written in C for the RP2350
  • Drivers only using DMA/PIO for capturing (no CPU)
  • Drivers can be ported to other platforms
  • Signal captures available for both platforms (Saleae Logic)

Introduction

The WonderSwan is kind of a special snowflake. This is also true for the way it brings its graphics to the display. I performed some signal analysis with the goal of writing a capture driver that is able to capture WonderSwan and WonderSwan Color image data. I used the Open xGB Display as a basis for my experiments, so the pin configuration used is compatible.

VSYNC pulse

WonderSwan Signals

The original WonderSwan (WS) uses a 224 × 144 pixel matrix LCD that supports 4-bit luminance (16 shades of gray). The display is connected via an 18-pin, 0.5 mm FFC connector. Fortunately, everything we need has the right voltage levels to allow us to directly interface with the signals.

Let’s begin with the signal analysis. First, let’s take a look at the VSYNC pulse. I decided to define the falling edge as the VSYNC event. After this pulse, there are 14 HSYNC pulses that don’t carry any relevant data. This is commonly known as the VBP, or Vertical Back Porch. By triggering an interrupt on the falling edge of VSYNC, we therefore have some time to perform operations at the beginning of a frame.

VSYNC pulse

After we have seen 14 HSYNC pulses, we get our first HSYNC pulse that marks the first row with actual data. For HSYNC, I use the falling edge of the signal as well. Analogous to the VBP, we have an HBP (Horizontal Back Porch) for the row data. In this case, we have to skip the first 6 pixels when capturing.

HSYNC pulse

So far, everything is as expected, but as one might have noticed in the captured signals, we don’t have a single pixel clock. Instead, there are two clock signals: CLK0 and CLK1. The waveforms of these clocks are shifted by 180 degrees. Both clocks are running constantly at about 770 kHz. Also, by looking at the pixel data (Y0–Y3), we can see that the signal can change at twice the frequency of the clock signals.

Clock signals detail

When looking at the data, we can see that the pulses on the pixel data lines are aligned at 50% with the edges of the clock lines. Therefore, I’d assume that the pixel data is valid on each edge of one of the clock lines. Latching data on both edges of a clock is commonly known as double data rate. In this case, we have two clocks with this property. I have the following assumptions as to why it is implemented that way:

  • Signal integrity (lower frequency)

  • Multiple line drivers for 4 offset columns (each one latches on a different edge of one of the clocks)

    • EMI
    • Special display properties

We can see the falling edge on CLK0 as the first pixel of a row, the falling edge of CLK1 as the 2nd, the rising edge of CLK0 as the 3rd, the rising edge of CLK1 as the 4th, the 5th is again the falling edge of CLK0, and so on. This gives us four alternating columns.

Nevertheless, the easiest way to handle this is to just combine the clocks into a single pixel clock, which I decided to do. We can skip the first six pixels by skipping the first pulse on CLK0 and the following rising edge. The first pixel is now the falling edge of CLK0; then we wait for a falling edge on CLK1, and so on. By alternating between the clocks and the edge detection (falling/rising), we get a constant pixel clock.

Data can then be latched in the normal order, row-wise from left to right and top to bottom (upper left to lower right).

Clock signals detail

Pinout

Pin Voltage level Signal Function Open xGB J4 RP2350 GPIO
1 24 V DC LCD-specific voltage (amplitude contrast dependent) - -
2 -20 V DC LCD-specific voltage (amplitude contrast dependent) - -
3 -20 V DC LCD-specific voltage (amplitude contrast dependent) - -
4 1.7 V DC Static - -
5 24 V DC LCD-specific voltage (amplitude contrast dependent) - -
6 24 V DC LCD-specific voltage (amplitude contrast dependent) - -
7 3.3 V Y0 Bit 0 of the luminance value 5 24
8 3.3 V Y1 Bit 1 of the luminance value 6 25
9 3.3 V Y2 Bit 2 of the luminance value 7 26
10 3.3 V Y3 Bit 3 of the luminance value 8 27
11 3.3 V VSYNC ~75 Hz vertical sync (start of frame) 3 43
12 0 V GND Supply ground 1,2 -
13 3.3 V VCC Supply 3.3 V - -
14 3.3 V CLK0 Pixel clock 0 22 40
15 3.3 V CLK1 Pixel clock 1 20 41
16 3.3 V HSYNC Horizontal sync (start of line) 4 42
17 1.7 V DC Static - -
18 3.3 V DC ~180 kHz additional clock - -

WS Capture Driver Demo

I implemented a dedicated driver to capture the WS’s video signal. The driver was developed using the Open xGB Display driver board together with the TFT for the ER-TFT034-2, a 3.4-inch 480×480 display available from buydisplay.com. The required connections are documented in the Pinout table.

Once configured, the capture process runs entirely in hardware without any further CPU interaction. The driver provides a single linear buffer with RGB555 values. The translation between the 4-bit values is done automatically by using indirect addressing with an additional DMA channel. The user can adjust this to any mapping required (see ws_capture_auwColors).

The demo does not compensate for tearing, so some flickering is to be expected. This can later be removed by using the correct display frame timing.

Wonder Swan Color Signals

The WonderSwan Color (WSC) has the same resolution as the WS, but it offers a color range of 4096 colors (12-bit). All relevant signals are 3.3 V as well. The VSYNC and HSYNC pulses are quite similar to those of the WS, and the clock signals are implemented in the same way. This is also true for the VBP and HBP. It is actually possible to use the same mechanisms and values as for the WonderSwan.

VSYNC pulse

HSYNC pulse

The first obvious difference is the 12 data lines instead of three. Using the same clock mechanism, we therefore get 12 bits of data per clock transition. One might think that this translates to an RGB444 pixel value on each clock, but the WSC is kind of a special bird. The 12 data lines are actually split into three columns. The easiest way to describe it is to think of it as three separate displays. Or, as asie put it: “my understanding is that the CSTN display is actually three panels in a trenchcoat”.

WSC display columns

Data lines 0–3 carry the signal for the first column, 4–7 carry the signal for the second column, and 8–11 carry the signal for the third column. As we don’t have enough lines to carry the full color value in a single clock cycle, we have to use three cycles to get the color value of a single pixel. In other words: the RGB444 color value is multiplexed over time.

 P  = Pixel in Column
 C0 = Column 0
 C1 = Column 1
 C2 = Column 2
 C  = Capture no

 P   C0   C1   C2  C 
 0  RRRR RRRR RRRR 0
 0  GGGG GGGG GGGG 1  |
 0  BBBB BBBB BBBB 2  | Time
 1  RRRR RRRR RRRR 3  |
 1  GGGG GGGG GGGG 4  V
 1  BBBB BBBB BBBB 5
 2  RRRR RRRR RRRR 6
 2  GGGG GGGG GGGG 7
         ...
 79 RRRR RRRR RRRR 237
 79 GGGG GGGG GGGG 238
 79 BBBB BBBB BBBB 239

Looking at data lines 0–3, we receive the 4-bit red value on the first clock, the 4-bit green value on the second, and the 4-bit blue value on the third. This repeats until we have the full data for one of the “sub” displays or columns. Simultaneously, the data for the other columns is transferred on data lines 4–7 and 8–11. VSYNC, HSYNC, CLK0, and CLK1 are shared between the columns.

Speaking of columns: We have a resolution of 224 × 144 pixels. The width does not match the three columns. Like the WS, the WSC also transports segment data for LCD symbols on the display. This data is encoded in 16 bytes of the last column. We therefore have a total width of 240 px, giving us a width of 80 px per column. The visible area of the last column has to be limited to 64 px in width in order to get the 224 px display resolution.

In order to decode the LCD segment data, furrtek provided the following diagram:

Segment encoding

Pinout

Pin Voltage level Signal Function Open xGB J4 RP2350 GPIO
1 20 V PWM (50%) LCD-specific voltage - -
2 -16 V PWM (50%) LCD-specific voltage - -
3 20 V PWM (50%) LCD-specific voltage - -
4 -16 V PWM (50%) LCD-specific voltage - -
5 2.2 V DC DC voltage - -
6 3.3 V C20 Column 2 Data 0 (LSB) 13 32
7 3.3 V C21 Column 2 Data 1 14 33
8 3.3 V C22 Column 2 Data 2 15 34
9 3.3 V C23 Column 2 Data 3 (MSB) 16 35
10 3.3 V C10 Column 1 Data 0 (LSB) 9 28
11 3.3 V C11 Column 1 Data 1 10 29
12 0 V C12 Column 1 Data 2 11 30
13 3.3 V C13 Column 1 Data 3 (MSB) 12 31
14 3.3 V C00 Column 0 Data 0 (LSB) 5 24
15 3.3 V C01 Column 0 Data 1 6 25
16 3.3 V C02 Column 0 Data 2 7 26
17 1.7 V C03 Column 0 Data 3 (MSB) 8 27
18 3.3 V VSYNC ~75Hz vertical sync (start of frame) 3 43
19 3.3 V GND 0V Supply 1,2 -
20 3.3 V VCC 3.3V supply - -
21 3.3 V CLK0 ~780 kHz additional clock 22 40
22 3.3 V CLK1 ~780 kHz additional clock 20 41
23 3.3 V HSYNC ~12kHz Horizontal sync (start of line) - -
24 3.3 V Clock ~180 kHz additional clock - -

WSC Capture Driver Demo

As with the WonderSwan, I implemented a dedicated driver to capture the WSC’s video signal. The driver was developed using the Open xGB Display driver board together with the TFT for the ER-TFT034-2, a 3.4-inch 480×480 display available from buydisplay.com. The required connections are documented in the Pinout table.

Once configured, the capture process runs entirely in hardware without any further CPU interaction. The driver supports two different modes: linear mode, which provides a conventional framebuffer containing the image from top-left to bottom-right, and column mode, which provides three separate linear buffers, one for each of the WSC’s display columns.

The unusual way the WSC transmits its image makes the capture process a little more interesting. Rather than sending pixels sequentially, the WSC splits the display into three 80-pixel-wide columns and multiplexes the RGB values over time. A single capture therefore contains only one color component for each pixel in all three columns. Three consecutive captures are required to reconstruct the complete RGB444 values.

To handle this efficiently, the driver uses three separate state machines, each looking at one of the three column groups. This effectively removes the time multiplexing from the captured data and allows each state machine to produce linear RGB444 pixel data for its respective 80×144-pixel column. The data can then be processed like a regular image without requiring the CPU to reconstruct the individual color values.

In column mode, the driver provides three 80×144-pixel buffers, one for each column. The buffer for the third column also contains 16 pixels that are not actually visible on the display, which needs to be taken into account by the display driver. Apart from the three buffers, this mode requires very little additional RAM.

Linear mode instead produces a conventional framebuffer containing the complete 224×144-pixel image. The first value is the upper-left pixel, followed by the remaining pixels of the row, with a new line beginning after every 224 pixels. This format is considerably easier to work with, but it requires additional RAM. It can also produce artifacts in the first 16 pixels of a line if tearing is not properly accounted for.

The driver is also designed with some flexibility for future extensions. Additional DMA transfers can theoretically be triggered at several points during the capture process—for example, by adding another transfer to wsc_capture_asTransfers during initialization.

At the moment, the driver does not perform any color translation. I expect this to be better handled as part of the display driver’s transfer stage, where the captured RGB444 data can be converted directly into whatever format the target display requires.

Further Notes

The following has been mentioned by asie: There might be an undocumented feature on the WonderSwan that allows the vertical blank period to be extended. This feature is implemented in, e.g., Fire Lancer. The mechanism isn’t used in commercial games and is not yet fully understood. It will probably not work with the current drivers, but I’m positive it can be implemented on the RP2350.

I tried to find a display module that matches the dimensions of the original display while providing a resolution that allows for full integer scaling. The only candidate I was able to find is the HJ3001-02, which is a predecessor to the HJ3008-02. Both are produced by SZ Hongjia Technology Shares Limited.

It is possible to obtain samples, but I wasn’t able to find the display being sold by a shop as a one-off.

Acknowledgements

I had some support from people that are working much longer on the WonderSwan platform and did a great job of providing information about it. I hope this post will add to this. If you need more information about the WOnderswan you can find it on the WSdev Wiki and the WonderSwan Discord.

Special thanks to:

  • davemcd for the initial idea
  • davemcd and asie for the onboarding (platform- and shopping-wise ;-))
  • zwenergy for providing some bits of documentation that came in very handy
  • furrtek for the LCD segment decoding diagram
  • asie for the information that there are 16 shades of grey on the WS

Changelog

  • [10.09.2026]: I had to change from 3-bit luminance to 4-bit luminance for the WonderSwan. I fell for the common misconception that the Swan only has 8 shades of grey. As I didn’t see any data on pin 7, I assumed it was only 3-bit. As asie pointed out, this is incorrect information on the German and Polish Wikipedia pages, and it has been corrected on the English one. The driver, pinout, and text have been modified accordingly.

Downloads

You will find the driver demo projects on codeberg.org: https://codeberg.org/embedded-ideas/wonderswan_capture_demo