Bladeren bron

Basic GPIO expander using the ESP32 I2S peripheral (#12959)

Simon Jouet 5 jaren geleden
bovenliggende
commit
5cd0fa3ce1

+ 2
- 0
Marlin/src/HAL/HAL_ESP32/HAL.cpp Bestand weergeven

@@ -85,6 +85,8 @@ void HAL_init(void) {
85 85
   #if ENABLED(WIFISUPPORT)
86 86
     OTA_init();
87 87
   #endif
88
+
89
+  i2s_init();
88 90
 }
89 91
 
90 92
 void HAL_idletask(void) {

+ 2
- 1
Marlin/src/HAL/HAL_ESP32/HAL.h Bestand weergeven

@@ -31,7 +31,7 @@
31 31
 #include <stdint.h>
32 32
 
33 33
 #undef DISABLED
34
-#undef _BV
34
+#undef M_PI
35 35
 
36 36
 #include <Arduino.h>
37 37
 
@@ -43,6 +43,7 @@
43 43
 
44 44
 #include "fastio_ESP32.h"
45 45
 #include "watchdog_ESP32.h"
46
+#include "i2s.h"
46 47
 
47 48
 #include "HAL_timers_ESP32.h"
48 49
 

+ 1
- 1
Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp Bestand weergeven

@@ -113,7 +113,7 @@ void HAL_timer_start(const uint8_t timer_num, uint32_t frequency) {
113 113
   const tTimerConfig timer = TimerConfig[timer_num];
114 114
 
115 115
   timer_config_t config;
116
-  config.divider     = STEPPER_TIMER_PRESCALE;
116
+  config.divider     = timer.divider;
117 117
   config.counter_dir = TIMER_COUNT_UP;
118 118
   config.counter_en  = TIMER_PAUSE;
119 119
   config.alarm_en    = TIMER_ALARM_EN;

+ 9
- 3
Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h Bestand weergeven

@@ -43,9 +43,15 @@ typedef uint64_t hal_timer_t;
43 43
 
44 44
 #define HAL_TIMER_RATE APB_CLK_FREQ // frequency of timer peripherals
45 45
 
46
-#define STEPPER_TIMER_PRESCALE     40
47
-#define STEPPER_TIMER_RATE         (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz
48
-#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000)          // stepper timer ticks per µs
46
+#if ENABLED(I2S_STEPPER_STREAM)
47
+  #define STEPPER_TIMER_PRESCALE     1
48
+  #define STEPPER_TIMER_RATE         250000                           // 250khz, 4us pulses of i2s word clock
49
+  #define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs // wrong would be 0.25
50
+#else
51
+  #define STEPPER_TIMER_PRESCALE     40
52
+  #define STEPPER_TIMER_RATE         (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // frequency of stepper timer, 2MHz
53
+  #define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000)          // stepper timer ticks per µs
54
+#endif
49 55
 
50 56
 #define STEP_TIMER_MIN_INTERVAL   8 // minimum time in µs between stepper interrupts
51 57
 

+ 18
- 16
Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h Bestand weergeven

@@ -21,38 +21,40 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
+#include "i2s.h"
25
+
24 26
 /**
25 27
  * Utility functions
26 28
  */
27 29
 
28
-// set pin as input
29
-#define _SET_INPUT(IO)      pinMode(IO, INPUT)
30
+// Set pin as input
31
+#define _SET_INPUT(IO)        pinMode(IO, INPUT)
30 32
 
31
-// set pin as output
32
-#define _SET_OUTPUT(IO)     pinMode(IO, OUTPUT)
33
+// Set pin as output
34
+#define _SET_OUTPUT(IO)       pinMode(IO, OUTPUT)
33 35
 
34
-// set pin as input with pullup mode
35
-#define _PULLUP(IO, v)      pinMode(IO, v ? INPUT_PULLUP : INPUT)
36
+// Set pin as input with pullup mode
37
+#define _PULLUP(IO, v)        pinMode(IO, v ? INPUT_PULLUP : INPUT)
36 38
 
37 39
 // Read a pin wrapper
38
-#define READ(IO)            digitalRead(IO)
40
+#define READ(IO)              digitalRead(IO)
39 41
 
40 42
 // Write to a pin wrapper
41
-#define WRITE(IO, v)        digitalWrite(IO, v)
43
+#define WRITE(IO, v)          (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v))
42 44
 
43
-// set pin as input wrapper
44
-#define SET_INPUT(IO)       _SET_INPUT(IO)
45
+// Set pin as input wrapper
46
+#define SET_INPUT(IO)         _SET_INPUT(IO)
45 47
 
46
-// set pin as input with pullup wrapper
47
-#define SET_INPUT_PULLUP(IO) do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
48
+// Set pin as input with pullup wrapper
49
+#define SET_INPUT_PULLUP(IO)  do{ _SET_INPUT(IO); _PULLUP(IO, HIGH); }while(0)
48 50
 
49
-// set pin as output wrapper
50
-#define SET_OUTPUT(IO)  do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0)
51
+// Set pin as output wrapper
52
+#define SET_OUTPUT(IO)        do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0)
51 53
 
52
-#define OUT_WRITE(IO,V)         do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
54
+#define OUT_WRITE(IO,V)       do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0)
53 55
 
54 56
 //
55
-// ports and functions
57
+// Ports and functions
56 58
 //
57 59
 
58 60
 // UART

+ 322
- 0
Marlin/src/HAL/HAL_ESP32/i2s.cpp Bestand weergeven

@@ -0,0 +1,322 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#ifdef ARDUINO_ARCH_ESP32
23
+
24
+#include <Arduino.h> // replace that with the proper imports
25
+#include "i2s.h"
26
+#include "../../core/macros.h"
27
+#include "driver/periph_ctrl.h"
28
+#include "rom/lldesc.h"
29
+#include "soc/i2s_struct.h"
30
+#include "freertos/queue.h"
31
+#include "../../module/stepper.h"
32
+
33
+#define DMA_BUF_COUNT 8                                // number of DMA buffers to store data
34
+#define DMA_BUF_LEN   4092                             // maximum size in bytes
35
+#define I2S_SAMPLE_SIZE 4                              // 4 bytes, 32 bits per sample
36
+#define DMA_SAMPLE_COUNT DMA_BUF_LEN / I2S_SAMPLE_SIZE // number of samples per buffer
37
+
38
+typedef enum {
39
+  I2S_NUM_0 = 0x0,  /*!< I2S 0*/
40
+  I2S_NUM_1 = 0x1,  /*!< I2S 1*/
41
+  I2S_NUM_MAX,
42
+} i2s_port_t;
43
+
44
+typedef struct {
45
+  uint32_t     **buffers;
46
+  uint32_t     *current;
47
+  uint32_t     rw_pos;
48
+  lldesc_t     **desc;
49
+  xQueueHandle queue;
50
+} i2s_dma_t;
51
+
52
+static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX] = {portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED};
53
+static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0, &I2S1};
54
+static i2s_dma_t dma;
55
+
56
+// output value
57
+uint32_t i2s_port_data;
58
+
59
+#define I2S_ENTER_CRITICAL()  portENTER_CRITICAL(&i2s_spinlock[i2s_num])
60
+#define I2S_EXIT_CRITICAL()   portEXIT_CRITICAL(&i2s_spinlock[i2s_num])
61
+
62
+static inline void gpio_matrix_out_check(uint32_t gpio, uint32_t signal_idx, bool out_inv, bool oen_inv) {
63
+  //if pin = -1, do not need to configure
64
+  if (gpio != -1) {
65
+    PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO);
66
+    gpio_set_direction((gpio_num_t)gpio, (gpio_mode_t)GPIO_MODE_DEF_OUTPUT);
67
+    gpio_matrix_out(gpio, signal_idx, out_inv, oen_inv);
68
+  }
69
+}
70
+
71
+static esp_err_t i2s_reset_fifo(i2s_port_t i2s_num) {
72
+  I2S_ENTER_CRITICAL();
73
+  I2S[i2s_num]->conf.rx_fifo_reset = 1;
74
+  I2S[i2s_num]->conf.rx_fifo_reset = 0;
75
+  I2S[i2s_num]->conf.tx_fifo_reset = 1;
76
+  I2S[i2s_num]->conf.tx_fifo_reset = 0;
77
+  I2S_EXIT_CRITICAL();
78
+
79
+  return ESP_OK;
80
+}
81
+
82
+esp_err_t i2s_start(i2s_port_t i2s_num) {
83
+  //start DMA link
84
+  I2S_ENTER_CRITICAL();
85
+  i2s_reset_fifo(i2s_num);
86
+
87
+  //reset dma
88
+  I2S[i2s_num]->lc_conf.in_rst = 1;
89
+  I2S[i2s_num]->lc_conf.in_rst = 0;
90
+  I2S[i2s_num]->lc_conf.out_rst = 1;
91
+  I2S[i2s_num]->lc_conf.out_rst = 0;
92
+
93
+  I2S[i2s_num]->conf.tx_reset = 1;
94
+  I2S[i2s_num]->conf.tx_reset = 0;
95
+  I2S[i2s_num]->conf.rx_reset = 1;
96
+  I2S[i2s_num]->conf.rx_reset = 0;
97
+
98
+  I2S[i2s_num]->int_clr.val = 0xFFFFFFFF;
99
+  I2S[i2s_num]->out_link.start = 1;
100
+  I2S[i2s_num]->conf.tx_start = 1;
101
+  I2S_EXIT_CRITICAL();
102
+
103
+  return ESP_OK;
104
+}
105
+
106
+esp_err_t i2s_stop(i2s_port_t i2s_num) {
107
+  I2S_ENTER_CRITICAL();
108
+  I2S[i2s_num]->out_link.stop = 1;
109
+  I2S[i2s_num]->conf.tx_start = 0;
110
+
111
+  I2S[i2s_num]->int_clr.val = I2S[i2s_num]->int_st.val; //clear pending interrupt
112
+  I2S_EXIT_CRITICAL();
113
+
114
+  return ESP_OK;
115
+}
116
+
117
+static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
118
+  int dummy;
119
+  lldesc_t *finish_desc;
120
+  portBASE_TYPE high_priority_task_awoken = pdFALSE;
121
+
122
+  if (I2S0.int_st.out_eof) {
123
+    // Get the descriptor of the last item in the linkedlist
124
+    finish_desc = (lldesc_t*) I2S0.out_eof_des_addr;
125
+
126
+    // If the queue is full it's because we have an underflow,
127
+    // more than buf_count isr without new data, remove the front buffer
128
+    if (xQueueIsQueueFullFromISR(dma.queue))
129
+      xQueueReceiveFromISR(dma.queue, &dummy, &high_priority_task_awoken);
130
+
131
+    xQueueSendFromISR(dma.queue, (void *)(&finish_desc->buf), &high_priority_task_awoken);
132
+  }
133
+
134
+  if (high_priority_task_awoken == pdTRUE) portYIELD_FROM_ISR();
135
+
136
+  // clear interrupt
137
+  I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt
138
+}
139
+
140
+void stepperTask(void* parameter) {
141
+  uint32_t i, remaining = 0;
142
+
143
+  while (1) {
144
+    xQueueReceive(dma.queue, &dma.current, portMAX_DELAY);
145
+    dma.rw_pos = 0;
146
+
147
+    for (i = 0; i < DMA_SAMPLE_COUNT; i++) {
148
+      // Fill with the port data post pulse_phase until the next step
149
+      if (remaining) {
150
+        i2s_push_sample();
151
+        remaining--;
152
+      }
153
+      else {
154
+        Stepper::stepper_pulse_phase_isr();
155
+        remaining = Stepper::stepper_block_phase_isr();
156
+      }
157
+    }
158
+  }
159
+}
160
+
161
+int i2s_init() {
162
+  periph_module_enable(PERIPH_I2S0_MODULE);
163
+
164
+  /**
165
+   * Each i2s transfer will take 
166
+   *   fpll = PLL_D2_CLK      -- clka_en = 0
167
+   * 
168
+   *   fi2s = fpll / N + b/a  -- N = clkm_div_num
169
+   *   fi2s = 160MHz / 2
170
+   *   fi2s = 80MHz
171
+   *   
172
+   *   fbclk = fi2s / M   -- M = tx_bck_div_num
173
+   *   fbclk = 80MHz / 2
174
+   *   fbclk = 40MHz
175
+   * 
176
+   *   fwclk = fbclk / 32
177
+   * 
178
+   *   for fwclk = 250kHz (4uS pulse time)
179
+   *      N = 10
180
+   *      M = 20
181
+   */
182
+
183
+  // Allocate the array of pointers to the buffers
184
+  dma.buffers = (uint32_t **)malloc(sizeof(uint32_t*) * DMA_BUF_COUNT);
185
+  if (dma.buffers == NULL) return -1;
186
+
187
+  // Allocate each buffer that can be used by the DMA controller
188
+  for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
189
+    dma.buffers[buf_idx] = (uint32_t*) heap_caps_calloc(1, DMA_BUF_LEN, MALLOC_CAP_DMA);
190
+    if (dma.buffers[buf_idx] == NULL) return -1;
191
+  }
192
+
193
+  // Allocate the array of DMA descriptors
194
+  dma.desc = (lldesc_t**) malloc(sizeof(lldesc_t*) * DMA_BUF_COUNT);
195
+  if (dma.desc == NULL) return -1;
196
+
197
+  // Allocate each DMA descriptor that will be used by the DMA controller
198
+  for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
199
+    dma.desc[buf_idx] = (lldesc_t*) heap_caps_malloc(sizeof(lldesc_t), MALLOC_CAP_DMA);
200
+    if (dma.desc[buf_idx] == NULL) return -1;
201
+  }
202
+
203
+  // Initialize
204
+  for (int buf_idx = 0; buf_idx < DMA_BUF_COUNT; buf_idx++) {
205
+    dma.desc[buf_idx]->owner = 1;
206
+    dma.desc[buf_idx]->eof = 1; // set to 1 will trigger the interrupt
207
+    dma.desc[buf_idx]->sosf = 0;
208
+    dma.desc[buf_idx]->length = DMA_BUF_LEN;
209
+    dma.desc[buf_idx]->size = DMA_BUF_LEN;
210
+    dma.desc[buf_idx]->buf = (uint8_t *) dma.buffers[buf_idx];
211
+    dma.desc[buf_idx]->offset = 0;
212
+    dma.desc[buf_idx]->empty = (uint32_t)((buf_idx < (DMA_BUF_COUNT - 1)) ? (dma.desc[buf_idx + 1]) : dma.desc[0]);
213
+  }
214
+
215
+  dma.queue = xQueueCreate(DMA_BUF_COUNT, sizeof(uint32_t *));
216
+
217
+  // Set the first DMA descriptor
218
+  I2S0.out_link.addr = (uint32_t)dma.desc[0];
219
+
220
+  // stop i2s
221
+  i2s_stop(I2S_NUM_0);
222
+
223
+  // configure I2S data port interface.
224
+  i2s_reset_fifo(I2S_NUM_0);
225
+
226
+  //reset i2s
227
+  I2S0.conf.tx_reset = 1;
228
+  I2S0.conf.tx_reset = 0;
229
+  I2S0.conf.rx_reset = 1;
230
+  I2S0.conf.rx_reset = 0;
231
+
232
+  //reset dma
233
+  I2S0.lc_conf.in_rst = 1;
234
+  I2S0.lc_conf.in_rst = 0;
235
+  I2S0.lc_conf.out_rst = 1;
236
+  I2S0.lc_conf.out_rst = 0;
237
+
238
+  //Enable and configure DMA
239
+  I2S0.lc_conf.check_owner = 0;
240
+  I2S0.lc_conf.out_loop_test = 0;
241
+  I2S0.lc_conf.out_auto_wrback = 0;
242
+  I2S0.lc_conf.out_data_burst_en = 0;
243
+  I2S0.lc_conf.outdscr_burst_en = 0;
244
+  I2S0.lc_conf.out_no_restart_clr = 0;
245
+  I2S0.lc_conf.indscr_burst_en = 0;
246
+  I2S0.lc_conf.out_eof_mode = 1;
247
+
248
+  I2S0.conf2.lcd_en = 0;
249
+  I2S0.conf2.camera_en = 0;
250
+  I2S0.pdm_conf.pcm2pdm_conv_en = 0;
251
+  I2S0.pdm_conf.pdm2pcm_conv_en = 0;
252
+
253
+  I2S0.fifo_conf.dscr_en = 0;
254
+
255
+  I2S0.conf_chan.tx_chan_mod = 0;
256
+  I2S0.fifo_conf.tx_fifo_mod = 0;
257
+  I2S0.conf.tx_mono = 0;
258
+
259
+  I2S0.conf_chan.rx_chan_mod = 0;
260
+  I2S0.fifo_conf.rx_fifo_mod = 0;
261
+  I2S0.conf.rx_mono = 0;
262
+
263
+  I2S0.fifo_conf.dscr_en = 1; //connect dma to fifo
264
+
265
+  I2S0.conf.tx_start = 0;
266
+  I2S0.conf.rx_start = 0;
267
+
268
+  I2S0.conf.tx_msb_right = 1;
269
+  I2S0.conf.tx_right_first = 1;
270
+
271
+  I2S0.conf.tx_slave_mod = 0; // Master
272
+  I2S0.fifo_conf.tx_fifo_mod_force_en = 1;
273
+
274
+  I2S0.pdm_conf.rx_pdm_en = 0;
275
+  I2S0.pdm_conf.tx_pdm_en = 0;
276
+
277
+  I2S0.conf.tx_short_sync = 0;
278
+  I2S0.conf.rx_short_sync = 0;
279
+  I2S0.conf.tx_msb_shift = 0;
280
+  I2S0.conf.rx_msb_shift = 0;
281
+
282
+  // set clock
283
+  I2S0.clkm_conf.clka_en = 0;       // Use PLL/2 as reference
284
+  I2S0.clkm_conf.clkm_div_num = 10; // minimum value of 2, reset value of 4, max 256
285
+  I2S0.clkm_conf.clkm_div_a = 0;    // 0 at reset, what about divide by 0? (not an issue)
286
+  I2S0.clkm_conf.clkm_div_b = 0;    // 0 at reset
287
+
288
+  // fbck = fi2s / tx_bck_div_num
289
+  I2S0.sample_rate_conf.tx_bck_div_num = 2; // minimum value of 2 defaults to 6
290
+
291
+  // Enable TX interrupts
292
+  I2S0.int_ena.out_eof = 1;
293
+  I2S0.int_ena.out_dscr_err = 0;
294
+  I2S0.int_ena.out_total_eof = 0;
295
+  I2S0.int_ena.out_done = 0;
296
+
297
+  // Allocate and Enable the I2S interrupt
298
+  intr_handle_t i2s_isr_handle;
299
+  esp_intr_alloc(ETS_I2S0_INTR_SOURCE, 0, i2s_intr_handler_default, NULL, &i2s_isr_handle);
300
+  esp_intr_enable(i2s_isr_handle);
301
+
302
+  // Create the task that will feed the buffer
303
+  xTaskCreate(stepperTask, "StepperTask", 10000, NULL, 1, NULL);
304
+
305
+  // Route the i2s pins to the appropriate GPIO
306
+  gpio_matrix_out_check(22, I2S0O_DATA_OUT23_IDX, 0, 0);
307
+  gpio_matrix_out_check(25, I2S0O_WS_OUT_IDX, 0, 0);
308
+  gpio_matrix_out_check(26, I2S0O_BCK_OUT_IDX, 0, 0);
309
+
310
+  // Start the I2S peripheral
311
+  return i2s_start(I2S_NUM_0);
312
+}
313
+
314
+void i2s_write(uint8_t pin, uint8_t val) {
315
+  SET_BIT_TO(i2s_port_data, pin, val);
316
+}
317
+
318
+void i2s_push_sample() {
319
+  dma.current[dma.rw_pos++] = i2s_port_data;
320
+}
321
+
322
+#endif // ARDUINO_ARCH_ESP32

+ 31
- 0
Marlin/src/HAL/HAL_ESP32/i2s.h Bestand weergeven

@@ -0,0 +1,31 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+// current value of the outputs provided over i2s
25
+extern uint32_t i2s_port_data;
26
+
27
+int i2s_init();
28
+
29
+void i2s_write(uint8_t pin, uint8_t val);
30
+
31
+void i2s_push_sample();

+ 11
- 7
Marlin/src/module/stepper.cpp Bestand weergeven

@@ -1474,7 +1474,12 @@ void Stepper::stepper_pulse_phase_isr() {
1474 1474
       #endif
1475 1475
     #endif
1476 1476
 
1477
-    #if MINIMUM_STEPPER_PULSE
1477
+    #if ENABLED(I2S_STEPPER_STREAM)
1478
+      i2s_push_sample();
1479
+    #endif
1480
+
1481
+    // TODO: need to deal with MINIMUM_STEPPER_PULSE over i2s
1482
+    #if MINIMUM_STEPPER_PULSE && DISABLED(I2S_STEPPER_STREAM)
1478 1483
       // Just wait for the requested pulse duration
1479 1484
       while (HAL_timer_get_count(PULSE_TIMER_NUM) < pulse_end) { /* nada */ }
1480 1485
     #endif
@@ -2143,12 +2148,11 @@ void Stepper::init() {
2143 2148
     E_AXIS_INIT(5);
2144 2149
   #endif
2145 2150
 
2146
-  // Init Stepper ISR to 122 Hz for quick starting
2147
-  HAL_timer_start(STEP_TIMER_NUM, 122);
2148
-
2149
-  ENABLE_STEPPER_DRIVER_INTERRUPT();
2150
-
2151
-  sei();
2151
+  #if DISABLED(I2S_STEPPER_STREAM)
2152
+    HAL_timer_start(STEP_TIMER_NUM, 122); // Init Stepper ISR to 122 Hz for quick starting
2153
+    ENABLE_STEPPER_DRIVER_INTERRUPT();
2154
+    sei();
2155
+  #endif
2152 2156
 
2153 2157
   // Init direction bits for first moves
2154 2158
   last_direction_bits = 0

+ 12
- 12
Marlin/src/pins/pins_ESP32.h Bestand weergeven

@@ -36,24 +36,24 @@
36 36
 //
37 37
 // Steppers
38 38
 //
39
-#define X_STEP_PIN         27
40
-#define X_DIR_PIN          26
41
-#define X_ENABLE_PIN       25
39
+#define X_STEP_PIN         128
40
+#define X_DIR_PIN          129
41
+#define X_ENABLE_PIN       130
42 42
 //#define X_CS_PIN            0
43 43
 
44
-#define Y_STEP_PIN         33
45
-#define Y_DIR_PIN          32
46
-#define Y_ENABLE_PIN       X_ENABLE_PIN
44
+#define Y_STEP_PIN         131
45
+#define Y_DIR_PIN          132
46
+#define Y_ENABLE_PIN       133
47 47
 //#define Y_CS_PIN           13
48 48
 
49
-#define Z_STEP_PIN         14
50
-#define Z_DIR_PIN          12
51
-#define Z_ENABLE_PIN       X_ENABLE_PIN
49
+#define Z_STEP_PIN         134
50
+#define Z_DIR_PIN          135
51
+#define Z_ENABLE_PIN       136
52 52
 //#define Z_CS_PIN            5 // SS_PIN
53 53
 
54
-#define E0_STEP_PIN        16
55
-#define E0_DIR_PIN         17
56
-#define E0_ENABLE_PIN      X_ENABLE_PIN
54
+#define E0_STEP_PIN        137
55
+#define E0_DIR_PIN         138
56
+#define E0_ENABLE_PIN      139
57 57
 //#define E0_CS_PIN          21
58 58
 
59 59
 //

+ 4
- 1
platformio.ini Bestand weergeven

@@ -356,7 +356,8 @@ lib_ignore  =
356 356
 platform    = https://github.com/platformio/platform-espressif32.git#feature/stage
357 357
 board       = esp32dev
358 358
 framework   = arduino
359
-upload_port = COM3
359
+upload_speed = 115200
360
+monitor_speed = 115200
360 361
 lib_ignore  =
361 362
   LiquidCrystal_I2C
362 363
   LiquidCrystal
@@ -364,6 +365,8 @@ lib_ignore  =
364 365
   LiquidTWI2
365 366
   TMC26XStepper
366 367
   c1921b4
368
+  SailfishLCD
369
+  SailfishRGB_LED
367 370
 src_filter  = ${common.default_src_filter} +<src/HAL/HAL_ESP32>
368 371
 
369 372
 #

Laden…
Annuleren
Opslaan