11.program lpc_bus_sniffer
22;.side_set 1 opt ; [DEBUG] side_set <count> (opt) (pindirs)
33
4- .define NIBBLE_LOOP_COUNT 6
4+ .define NIBBLE_LOOP_COUNT 4
55
66pull ; Get the filter from TX FIFO to the OSR.
77mov Y, OSR ; Copy OSR to Y.
@@ -11,7 +11,21 @@ mov ISR, null ; Clean the ISR.
1111set X, (NIBBLE_LOOP_COUNT - 1) ; Set the value to X register.
1212wait 0 pin 5 ; Wait until the LFRAME pin goes low.
1313
14- ; Get 6 nibble (START + CY/DR + ADDR[3-0])
14+ ; Get START
15+ wait 0 pin 4 ; Wait until the LCLK pin goes low.
16+ in pins, 4 ; Read START.
17+ wait 1 pin 4 ; Wait until the LCLK pin goes high.
18+
19+ ; Get CY/DR
20+ wait 0 pin 4 ; Wait until the LCLK pin goes low.
21+ in pins, 4 ; Read CY/DR.
22+ ; Check if the LFRAME is still low.
23+ jmp pin continue ; If jmp pin is high, jump to continue.
24+ jmp entry_point; ; Jump to start.
25+ continue:
26+ wait 1 pin 4 ; Wait until the LCLK pin goes high.
27+
28+ ; Get 4 nibble (ADDR[3-0])
1529read_nibble1:
1630wait 0 pin 4 ; Wait until the LCLK pin goes low.
1731in pins, 4 ; Read the LAD[0-3] pins.
@@ -89,6 +103,9 @@ void lpc_bus_sniffer_program_init(PIO pio, uint sm, uint offset, uint lpc_bus_pi
89103 // Set 'OUT' base pin. To drive the LED's.
90104 sm_config_set_out_pins(&c, led_pin_base, 8);
91105
106+ // Set 'JMP' pin. To read the LFRAME.
107+ sm_config_set_jmp_pin(&c, lpc_bus_pin_base + 5);
108+
92109#ifdef SIDE_PIN
93110 // Set 'SIDESET' base pin. It's for debugging.
94111 sm_config_set_sideset_pins(&c, SIDE_PIN);
0 commit comments