Unable to compile sketchs using the adafuit vs1053.h library with nano 33 BLE

Just swapped a nano 33 iot for a fantastic shiny new 33 BLE for an mp3 player project involving the adafruit VS1053.h library. Unfortunately, the sketch now doesn't compile and or upload to the new board.

I get the following error message:

Arduino: 1.8.15 (Linux), Board: "Arduino Nano 33 BLE"

/home/mike/Arduino/libraries/Adafruit_VS1053_Library/Adafruit_VS1053.cpp: In constructor 'Adafruit_VS1053::Adafruit_VS1053(int8_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':
/home/mike/Arduino/libraries/Adafruit_VS1053_Library/Adafruit_VS1053.cpp:334:16: error: 'portOutputRegister' was not declared in this scope
clkportreg = portOutputRegister(digitalPinToPort(_clk));
^~~~~~~~~~~~~~~~~~
/home/mike/Arduino/libraries/Adafruit_VS1053_Library/Adafruit_VS1053.cpp:335:12: error: 'digitalPinToBitMask' was not declared in this scope
clkpin = digitalPinToBitMask(_clk);
^~~~~~~~~~~~~~~~~~~
/home/mike/Arduino/libraries/Adafruit_VS1053_Library/Adafruit_VS1053.cpp:335:12: note: suggested alternative: 'digitalPinToPinName'
clkpin = digitalPinToBitMask(_clk);
^~~~~~~~~~~~~~~~~~~
digitalPinToPinName
/home/mike/Arduino/libraries/Adafruit_VS1053_Library/Adafruit_VS1053.cpp:336:17: error: 'portInputRegister' was not declared in this scope
misoportreg = portInputRegister(digitalPinToPort(_miso));
^~~~~~~~~~~~~~~~~
exit status 1
Error compiling for board Arduino Nano 33 BLE.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I get the same problem if I try to compile and upload the example sketches that come with the library, and the board is fine compiling sketches that don't use this library so it's definitely a conflict with the VS1053.h library I would say.

I notice from the adafruit forums that there are a number of other well-known libraries that have similar issues.

Is this a known issue and can it be fixed?

Many thanks.

Mike

Welcome to the Forums. This is not really the correct place for this. Please ask a moderator to move it to Programming Questions which would be more appropriate and probably give you better help.

Based on those messages, It may be that the library does not yet support this new board.

Those are macros for converting pin numbers to PORT and BitMask for Direct Register Access on an AVR processor.

It looks like the library has support for the 'SAMD' processor on the "Arduino Nano 33 iot" but doesn't have support for the 'mbed' processor on the "Arduino Nano 33 BLE".

You might be able to work around the problem by adding:

#define portOutputRegister(x) 0
#define portInputRegister(x) 0
#define digitalPinToBitMask(x) 0

before the #include for the library. If that doesn't;t work you will have to make a local copy of the library and comment out the function: Adafruit_VS1053::Adafruit_VS1053(int8_t mosi, int8_t miso, int8_t clk, int8_t rst, int8_t cs, int8_t dcs, int8_t dreq)

Make sure you aren't passing the MOSI, MISO, and SCLK pin numbers to the constructor since that uses those macros. You have to use hardware SPI.

Oh yes, apologies, I'm new to this forum. I can now see now on further inspection that this is not the best place for this post. I'll re-post it. Got some useful feedback though. Many thanks for everyone's time.

Thanks John,

I've tried the two suggestions, but still not loading. I've also contacted adafruit over this as I can use the 33 iot, but would prefer to use the ble, especially as I've just ordered some pcb's for connections that are better suited to the interrupt pins of the ble. More fool me for ordering them before trying out the sketch with the new microcontroller.

Don't; unless you want to upset people for waisting their time :wink: When you are in your topic, there is a big black pencil next to the titcle. Click it and from the dropdown box select the correct category. Next click the green button with the tick to save it.