hoglet67 / RGBtoHDMI

Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI
GNU General Public License v3.0
838 stars 114 forks source link

CPLD programing error TDO #348

Open AiGeekNet opened 11 months ago

AiGeekNet commented 11 months ago

Hi, I have soldered my own issue 4 12-bit board, plugged the hat into a Pi Zero, I see the rainbow screen and CPLD Recovery Menu.

IMG_20231022_015912 IMG_20231022_015922 IMG_20231022_015930 IMG_20231022_023526 My CPLD IC is XC9572XL VQG44 10C. When I select CPLD_v79 and confirm, it return and nothing happened. I get the debug info below. Any ideas what I may have done wrong? Thanks so much for any pointers!

Found CPLD: 6-12_BIT_BBC_CPLD_v79 Found CPLD: 3_BIT_BBC_CPLD_v68 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0008 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0002 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0002 Read xsvf file /cpld_firmware/recovery/6-12_BIT_BBC_CPLD_v79.xsvf (length = 53373) Programming.... CPLD programming: JTAG command = 0xfe (IDCODE) TDO Expected = 0xf9604093 TDO Captured = 0xffffffff TDO Mask = 0x0fffffff ERROR: TDO mismatch and exceeded max retries ERROR at or near XSVF command #8. See line #8 in the XSVF ASCII file. Failed, error = 3 Entering poll_keys_only, flags=00000000

IanSB commented 11 months ago

@AiGeekNet It's detecting the wrong type of board as you only get that menu with an issue 1-3 board and Issue 4 and later have 3 firmware options. It might be a soldering issue although if you got your CPLD from China it is very likely that it has been recycled and is already programmed with some other firmware which can stop initial reprogramming from working and can also cause the board to be mis-identified.

The fix for that is to cut the three solder bridges JP1, JP2 & JP4 then program the CPLD then remake the bridges. This is mentioned in the CPLD menu with recent software but I don't think that message shows up for the old Issue 1-3 boards so I'll have to add it in a future release to cover mis-identification.

The programming menu on recent firmware should look like this: capture0

AiGeekNet commented 11 months ago

@IanSB I have cut three jumers but get the same info and error. Does it due to my board is 6bit ( I exported gerbers from /Kicad_6Bit/V4)?

RESET RGB to HDMI booted Running GPU capture build. Kernel version: 20230517 eb620884 Marked framebuffer from 1EB00000 to 1EC00000 as cached Pi Hardware detected as type 1 CPLD board detected 6 bit board detected Standard board detected Using PLLA as the sampling clock PLLA: 2400.000000 ANA1 = 00000001 PLLA: PDIV=1 NDIV=62 CTRL=0002103e FRAC=524288 DSI0=256 CORE=4 PER=256 CCP2=256 PLLB: 2000.000024 ANA1 = 00144000 PLLB: PDIV=1 NDIV=52 CTRL=00021034 FRAC=87382 ARM=2 SP0=256 SP1=256 SP2=256 PLLC: 2400.000000, ANA1 = 00144000 PLLC: PDIV=1 NDIV=62 CTRL=0002103e FRAC=524288 CORE2=256 CORE1=256 PER=2 CORE0=2 PLLD: 2000.000024 ANA1 = 00144000 PLLD: PDIV=1 NDIV=52 CTRL=00021034 FRAC=87382 DSI0=256 CORE=4 PER=4 DSI1=256 PLLH: 1620.000000 ANA1 = 0000000c PLLH: PDIV=1 NDIV=84 CTRL=00021054 FRAC=393216 AUX=256 RCAL=256 PIX=1 STS=69567 PLLA: 2400.000000 ANA1 = 00000001 PLLA: PDIV=1 NDIV=62 CTRL=0002103e FRAC=524288 DSI0=256 CORE=256 PER=4 CCP2=256 CPU speed detected as: 1000 Mhz EMMC: BCM2708 controller power-cycled Unknown CPLD: identifier = fff Keycount = 0 CPLD Design: 3-12_BIT_BBC CPLD Version: f.f Loading file /Palettes/Atari_800_NTSC.bin Loading file /Palettes/Atari_800_PAL.bin Loading file /Palettes/Atom_MKII.bin Loading file /Palettes/Atom_MKII_Full.bin Loading file /Palettes/Atom_MKII_Plus.bin Loading file /Palettes/Colour_Genie_N25.bin Loading file /Palettes/Colour_Genie_S24.bin Loading file /Palettes/Colour_Genie_S25.bin Loading file /Palettes/Commodore_64.bin Loading file /Palettes/Commodore_64_Rev1.bin Loading file /Palettes/Dragon-CoCo_Black.bin Loading file /Palettes/Dragon-CoCo_Emu.bin Loading file /Palettes/Dragon-CoCoFull.bin Loading file /Palettes/Intellivision.bin Loading file /Palettes/MDA-Hercules.bin Loading file /Palettes/Mono(2level).bin Loading file /Palettes/Mono(3level).bin Loading file /Palettes/Mono(4level).bin Loading file /Palettes/Mono(6level).bin Loading file /Palettes/Mono(8_levelRGB).bin Loading file /Palettes/Mono(8_levelYUV).bin Loading file /Palettes/RGB.bin Loading file /Palettes/RGBI.bin Loading file /Palettes/RGBI(CGA).bin Loading file /Palettes/RGBI(Laser).bin Loading file /Palettes/RGBI(Spectrum).bin Loading file /Palettes/RGBI(XRGB-NTSC).bin Loading file /Palettes/RGBrgb(Amstrad).bin Loading file /Palettes/RGBrgb(Spectrum).bin Loading file /Palettes/RrGgBbI(SAM).bin Loading file /Palettes/RrGgBb_(EGA).bin Loading file /Palettes/Spectrum_48K_9Col.bin Loading file /Palettes/TI-99-4a.bin Loading file /Palettes/Tea1002.bin Loading file /Palettes/Test_4_Lvl_B_or_U.bin Loading file /Palettes/Test_4_Lvl_G_or_Y.bin Loading file /Palettes/Test_4_Lvl_R_or_V.bin FOUND RESOLUTION: 0, 640x480 FOUND RESOLUTION: 1, 720x576 FOUND RESOLUTION: 2, 800x480 FOUND RESOLUTION: 3, 800x600 FOUND RESOLUTION: 4, 800x600_Overscan FOUND RESOLUTION: 5, 960x540 FOUND RESOLUTION: 6, 1024x600 FOUND RESOLUTION: 7, 1024x768 FOUND RESOLUTION: 8, 1280x1024 FOUND RESOLUTION: 9, 1280x720 FOUND RESOLUTION: 10, 1280x800 FOUND RESOLUTION: 11, 1360x768 FOUND RESOLUTION: 12, 1440(1920)x1080 FOUND RESOLUTION: 13, 1440x1080 FOUND RESOLUTION: 14, 1440x900 FOUND RESOLUTION: 15, 1600x1200 FOUND RESOLUTION: 16, 1600x900 FOUND RESOLUTION: 17, 1680x1050 FOUND RESOLUTION: 18, 1920x1080 FOUND RESOLUTION: 19, 1920x1200 FOUND RESOLUTION: 20, 2560x1440 FOUND RESOLUTION: 21, Auto FOUND RESOLUTION: 22, Full_4K(25-30Hz) FOUND RESOLUTION: 23, Half_4K(1920x2160) Standard EDID lowest vertical refresh detected as 59 Hz Timing descriptor detected as 1600x1200 Manufacturer = 15C3, year = 2007 Lowest vertical frequency supported by monitor = 59 Hz Loading file /config.txt disable_overclock: 0

auto_overscan: 1

HDMI drive: 1 Read refresh: 1 Read resolution: Auto Match resolution: 21 Auto Auto 1600x1200 workaround = 0 noreboot 0 0 '' Read scaling: 0 Setting Integer Sharp Read scalingkernel: 8 (BBC) (BBC) (BBC) (BBC) current cpld prefix = '(BBC)', 6 Loading file /favourites.txt WARN: Failed to open /favourites.txt (result = 4) Loading file: /Profiles/3-12_BIT_BBC/../Default.txt Scanning folder: /Profiles/3-12_BIT_BBC/Acorn Found profile: (BBC)_Acorn/BBC_Master Found profile: (BBC)_Acorn/Communicator Found profile: (BBC)_Acorn/System_Teletext Found profile: (BBC)_Acorn/Electron Found profile: (BBC)_Acorn/Atom_TTL Found profile: (BBC)_Acorn/BBC_Micro Found profile: (BBC)_Acorn/BBC_NuLA_12bpp_Mode7 Found profile: (BBC)_Acorn/BBC_NuLA_3bpp_Mode7 Scanning folder: /Profiles/3-12_BIT_BBC/Amstrad Found profile: (BBC)_Amstrad/Amstrad_CPC_PLUS Scanning folder: /Profiles/3-12_BIT_BBC/Apple Found profile: (BBC)_Apple/Apple_IIe_TTL Found profile: (BBC)_Apple/Apple_IIc_TTL Found profile: (BBC)_Apple/Apple_II_TTL Scanning folder: /Profiles/3-12_BITBBC/Camputers+Oric+_Sharp Found profile: (BBC)Camputers+Oric+_Sharp/Oric Found profile: (BBC)Camputers+Oric+_Sharp/Camputers_Lynx Found profile: (BBC)Camputers+Oric+_Sharp/Sharp_MZ-700 Scanning folder: /Profiles/3-12_BIT_BBC/ColourGenie+_ABC80+_RML Found profile: (BBC)_ColourGenie+_ABC80+_RML/RML_480Z Scanning folder: /Profiles/3-12_BIT_BBC/Commodore Found profile: (BBC)_Commodore/Amiga Scanning folder: /Profiles/3-12_BIT_BBC/Sinclair Found profile: (BBC)_Sinclair/ZX80_TTL Found profile: (BBC)_Sinclair/Sinclair_QL Scanning folder: /Profiles/3-12_BIT_BBC/_Other Found profile: (BBC)Other/Colour Test Found profile: (BBC)Other/Custom Loading file /profile_3-12_BIT_BBC.txt WARN: Failed to open /profile_3-12_BIT_BBC.txt (result = 4) Setting saved config number to 0 Setting profile to 2 Loading file: /Profiles/3-12_BIT_BBC/Acorn/BBC_Micro.txt Jit0 Setting subprofile to 0 Profile = Acorn/BBC_Micro Starting GPU code Detected polarity state at startup = 4, Comp (Separate H & V CPLD) modeset = 0 Keycount = 0 Setting Integer Sharp -----------------------LOOP------------------------ Detected polarity state = 4, Comp (Separate H & V CPLD) clkinfo.clock = 16000000 Hz clkinfo.line_len = 1024.000000 clkinfo.clock_ppm = 5000 ppm Nominal 100 lines = 6400000 ns Actual 100 lines = 10327144 ns Clock error = 613616 PPM WARN: PPM error too large, using previous clock Error adjusted clock = 16000000 Hz Target PLL frequency = 2048000000 Hz, prediv = 1, PER = 4 Actual PLL frequency = 2048000000 Hz GPCLK Divisor = 4 Vsync retry count = 9 Lines per frame = 316, (316.051) Actual frame time = 32639181 ns (non-interlaced), line time = 103271 ns Window: H=102755 to 103787, V=32475986 to 30000000 Sync=Comp, Det-Sync=Comp, Det-HS-Width=102853, HS-Thresh=9000 Width or Height differ from last FB: Setting dummy 64x64 framebuffer Overscan L=0, R=0, T=0, B=0 Initialised Framebuffer Size: 800x600 (req 800x600). Addr: 1E000000 (DE000000) Screen size = 1600x1200 Pitch=800, width=800, height=600, sizex2=1, bpp=8 chars=96, nlines=288, hoffset=14, voffset=13, ncapture=-1 palctrl=1, samplewidth=0, hadjust=16, vadjust=12, sync=0x4 detsync=0x4, vsync=0, video=0, ntsc=8, border=0, delay=3 ARM: GPIO read = 50ns, MBOX read = 45ns, Triple MBOX read = 53ns (17ns/word) GPU: GPIO read = 38ns, MBOX write = 11ns RAM: Cached read = 3ns, Uncached screen read = 100ns Composite_Process 720 pixel artifact decode: = 46577ns Test_Composite_Process 720 pixel artifact decode: = 59748ns Found CPLD: 6-12_BIT_BBC_CPLD_v79 Found CPLD: 3_BIT_BBC_CPLD_v68 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0004 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0004 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0002 Entering poll_keys_only, flags=00000000 Leaving poll_keys_only, result=0002 Read xsvf file /cpld_firmware/recovery/6-12_BIT_BBC_CPLD_v79.xsvf (length = 53373) Programming.... CPLD programming: JTAG command = 0xfe (IDCODE) TDO Expected = 0xf9604093 TDO Captured = 0xffffffff TDO Mask = 0x0fffffff ERROR: TDO mismatch and exceeded max retries ERROR at or near XSVF command #8. See line #8 in the XSVF ASCII file. Failed, error = 3 Entering poll_keys_only, flags=00000000

IanSB commented 11 months ago

@AiGeekNet

I have cut three jumers but get the same info and error. Does it due to my CPLD IC is AWN ?

No, I have some with exactly the same batch codes and markings that work.

Does it due to my board is 6bit ?

No, Issue 4 boards are 8/12 bit. You board is being mis-detected because a pin is held high instead of low.

First test that the jumpers are actually cut using a multimeter, especially JP1 as that isolates the signal that determines the board issue from a CPLD pin.

If you are sure that the jumpers are cut then check the soldering around Pin 9 of the CPLD, Pin 27 of the Pi header, Pin 7 of P5 and R7 (make sure it is the correct value). These are all connected together and are pulled low by R7 but the software is seeing this line pulled high on power up which is causing the incorrect identification.

See schematic: https://raw.githack.com/hoglet67/RGBtoHDMI/master/Kicad_6Bit/v4/rgb-to-hdmi.pdf