@@ -65,15 +65,18 @@ void logic_analyser_init(PIO pio, uint sm, uint pin_base, uint pin_count, float
65
65
void logic_analyser_arm (PIO pio , uint sm , uint dma_chan , uint32_t * capture_buf , size_t capture_size_words ,
66
66
uint trigger_pin , bool trigger_level ) {
67
67
pio_sm_set_enabled (pio , sm , false);
68
+ // Need to clear _input shift counter_, as well as FIFO, because there may be
69
+ // partial ISR contents left over from a prevoius run. sm_restart does this.
68
70
pio_sm_clear_fifos (pio , sm );
71
+ pio_sm_restart (pio , sm );
69
72
70
73
dma_channel_config c = dma_channel_get_default_config (dma_chan );
71
74
channel_config_set_read_increment (& c , false);
72
75
channel_config_set_write_increment (& c , true);
73
76
channel_config_set_dreq (& c , pio_get_dreq (pio , sm , false));
74
77
75
78
dma_channel_configure (dma_chan , & c ,
76
- capture_buf , // Destinatinon pointer
79
+ capture_buf , // Destination pointer
77
80
& pio -> rxf [sm ], // Source pointer
78
81
capture_size_words , // Number of transfers
79
82
true // Start immediately
0 commit comments