diff --git a/logicanalyzer/Sleic/Pin-Ball - Sleic 128x32.sal b/logicanalyzer/Sleic/Pin-Ball - Sleic 128x32.sal new file mode 100644 index 00000000..63ab7b8f Binary files /dev/null and b/logicanalyzer/Sleic/Pin-Ball - Sleic 128x32.sal differ diff --git a/platformio.ini b/platformio.ini index 70f9f54b..9a14cad4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,4 +15,4 @@ board = rpipico2 board_build.core = earlephilhower board_build.filesystem_size = 0.5m build_flags = - -DRP2350 + -DRP2350 \ No newline at end of file diff --git a/src/dmd_interface.h b/src/dmd_interface.h index e86811c2..9c3168ed 100644 --- a/src/dmd_interface.h +++ b/src/dmd_interface.h @@ -27,6 +27,13 @@ void dmd_reader_program_init(float dmd_clkdiv, PIO pio, uint sm, uint offset, pi sm_config_set_clkdiv(&c, dmd_clkdiv); } + if (dmd_type == DMD_SLEIC_V1) { + // set DE as the jmp pin for Sleic V1, used to detect MSB or LSB dot. + sm_config_set_jmp_pin(&c, DE); + pio_gpio_init(pio, DE); + pio_sm_set_consecutive_pindirs(pio, sm, DE, 1, false); + } + if (in_base_pin == SDATA_X16) { pio_gpio_init(pio, SDATA_X16); // Extra data line for Data East X16 pio_gpio_init(pio, SDATA_X16_PADDING); // used as a padding 0 bit diff --git a/src/dmdreader.cpp b/src/dmdreader.cpp index eb2a1905..30b53550 100644 --- a/src/dmdreader.cpp +++ b/src/dmdreader.cpp @@ -408,10 +408,15 @@ DmdType detect_dmd() { (rclk < 4400) && (rdata > 125) && (rdata < 140)) { return DMD_SPINBALL; - // Sleic -> DOTCLK: 599000 | RCLK: 4700 | RDATA: 145 + // Sleic V1 -> DOTCLK: 352000 | RCLK: 2625 | RDATA: 80 + } else if ((dotclk > 330000) && (dotclk < 375000) && (rclk > 2550) && + (rclk < 2700) && (rdata > 75) && (rdata < 85)) { + return DMD_SLEIC_V1; + + // Sleic V2 -> DOTCLK: 599000 | RCLK: 4700 | RDATA: 145 } else if ((dotclk > 570000) && (dotclk < 630000) && (rclk > 4550) && (rclk < 4850) && (rdata > 135) && (rdata < 155)) { - return DMD_SLEIC; + return DMD_SLEIC_V2; // ROMSTAR -> DOTCLK: 4000000 | RCLK: 15625 | RDATA: 245 } else if ((dotclk > 3900000) && (dotclk < 4100000) && (rclk > 15300) && @@ -695,7 +700,7 @@ void dmd_dma_handler() { if (source_shiftplanesatmerge) { if (dmd_type == DMD_SPIKE1) { v <<= plane; - } else if (dmd_type == DMD_SLEIC) { + } else if (dmd_type == DMD_SLEIC_V2) { v <<= (source_planesperframe - 1) - plane; } } @@ -1346,13 +1351,36 @@ bool dmdreader_init(bool return_on_no_detection) { break; } - case DMD_SLEIC: { + case DMD_SLEIC_V1: { + uint input_pins[] = {RDATA}; + dmdreader_programs_init( + &dmd_reader_sleic_v1_program, + dmd_reader_sleic_v1_program_get_default_config, + &dmd_framedetect_generic_program, + dmd_framedetect_generic_program_get_default_config, input_pins, 1, + 0, SDATA); + + // load 127 directly to TX fifo + pio_sm_put(dmd_pio, dmd_sm, 127); + + source_width = 128; + source_height = 32; + source_bitsperpixel = 2; + target_bitsperpixel = 2; + source_planesperframe = 2; + source_planehistoryperframe = 1; + source_lineoversampling = LINEOVERSAMPLING_NONE; + source_mergeplanes = MERGEPLANES_ADD; + break; + } + + case DMD_SLEIC_V2: { uint input_pins[] = {DE, RDATA}; dmdreader_programs_init( &dmd_reader_2bpp_program, dmd_reader_2bpp_program_get_default_config, - &dmd_framedetect_sleic_program, - dmd_framedetect_sleic_program_get_default_config, input_pins, 2, + &dmd_framedetect_sleic_v2_program, + dmd_framedetect_sleic_v2_program_get_default_config, input_pins, 2, DE, SDATA); // load 8192 - 1 pixels directly to TX fifo diff --git a/src/dmdreader.h b/src/dmdreader.h index 58229b5c..1e104077 100644 --- a/src/dmdreader.h +++ b/src/dmdreader.h @@ -37,7 +37,8 @@ enum DmdType : uint8_t { DMD_ISLAND, DMD_HOMEPIN, DMD_SPINBALL, - DMD_SLEIC, + DMD_SLEIC_V1, + DMD_SLEIC_V2, // CAPCOM needs to be the last two entries: DMD_CAPCOM, DMD_CAPCOM_HD, diff --git a/src/pio/dmd_dotloop.pio b/src/pio/dmd_dotloop.pio index 17768d0d..5966b201 100644 --- a/src/pio/dmd_dotloop.pio +++ b/src/pio/dmd_dotloop.pio @@ -181,4 +181,48 @@ dot_check_loop: legit_dot: in pins 1 ; read pin data jmp x-- dotloop +.wrap + +; // ------------------- // +; // dmd_reader_sleic_v1 // +; // ------------------- // + +.program dmd_reader_sleic_v1 +.wrap_target + set y, 31 ; number of rows + mov isr, null ; clear ISR and reset shift counter + + irq clear START_READING_IRQ + wait irq START_READING_IRQ + +row_loop: + set x, 5 ; load number of dots to skip (6) +dot_skip_loop: + wait 0 gpio DOTCLK ; no DOTCLK period or faling edge of the previous + wait 1 gpio DOTCLK + jmp x-- dot_skip_loop ; skip 6 dots + + mov x, osr ; load number of pixels to read (128) + +check_row: + jmp pin msb_row ; Is DE high? + jmp lsb_row ; DE is low -> LSB + +msb_row: + wait 0 gpio DOTCLK ; no DOTCLK period or faling edge of the previous + wait 1 gpio DOTCLK ; rising edge + in pins 1 ; read 1 bit pin data + in null 1 ; padding 0 to the output as Sleic is 2bit/px + jmp x-- msb_row + jmp end + +lsb_row: + wait 0 gpio DOTCLK ; no DOTCLK period or faling edge of the previous + wait 1 gpio DOTCLK ; raising edge + in null 1 ; padding 0 to the output as Sleic is 2bit/px + in pins 1 ; read 1 bit pin data + jmp x-- lsb_row + +end: + jmp y-- row_loop .wrap \ No newline at end of file diff --git a/src/pio/dmd_framedetect_generic.pio b/src/pio/dmd_framedetect_generic.pio index 4e3952bb..602df167 100644 --- a/src/pio/dmd_framedetect_generic.pio +++ b/src/pio/dmd_framedetect_generic.pio @@ -10,7 +10,7 @@ .program dmd_framedetect_generic .wrap_target -; This program is in use by WPC/WPC95, Stern SAM, Stern Whitestar, Gottlieb/Premier, Sega HD and Island +; This program is in use by WPC/WPC95, Sleic V1, Stern SAM, Stern Whitestar, Gottlieb/Premier, Sega HD and Island wait 0 gpio RDATA wait 1 gpio RDATA diff --git a/src/pio/dmd_framedetect_sleic.pio b/src/pio/dmd_framedetect_sleic.pio index c42ebfa0..e5245aef 100644 --- a/src/pio/dmd_framedetect_sleic.pio +++ b/src/pio/dmd_framedetect_sleic.pio @@ -7,9 +7,12 @@ .define FRAME_START_IRQ 5 ; Frame detection program runs in parallel to the reader program and signals the start of a new frame using an IRQ. -.program dmd_framedetect_sleic + +.program dmd_framedetect_sleic_v2 .wrap_target +; This program is in use by Sleic Io Moon + wait_low: mov x, osr ; set x to 6144 wait 0 gpio DE ; Wait for DE to go low