@@ -179,6 +179,12 @@ void SPIClassRP2040::transfer(const void *txbuf, void *rxbuf, size_t count) {
179
179
DEBUGSPI (" SPI::transfer completed\n " );
180
180
}
181
181
182
+ #ifdef PICO_RP2350B
183
+ #define GPIOIRQREGS 6
184
+ #else
185
+ #define GPIOIRQREGS 4
186
+ #endif
187
+
182
188
void SPIClassRP2040::beginTransaction (SPISettings settings) {
183
189
noInterrupts (); // Avoid possible race conditions if IRQ comes in while main app is in middle of this
184
190
DEBUGSPI (" SPI::beginTransaction(clk=%lu, bo=%s)\n " , settings.getClockFreq (), (settings.getBitOrder () == MSBFIRST) ? " MSB" : " LSB" );
@@ -201,7 +207,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
201
207
}
202
208
// Disable any IRQs that are being used for SPI
203
209
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num () ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl ;
204
- DEBUGSPI (" SPI: IRQ masks before = %08x %08x %08x %08x\n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ]);
210
+ DEBUGSPI (" SPI: IRQ masks before = %08x %08x %08x %08x %08x %08x \n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ], (GPIOIRQREGS > 4 ) ? ( unsigned )irq_ctrl_base-> inte [ 4 ] : 0 , (GPIOIRQREGS > 5 ) ? ( unsigned )irq_ctrl_base-> inte [ 5 ] : 0 );
205
211
for (auto entry : _usingIRQs) {
206
212
int gpio = entry.first ;
207
213
@@ -212,7 +218,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
212
218
DEBUGSPI (" SPI: GPIO %d = %lu\n " , gpio, val);
213
219
(*en_reg) ^= val << (4 * (gpio % 8 ));
214
220
}
215
- DEBUGSPI (" SPI: IRQ masks after = %08x %08x %08x %08x\n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ]);
221
+ DEBUGSPI (" SPI: IRQ masks after = %08x %08x %08x %08x %08x %08x \n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ], (GPIOIRQREGS > 4 ) ? ( unsigned )irq_ctrl_base-> inte [ 4 ] : 0 , (GPIOIRQREGS > 5 ) ? ( unsigned )irq_ctrl_base-> inte [ 5 ] : 0 );
216
222
interrupts ();
217
223
}
218
224
@@ -227,7 +233,7 @@ void SPIClassRP2040::endTransaction(void) {
227
233
}
228
234
io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num () ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl ;
229
235
(void ) irq_ctrl_base;
230
- DEBUGSPI (" SPI: IRQ masks = %08x %08x %08x %08x\n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ]);
236
+ DEBUGSPI (" SPI: IRQ masks = %08x %08x %08x %08x %08x %08x \n " , (unsigned )irq_ctrl_base->inte [0 ], (unsigned )irq_ctrl_base->inte [1 ], (unsigned )irq_ctrl_base->inte [2 ], (unsigned )irq_ctrl_base->inte [3 ], (GPIOIRQREGS > 4 ) ? ( unsigned )irq_ctrl_base-> inte [ 4 ] : 0 , (GPIOIRQREGS > 5 ) ? ( unsigned )irq_ctrl_base-> inte [ 5 ] : 0 );
231
237
interrupts ();
232
238
}
233
239
0 commit comments