@@ -179,6 +179,12 @@ void SPIClassRP2040::transfer(const void *txbuf, void *rxbuf, size_t count) {
179179 DEBUGSPI (" SPI::transfer completed\n " );
180180}
181181
182+ #ifdef PICO_RP2350B
183+ #define GPIOIRQREGS 6
184+ #else
185+ #define GPIOIRQREGS 4
186+ #endif
187+
182188void SPIClassRP2040::beginTransaction (SPISettings settings) {
183189 noInterrupts (); // Avoid possible race conditions if IRQ comes in while main app is in middle of this
184190 DEBUGSPI (" SPI::beginTransaction(clk=%lu, bo=%s)\n " , settings.getClockFreq (), (settings.getBitOrder () == MSBFIRST) ? " MSB" : " LSB" );
@@ -201,7 +207,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
201207 }
202208 // Disable any IRQs that are being used for SPI
203209 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 );
205211 for (auto entry : _usingIRQs) {
206212 int gpio = entry.first ;
207213
@@ -212,7 +218,7 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
212218 DEBUGSPI (" SPI: GPIO %d = %lu\n " , gpio, val);
213219 (*en_reg) ^= val << (4 * (gpio % 8 ));
214220 }
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 );
216222 interrupts ();
217223}
218224
@@ -227,7 +233,7 @@ void SPIClassRP2040::endTransaction(void) {
227233 }
228234 io_bank0_irq_ctrl_hw_t *irq_ctrl_base = get_core_num () ? &iobank0_hw->proc1_irq_ctrl : &iobank0_hw->proc0_irq_ctrl ;
229235 (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 );
231237 interrupts ();
232238}
233239
0 commit comments