IMPORTANT: This errata applies only to boards with versions 0.3 and lower.
Versions 0.4 and higher are fixed and work as expected.
We hate it when we make mistakes but we are only human and sometimes things like this slips through (although we’re sort of embarrassed by this one). If this affects your design at all get in touch with us and we’ll try to help out as much as we can. In the mean while this errata might help you to move along with your project.
Errata
Our basic Challenger RP2040 WiFi board unfortunately have a bug associated with the SPI bus. The SDI pin (MISO) is incorrectly mapped to the RP2040 pin GPIO24 and that pin can not be used together with the SPI0 channel that we are using as the external SPI interface.
A new version (0.4) of the board is in the works where this problem will be fixed.
Note that this only applies to the Challenger RP2040 WiFi board, no other boards are affected by this bug.
Workaround
Now due to the flexibility of the RP2040 the SPI interface can still be used by shuffling the pins around a bit.
Arduino
If you are developing code using the Arduino environment one solution is to remap the SDI pin to another available pin that can be used by the SPI interface. The following RP2040 pins can be used for this purpose:
- GPIO0 (SDA – Used by the I2C interface)
- GPIO4 (RP2040_TXD – Connected to the UART TXD line to the WiFi module)
- GPIO16 (TXD – Connected to external UART TXD line)
- GPIO20 (Not connected anywhere, this is the pin that will be used as SDI on the next version bord)
We would suggest using GPIO0 which is also used by the SDA pin of the I2C interface. If you are also using the I2C interface this can also be moved to pins GPIO8 (D11) and GPIO9 (D12).
// Remap SDI pin of SPI0
// This assigns the SDI pin function to the physical SDA pin of the board
SPI.setRX(PIN_WIRE0_SDA);
SPI.begin();
// Now if you want to use the I2C interface you can move it to pins D11 and D12
Wire.setSDA(D11);
Wire.setSCL(D12);
Wire.begin();
Another solution can be to use GPIO16 (TX) and then use a PIOSerial line to replace the UART which can be placed on any two lines.
// Remap SDI pin of SPI0
// This assigns the SDI pin function to the physical TX pin of the board
SPI.setRX(PIN_SERIAL1_TX);
SPI.begin();
// Create new PIOSerial port assigned to pins D11 (TX) and D12 (RX)
SerialPIO *PIOUart = new SerialPIO(D11, D12);
PIOUart->begin(115200);
CircuitPython
If you are using CircuitPython and need to use the SPI bus the approach is similiar to that of Arduino. The SPI SDI pi nneed to be reassigned to one of the supporting pins, in the example below we used the same pin as in the first Arduino example (GPIO0 – SDA pin).
# Remap SDI pin of SPI0
# This assigns the SDI pin function to the physical SDA pin of the board
spi = busio.SPI(board.SCK, MISO=board.GP0)
# Now if you want to use the I2C interface you can move it to pins D11 and D12
i2c = busio.I2C(scl=board.D12, sda=board.D11)
As far as we know CircuitPython does not yet support PIO Uarts so we can not suggest this at this point.
However it is still possible to remap UART0 to pins A2 and A3 allowing pin TXD to be used for SPI serial data input (SDI).
0 Comments for “Challenger RP2040 WiFi SPI bug”