SPIFlash example fails to compile

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sentientroomba
 
Posts: 15
Joined: Tue Feb 14, 2023 10:53 pm

SPIFlash example fails to compile

Post by sentientroomba »

I recently purchased several W25Q128 DIP QSPI Flash breakouts.
I have been unable to get the example code to work with the Arduino NANO 33 BLE board.
The chip is wired for SPI, and CUSTOM_CS and CUSTOM_SPI are uncommented and set as follows.

Code: Select all

#define CUSTOM_CS   9
#define CUSTOM_SPI  SPI
After attempting to compile, the compiler throws the errors listed below.
It seems like it's being compiled with QSPI functionality, even though it's configured for SPI.
How do I compile for SPI only?

Code: Select all

c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp: In constructor 'Adafruit_FlashTransport_QSPI::Adafruit_FlashTransport_QSPI()':
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:36: error: 'PIN_QSPI_SCK' was not declared in this scope
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                    ^~~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:36: note: suggested alternative: 'PIN_SPI_SCK'
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                    ^~~~~~~~~~~~
                                    PIN_SPI_SCK
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:50: error: 'PIN_QSPI_CS' was not declared in this scope
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                                  ^~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:50: note: suggested alternative: 'PIN_SPI_SS'
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                                  ^~~~~~~~~~~
                                                  PIN_SPI_SS
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:63: error: 'PIN_QSPI_IO0' was not declared in this scope
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                                               ^~~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:32:63: note: suggested alternative: 'PIN_SPI_MISO'
     : Adafruit_FlashTransport_QSPI(PIN_QSPI_SCK, PIN_QSPI_CS, PIN_QSPI_IO0,
                                                               ^~~~~~~~~~~~
                                                               PIN_SPI_MISO
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:36: error: 'PIN_QSPI_IO1' was not declared in this scope
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                    ^~~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:36: note: suggested alternative: 'PIN_SPI_MISO'
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                    ^~~~~~~~~~~~
                                    PIN_SPI_MISO
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:50: error: 'PIN_QSPI_IO2' was not declared in this scope
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                                  ^~~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:50: note: suggested alternative: 'PIN_SPI_MISO'
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                                  ^~~~~~~~~~~~
                                                  PIN_SPI_MISO
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:64: error: 'PIN_QSPI_IO3' was not declared in this scope
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                                                ^~~~~~~~~~~~
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:33:64: note: suggested alternative: 'PIN_SPI_MISO'
                                    PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3) {}
                                                                ^~~~~~~~~~~~
                                                                PIN_SPI_MISO
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp: In member function 'virtual void Adafruit_FlashTransport_QSPI::begin()':
c:\Users\almost\Documents\Arduino\libraries\Adafruit_SPIFlash\src\qspi\Adafruit_FlashTransport_QSPI_NRF.cpp:53:35: error: 'g_ADigitalPinMap' was not declared in this scope
               .sck_pin = (uint8_t)g_ADigitalPinMap[_sck],
                                   ^~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: SPIFlash example fails to compile

Post by mikeysklar »

Oddly enough it looks like a 4.1.1 release for Adafruit SPIFlash came out yesterday.

I was able to build the flashinfo example code using the Adafruit_SPIFlash 4.0.0 library on the Arduino 2.0.4 IDE for a Metro M4 without issue. What is your setup?

User avatar
sentientroomba
 
Posts: 15
Joined: Tue Feb 14, 2023 10:53 pm

Re: SPIFlash example fails to compile

Post by sentientroomba »

I'm using an Arduino NANO 33 BLE with IDE 2.0.4.
The issue appeared in both the 4.0.0 and 4.1.1 release of Adafruit_SPIFlash. I managed to fix it as described in this GitHub issue.
It seems like the library is checking the chip number and using QSPI while the board itself does not support it. Adding a check for QSPI support fixes the issue.
Thanks for responding!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: SPIFlash example fails to compile

Post by mikeysklar »

Cool. Thanks for the work around link and followup.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”