diff dac.pio @ 27:e1d8fe3e418a

Run PIOs at 1x with delays and sync. Can now use a single trigger to set both DAC & ctrl. DAC [still] jitters against the ctrl though..
author Daniel O'Connor <darius@dons.net.au>
date Wed, 26 Feb 2025 11:03:59 +1030
parents 6070d2e66b4c
children 600a394629e6
line wrap: on
line diff
--- a/dac.pio	Tue Feb 25 17:03:51 2025 +1030
+++ b/dac.pio	Wed Feb 26 11:03:59 2025 +1030
@@ -3,9 +3,7 @@
 ;
 
 .program dac
-.define DAC_IRQ 0
-.define DAC_TRIGGER_IRQ 0
-.define CTRL_TRIGGER_IRQ 1
+.define TRIGGER_IRQ 0
 ; Need 1 side set pin, the clock
 .side_set 1
 
@@ -13,20 +11,18 @@
     mov pins, null side 0
     nop side 1
 ; Wait for start trigger and clear IRQ
-    wait 1 irq DAC_TRIGGER_IRQ side 0
-; Trigger the control SM
-    irq nowait CTRL_TRIGGER_IRQ side 0
+    wait 1 irq TRIGGER_IRQ side 0
 ; Clock DAC and write data from the FIFO
 ; DAC clocks data in on the rising clock edge
 .wrap_target
-    out pins 8 side 0
-    nop side 1
-    out pins 8 side 0
-    nop side 1
-    out pins 8 side 0
-    nop side 1
-    out pins 8 side 0
-    nop side 1
+    out pins 8 side 0 [1]
+    nop side 1        [1]
+    out pins 8 side 0 [1]
+    nop side 1        [1]
+    out pins 8 side 0 [1]
+    nop side 1        [1]
+    out pins 8 side 0 [1]
+    nop side 1        [1]
 .wrap
 
 % c-sdk {
@@ -57,8 +53,7 @@
 
     sm_config_set_clkdiv(&c, clkdiv);
 
-    // Load our configuration, and start the program from the beginning
+    // Load our configuration
     pio_sm_init(pio, sm, offset, &c);
-    pio_sm_set_enabled(pio, sm, true);
 }
 %}