Repository navigation
Home
A couple of years ago I published a detailed guide on how to inject i2c data into Panasonic TC-21FX30LA CRT to reconfigure its component video input into RGB. I recently got my hands on a SONY PVM-14N2U, and while servicing it I noticed it had an I2C service port, and it also included a Micronas Video Processor (VDP3108). So I thought it would be interesting to try out the same experiment here, and maybe use some new tools I didn't have at that time to do it faster. This guide will cover the whole process. I suggest first reading the Panasonic guide before getting into this one.
- Disclaimer
- Tools and equipment used
- I2C data sniff and decoding
- Two I2C Buses
- BINT
- Interfacing with I2C using Arduino Nano
- Mapping User and Service Settings using an LLM Coding Agent
- Next Steps (pmv-jig tool)
- MiSTer FPGA
- Final Notes
This guide is intended for educational purposes only. The procedures described herein involve modifying the internal operation of the Sony PVM-14N2U CRT, which may result in unintended consequences, including but not limited to rendering the monitor inoperable.
The author of this guide assumes no responsibility or liability for any damage, data loss, or hardware malfunction that may occur as a result of following the instructions provided. Users proceed at their own risk.
By using this guide, you acknowledge and agree that the author is not liable for any direct, indirect, incidental, special, or consequential damages resulting from the use of the information contained herein.
- Sony PVM-14N2U CRT (ver 1.x)
- Micronas VDP 3108
- Logic Analyzer
- Arduino Nano
- MiSTer FPGA
- LLM coding agent
Service port (CN052)
After hooking the logic analyzer up to the port, I tried to capture while changing the volume from 30 to 31 and back to 30, and I got some R/W on 0x50 addr:
Volume capture
Using sigrok, we can see it more clearly:
sigrok-cli -d fx2lafw \
--config samplerate=4m \
--continuous \
--channels D0=SCL,D1=SDA \
--protocol-decoders i2c:address_format=shifted \
--protocol-decoder-annotations \
i2c=start:repeat-start:stop:address-read:address-write:data-read:data-write:warnings
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 10 # start offset 0x10
i2c-1: Data write: 1F # volume 0x10 = volume 31 (x01f)
i2c-1: Data write: 01
i2c-1: Data write: 4D
i2c-1: Data write: 32
i2c-1: Data write: 32
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Stop
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 18
i2c-1: Data write: 02
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 02
i2c-1: Data write: 01
i2c-1: Stop
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 10
i2c-1: Data write: 1E # volume 0x10 = volume 30 (x01e)
i2c-1: Data write: 01
i2c-1: Data write: 4D
i2c-1: Data write: 32
i2c-1: Data write: 32
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Stop
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 18
i2c-1: Data write: 02
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 02
i2c-1: Data write: 01
i2c-1: Stop
So, this is the MCU writing to EEPROM ST24C04FB6 (IC002).
Changing the contrast showed a similar pattern:
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 10
i2c-1: Data write: 1E
i2c-1: Data write: 02 # Contrast
i2c-1: Data write: 4D
i2c-1: Data write: 32
i2c-1: Data write: 32
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Stop
i2c-1: Start
i2c-1: Write
i2c-1: Address write: 50
i2c-1: Data write: 18
i2c-1: Data write: 02
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 00
i2c-1: Data write: 02
i2c-1: Data write: 01
i2c-1: Stop
But this time at offset 0x12.
Everything looked very familiar, but too simple at the same time. There was not any other i2c traffic besides the CPU talkig to the EEPROM. Time to look at the service manual...
We connected the logic analyzer to the service port, which exposes I2C BUS1. However, if you look closer, there is another I2C bus going to the video processor:
IC2 BUS0
Let's connect ch3 and ch4 of the logic analyzer to this BUS. This is tricky, as those pads are not exposed. You would need to solder some cables or use some micro grabber clips either on the CPU or VDP. I chose to hook into the VDP, p10 (SCL0) and p14 SDA0:
Grabber clips on BUS0
And a quick capture showed a lot going on this bus:
BUS0 capture
There is another device involved (addr 0x45), not present in BUS1. This must be the VDP. At this point I could have tried to decode it following the VDP datasheet, but I decided to skip that part and instead check what BINT does.
There are two other pins on the service port
BINTAGING
I decided not to mess around with Aging Mode, and I knew in advance that BINT port would behave in a similar way to FA1 in the panasonic, so the first test I did was to connect bint to ground through a 1K resistor.
When pulling BINT low, I noticed that BUS0 went completely silent; same thing I saw in the Panasonic. So, probably this port is used to put the device in Service mode so you can talk to the monitor without colliding with other data going through the BUS. So, next step would be to scan the bus for other devices, and check what BINT really does. For this, I needed a microcontroller.
In the Panasonic the BUS was 3.3V. This is not the case here, as we have 5V. So, taking that into account I decided to use an Arduino Nano instead of ESPxx, so I could avoid adding extra level shifters. I prepared a very simple firmware (based on the ESP firmware I previously built for the Panasonic) that exposes same single character commands over the serial port, and allowed me to send basic i2c commands (scan, r/w, pull Bint low, etc.):
Arduino Nano connected to BUS1
The Nano runs at 5 V like the PVM BUS, so it connects directly: no shifter, no transistor. PVM-14N2U header CN052:
| Nano | CN052 |
|---|---|
| A4 (SDA) | 3 SDA |
| A5 (SCL) | 2 SCL |
| D2 | 4 BINT |
| GND | 1 GND |
Let's scan the bus for addrs through 40 to 80:
picocom -b 115200 --echo --omap crlf /dev/cu.usbserial-210
picocom v2024-07
port is : /dev/cu.usbserial-210
flowcontrol : none
baudrate is : 115200
parity is : none
databits are : 8
stopbits are : 1
txdelay is : 0 ns
escape is : C-a
local echo is : yes
noinit is : no
noreset is : no
hangup is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv -E
imap is :
omap is : crlf,
emap is : crcrlf,delbs,
logfile is : none
initstring : none
exit_after is : not set
exit is : no
minimal cmds is: no
Type [C-a] [C-h] to see available commands
Terminal ready
READY pvm 1
s 40 80
OK 50 51
Only the EEPROM responded. Let's now pull BINT low and scan again:
b 1
OK 1
s 40 77
OK 45 50 51
Yes! The VDP (0x45) answered. This means that Sony added a way to communicate with the VDP through the service port. When BINT is pulled down, the VDP joins BUS1, and the CPU stops sending data through the BUS. This is great news, as now we can talk directly to the Video Processor through the service port. Now we can go back to the logic analyzer, we will try to change some settings while we listen to both buses, and see if we can decode what the CPU sends to the VDP.
The idea would be this: we listen to both i2c buses, change a video setting (e.g. rdrive) and compare what the CPU sends before and after the change.
rdrive set from 0x339 to 0x33A
If you check VDP datasheet for R DRIVE you will see this (Table 3–2: Control Registers of the Fast Processor):
Fast Processor
R DRIVE
And this very important note:
The white drive values will become active only after writing the blue value WDB, latching of new values is indicated
by setting the MSB of WDB.
We need to look for a write to 0x45 that should look like this:
W@45 27 00 F0
│ │ └──── payload: 16-bit word = FP RAM address 0x0F0 (WDR)
│ └──────── subaddress 0x27 = FPWR register
└───────────── 0x45 = the whole VDP3108 chip
A closer inspection reveals this:
read to 0x45 ack data: 0x00
write to 0x45 ack data: 0x27 0x00 0xF0 # WDR
write to 0x45 ack data: 0x28 0x03 0x3A
write to 0x45 ack data: 0x29
read to 0x45 ack data: 0x00
write to 0x45 ack data: 0x27 0x00 0xF1 # WDG
write to 0x45 ack data: 0x28 0x03 0x0E
write to 0x45 ack data: 0x29
read to 0x45 ack data: 0x00
write to 0x45 ack data: 0x27 0x00 0xF2 # WDB
write to 0x45 ack data: 0x28 0x03 0x39
The CPU is writing R DRIVE, G DRIVE, and finally B DRIVE. Without the last one, the first two wouldn't work.
And if we compare before vs after:
Before:
read to 0x45 ack data: 0x00
write to 0x45 ack data: 0x27 0x00 0xF0
write to 0x45 ack data: 0x28 0x03 0x39
write to 0x45 ack data: 0x29
read to 0x45 ack data: 0x00
After:
read to 0x45 ack data: 0x00
write to 0x45 ack data: 0x27 0x00 0xF0
write to 0x45 ack data: 0x28 0x03 0x3A
write to 0x45 ack data: 0x29
read to 0x45 ack data: 0x00
Let's try it out with the nano and picocom. Let's set RED DRIVE to a low value (0x139) and then latch BLUE DRIVE. And I will use 240p color bars pattern as rgb video input
RGB Colors Bars (Before)
Type [C-a] [C-h] to see available commands
Terminal ready
READY pvm 1
b 1
OK 1
i 45 29
OK 00
o 45 27 00 F0
OK
o 45 28 01 39 # WDR
OK
o 45 27 00 F2 # WDG
OK
o 45 28 03 39 # WDB (latch)
And immediately after latching blue, the red is gone:
RGB Colors Bars (After)
We have control over the VDP.
After releasing BINT, colors go back to initial state. This is expected, as the cpu reloads every setting from EEPROM. And looking at BUS1, we can see the last save (I saved the initial value back):
I2C start 38.309794875 0.000000125
I2C address 38.309808125 0.000106375 true 0x50 false
I2C data 38.309936125 0.000106375 true 0xA0
I2C data 38.31006325 0.00010625 true 0x3A
I2C data 38.31019325 0.00010625 true 0x03
I2C data 38.31032325 0.00010625 true 0x0E
I2C data 38.31045325 0.00010625 true 0x03
I2C data 38.31058325 0.00010625 true 0x39
I2C data 38.31071325 0.000106375 true 0x03
I2C stop 38.31085325 0.000000125
I2C start 38.32975675 0.000000125
It's using offset A0 to store RGB DRIVE settings:
W@50 A0 39 03 0E 03 35 03
│ └R──┘ └G──┘ └B──┘
└── word address 0xA0 (block 0 of the 24C04)
Let's try in picocom:
b 1
OK 1
r 0A0 6
OK 39 03 0E 03 39 03
w 0a0 3b 01
OK
b 0
OK 0
Red is gone, and persisted. So, we have a way to interact with the VDP and the EEPROM, change settings in realtime and persist them. We are ready to map the whole user and service settings.
When I worked on the Panasonic CRT years ago I did everything by hand, looking at the dumps, comparing values, checking the datasheet, etc. It's a very time consuming task. But today we have new tools, we can use some coding LLM to assist us in this process. We can send a huge amount of data to the LLM and be able to find patterns and correlate the data against the Datasheet. In this section I will show how I did this.
The first is to pick your favorite LLM coding agent, and then you can start ingesting some data. I will do everything from a shell, and the agent can have access to several tools (e.g. python, sigrok-cli, grep, etc.). I started by sharing my previous tutorial for the Panasonic TC-21FX30LA, and all the findings we have covered so far. And then I gave the LLM some basic instructions:
-
Documents:
- Panasonic TC-21FX30LA wiki
- PVM 14n2u service manual
- VDP datasheet
-
Goals:
- map PVM-14N2u user and service settings and keep track of the process in a file called
register_map.md - control the monitor remotely from a PC using an Arduino Nano (MacOS/Linux).
- document the whole process in a file called
architecture.md
- map PVM-14N2u user and service settings and keep track of the process in a file called
-
Tools: I also taught the agent how to capture logic analyzer data using sigrok-cli:
sigrok-cli -d fx2lafw \
--config samplerate=4m \
--time 10000 \
--channels D0=SCL1,D1=SDA1,D2=BINT,D3=SCL0,D4=SDA0 \
-o dumps/color_select_auto_comb.sr
The Arduino nano was also connected to the same computer, so the agent has access to it, and it can use all the available commands:
b OK 0|1 BINT state (1 = asserted, low)
b 1 OK 1 assert BINT: the MCU leaves both buses, the VDP becomes reachable
b 0 OK 0 release BINT: the MCU reloads the EEPROM (picture blanks ~2 s)
g [0|1] OK 0|1 BINT gate: 1 (default) = r/w/i/o need "b 1"; 0 = always allowed
(manual mode, collisions with the MCU possible)
s [lo hi] OK 50 51 scan 08-77 (or lo-hi, max 7F), list addresses that ACK
r <off> [n] OK 9D 0D read n bytes (default 1), data on the OK line for n <= 16
r <off> <n> <off>: .. n > 16: one line per 16-byte block, then "OK <16-bit sum>"
w <off> <b> ... OK single-byte writes (10 ms each, up to 32), read back and verified
i <dev> <reg> [n] OK 0D 9D register read: write reg, repeated START, read n (1-16) bytes
o <dev> <b> ... OK raw write: START, dev, bytes, STOP (up to 32). Any device, no verify
Note: you don't need to build the firmware yourself, you can tell the coding agent to build it for you following your patterns.
Finally, I shared my folder with previous projects, and asked it to follow my style, and avoid adding unnecessary complexity.
I then told the agent to create a plan with the goals and tools we have. And after reviewing the plan, simplifying it a bit, tweaking a couple of points, we agreed on the following:
- I would manually set some user and service settings in a similar manner to what we have done above (e.g. write down R DRIVE value, set it to
Xand save it). - Before changing a setting I would trigger a 10s capture using sigrok-cli and store it in
./dumps - Let the agent know when the dump is ready.
- The LLM would then look for changes in the dump (both buses). Correlate the findings with VDP datasheet. Document the findings.
- Optionally, validate the same R/W action using the Nano.
We started with the plan, changing user and menu service settings and mapping the registers. The agent did a great job correlating the findings with the datasheet. It created several tools for me to find differences in dumps, validate the data, etc. In a couple of minutes we were able to map more than 10 registers.
I then decided that I have enough information to delegate the rest of the mapping to the agent, and I allowed it to take full control of the nano and the logic analyzer. The agent did a very good job overall mapping almost all the registers, and I had to correct it just two or three times. This automatic mapping consisted of the following:
1. Full EEPROM dump, then a short idle capture with BINT released
2. Change one EEPROM byte (BINT asserted).
3. Release BINT: the MCU reloads the EEPROM and re-sends everything to the VDP (~2 s blank).
4. Capture 2–3 s and diff
5. Restore the byte(and reload).
During the mapping we also discovered some interesting facts:
- User settings (e.g. Volume, inputs, etc.) cannot be changed live. And it makes sense, the volume does not go through the VDP. It's something controlled directly by the CPU, with no i2c traffic involved (besides the writing of the data in eeprom)
- Some settings (e.g. geometry, tint) are not just values that goe directly to the VDP, the CPU takes the value from memory, does some calculations and then writes to the VDP. So, for those, you can't do "live write" unless you previously calculate the needed values.
- Something at
0x30also answers; I haven't checked what it is yet. It could another be device, or the CPU answering as a slave in jig mode.
And many other things. The full list is documented in architecture.md.
Once I had all the registers mapped, I was able to change contrast, brightness, geometry, etc. using the nano. Next step was to build a python cli-tool that I called pvm-jig. I asked the agent to build the tool following some basic guidelines from previous cli tools I wrote myself. And I was very precise on the architecture of the tool, in such a way that would allow me to easily extend it to other PVMs. So, for example, I decided to decouple the PVM register mapping from the code, and put everything related to the monitor in a separate .toml file.
python host/pvm-jig.py --help
usage: pvm-jig [-h] [--version] [-p PORT] [-m MODEL] [--manual] {ports,info,bint,scan,raw,ee,fp,reg,i2c,list,get,set,pending,commit,discard,shell} ...
Control and debug a Sony PVM through the Nano I2C bridge. All numbers are hex.
positional arguments:
{ports,info,bint,scan,raw,ee,fp,reg,i2c,list,get,set,pending,commit,discard,shell}
ports list serial ports
info model, port, BINT state
bint show or set BINT: on | off | manual | auto
scan scan I2C addresses (lo hi)
raw send protocol lines to the Nano, e.g. raw "i 45 29"
ee eeprom: read OFF [N] | write OFF BYTE.. | dump [FILE] | diff FILE | restore FILE
fp VDP FP RAM: read ADDR.. | write ADDR VALUE
reg VDP direct register: read REG | write REG VALUE
i2c any device: read DEV REG [N] | write DEV BYTE..
list items and their values
get one item: EEPROM and VDP value
set set items: ITEM VALUE [ITEM VALUE ...], values 1F | 0x1F | d:31 | osd:28, or relative +N / -d:N / +osd:N; all are checked before any is written, one commit; -c
commits, -f forces unsafe values
pending items set but not committed
commit write pending items to EEPROM, release BINT
discard drop pending items, release BINT
shell interactive session (keeps BINT and pending items)
options:
-h, --help show this help message and exit
--version show program's version number and exit
-p, --port PORT serial port (default: first USB serial port)
-m, --model MODEL model name or .toml path
--manual never touch BINT; bus commands run whatever its state (BINT gate off)
The tool allows you to do everything, from raw R/W, register listing, EEPROM dump/restore, etc. And the config file for the PVM has this structure:
[model]
name = "Sony PVM-14N2U"
mcu = "CXP85220A-027S"
firmware = "1.x"
vdp = 0x45
eeprom = 0x50
protect = [0xFF]
[context]
input = { eeprom = 0x1E, map = { "0" = "video", "1" = "video", "2" = "rgb" } }
field = { fp = 0x0EB, below = 287, then = "60", else = "50" }
# --- picture processing (packed registers) ---
[items.pkun]
label = "PKUN"
menu = 0
group = "picture"
eeprom = { at = 0x36, size = 2, bits = [3, 0] }
vdp = { reg = 0x69, size = 2, bits = [3, 0] }
help = "Luma peaking level for undershoots (sharpness of dark edges). Manual: peaking level undershoot."
[items.pkov]
label = "PKOV"
menu = 1
group = "picture"
eeprom = { at = 0x36, size = 2, bits = [7, 4] }
vdp = { reg = 0x69, size = 2, bits = [7, 4] }
help = "Luma peaking level for overshoots (sharpness of bright edges). Manual: peaking level overshoot."
#...The idea is that in the future, people could add support for other PVMs with different mappings.
Next step was to build a UI. The cli tool was built in such a way that you should be able to implement different interfaces on top of it, so adding an UI should be straightforward:
pvm jig panel
To change a setting you just need to first pull BINT low, and then set the values and release. There are some settings that can be set "live" by directly writing to the VDP, and some settings need a previous calculation (made by the tool); for those, you can check "live calc", or just store the menu value on the EEPROM and leave the calculation to the CPU.
It wouldn't be fun enough if I didn't add support for the MiSTer FPGA. This should be super straightforward. The MiSTer runs Linux and has USB port; that was all I needed. So I built a WEB Panel, designed to be run on top of pvm-jig, executed by the MiSTer and controlled remotely from a PC through ethernet.
pvm jig web
I even added per-core profiles that apply settings automatically for each core when you switch games:
pvm jig web profiles
For the moment this is all experimental; I have only tested this with my PVM-14N2u, but I built and documented everything so that other users could easily extend the functionality of the tool. I have also included a SKILL that can be added to your coding agent, with the instructions on how to help you during the mapping and troubleshooting process. I've also included all the logic analyzer dumps, that will be very useful when you start to work on a different monitor. Everything is shared in https://github.com/charlysan/pvm-jig.