Music maker feather with RP2040 SCORPIO

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jhenges1972
 
Posts: 40
Joined: Wed Mar 29, 2023 12:04 pm

Music maker feather with RP2040 SCORPIO

Post by jhenges1972 »

I purchased two RP2040 SCORPIO boards and two Music Maker Featherwing boards.

After loading the support for the board and the VS1053, I am unable to get the program to work. It complains of
"Couldn't find VS1053, do you have the right pins defined?"

Based on my investigation, I believe the pins are correctly assigned, there is no solder on the MIDI jumper...
I believe it defaults to the last choice in the header file:
#define VS1053_CS 6 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 5 // Card chip select pin
// DREQ should be an Int pin *if possible* (not possible on 32u4)
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin
Based on how it plugs together, I believe this pin numbering matches.

I am attempting to used the "feather_player.ino" sketch (the simplest starting point...)

I just have the two boards attached to each other with the appropriate header/pins arrangement.

I am feeling a little silly that I plugged two boards together and couldn't get this to work :-(

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

Re: Music maker feather with RP2040 SCORPIO

Post by mikeysklar »

Give these pinouts a try with your Scorpio.

Code: Select all

#define VS1053_RESET -1 // VS1053 reset pin (not used!)
#define VS1053_CS 8 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 7 // Card chip select pin
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin
source

User avatar
jhenges1972
 
Posts: 40
Joined: Wed Mar 29, 2023 12:04 pm

Re: Music maker feather with RP2040 SCORPIO

Post by jhenges1972 »

Mike,
Thanks for the reply. Sorry I didn't see it sooner.

I did this and it still didn't work. However, when I put some print statements in the library here is what I got:
(at the beginning of Adafruit_VS1053::begin)
0 ==> MOSI
0 ==> MISO
0 ==> CLK
-1 ==> RESET
8 ==> CS
10 ==> DCS
9 ==> DREQ

Shouldn't MOSI,MISO and CLK have different numbers that what is shown here?

When I look at the CLK, MOSI and MISO pins with an oscilloscope, I see no activity...So it is no surprise there is no response. How does the system know to use those pins?

John

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

Re: Music maker feather with RP2040 SCORPIO

Post by mikeysklar »

Post your full code. There are two ways to initialize which could be the problem here.

If you are using software SPI by passing all the pins MISO/MOSI/CLK would have no values since hardware SPI not being used.

User avatar
jhenges1972
 
Posts: 40
Joined: Wed Mar 29, 2023 12:04 pm

Re: Music maker feather with RP2040 SCORPIO

Post by jhenges1972 »

Mike,
I am using the standard sketch "feather_player.ino" which I am pasting here.

I tried both the original pin assignments and the ones you suggested. Other than that I didn't touch the original code.

The original pin assignments were:
#define VS1053_CS 6 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 5 // Card chip select pin
// DREQ should be an Int pin *if possible* (not possible on 32u4)
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin

Your suggestion was:
#define VS1053_CS 8 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 5 // Card chip select pin
// DREQ should be an Int pin *if possible* (not possible on 32u4)
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin


==================================================================================================

Code: Select all

// Specifically for use with the Adafruit Feather, the pins are pre-set here!

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <SD.h>
#include <Adafruit_VS1053.h>

// These are the pins used
#define VS1053_RESET   -1     // VS1053 reset pin (not used!)

// Feather ESP8266
#if defined(ESP8266A)
  #define VS1053_CS      16     // VS1053 chip select pin (output)
  #define VS1053_DCS     15     // VS1053 Data/command select pin (output)
  #define CARDCS          2     // Card chip select pin
  #define VS1053_DREQ     0     // VS1053 Data request, ideally an Interrupt pin

// Feather ESP32
#elif defined(ESP32) && !defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
  #define VS1053_CS      32     // VS1053 chip select pin (output)
  #define VS1053_DCS     33     // VS1053 Data/command select pin (output)
  #define CARDCS         14     // Card chip select pin
  #define VS1053_DREQ    15     // VS1053 Data request, ideally an Interrupt pin

// Feather Teensy3
#elif defined(TEENSYDUINO)
  #define VS1053_CS       3     // VS1053 chip select pin (output)
  #define VS1053_DCS     10     // VS1053 Data/command select pin (output)
  #define CARDCS          8     // Card chip select pin
  #define VS1053_DREQ     4     // VS1053 Data request, ideally an Interrupt pin

// WICED feather
#elif defined(ARDUINO_STM32_FEATHER)
  #define VS1053_CS       PC7     // VS1053 chip select pin (output)
  #define VS1053_DCS      PB4     // VS1053 Data/command select pin (output)
  #define CARDCS          PC5     // Card chip select pin
  #define VS1053_DREQ     PA15    // VS1053 Data request, ideally an Interrupt pin

#elif defined(ARDUINO_NRF52832_FEATHER )
  #define VS1053_CS       30     // VS1053 chip select pin (output)
  #define VS1053_DCS      11     // VS1053 Data/command select pin (output)
  #define CARDCS          27     // Card chip select pin
  #define VS1053_DREQ     31     // VS1053 Data request, ideally an Interrupt pin

// Feather M4, M0, 328, ESP32S2, nRF52840 or 32u4
#else
  #define VS1053_CS      6       // VS1053 chip select pin (output)
  #define VS1053_DCS     10      // VS1053 Data/command select pin (output)
  #define CARDCS         5       // Card chip select pin
  // DREQ should be an Int pin *if possible* (not possible on 32u4)
  #define VS1053_DREQ    9       // VS1053 Data request, ideally an Interrupt pin

#endif


Adafruit_VS1053_FilePlayer musicPlayer = 
  Adafruit_VS1053_FilePlayer(VS1053_RESET, VS1053_CS, VS1053_DCS, VS1053_DREQ, CARDCS);

void setup() {
  Serial.begin(115200);

  // if you're using Bluefruit or LoRa/RFM Feather, disable the radio module
  //pinMode(8,I tried both  INPUT_PULLUP);

  // Wait for serial port to be opened, remove this line for 'standalone' operation
  while (!Serial) { delay(1); }
  delay(500);
  
  Serial.println("\n\nAdafruit VS1053 Feather Test");
  
  if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }

  Serial.println(F("VS1053 found"));
 
  musicPlayer.sineTest(0x44, 500);    // Make a tone to indicate VS1053 is working
  
  if (!SD.begin(CARDCS)) {
    Serial.println(F("SD failed, or not present"));
    while (1);  // don't do anything more
  }
  Serial.println("SD OK!");
  
  // list files
  printDirectory(SD.open("/"), 0);
  
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(10,10);
  
#if defined(__AVR_ATmega32U4__) 
  // Timer interrupts are not suggested, better to use DREQ interrupt!
  // but we don't have them on the 32u4 feather...
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int
#else
  // If DREQ is on an interrupt pin we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
#endif
  
  // Play a file in the background, REQUIRES interrupts!
  Serial.println(F("Playing full track 001"));
  musicPlayer.playFullFile("/track001.mp3");

  Serial.println(F("Playing track 002"));
  musicPlayer.startPlayingFile("/track002.mp3");
}

void loop() {
  Serial.print(".");
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1) {
      delay(10);  // we're done! do nothing...
    }
  }
  if (Serial.available()) {
    char c = Serial.read();
    
    // if we get an 's' on the serial console, stop!
    if (c == 's') {
      musicPlayer.stopPlaying();
    }
    
    // if we get an 'p' on the serial console, pause/unpause!
    if (c == 'p') {
      if (! musicPlayer.paused()) {
        Serial.println("Paused");
        musicPlayer.pausePlaying(true);
      } else { 
        Serial.println("Resumed");
        musicPlayer.pausePlaying(false);
      }
    }
  }
  delay(100);
}



/// File listing helper
void printDirectory(File dir, int numTabs) {
   while(true) {
     
     File entry =  dir.openNextFile();
     if (! entry) {
       // no more files
       //Serial.println("**nomorefiles**");
       break;
     }
     for (uint8_t i=0; i<numTabs; i++) {
       Serial.print('\t');
     }
     Serial.print(entry.name());
     if (entry.isDirectory()) {
       Serial.println("/");
       printDirectory(entry, numTabs+1);
     } else {
       // files have sizes, directories do not
       Serial.print("\t\t");
       Serial.println(entry.size(), DEC);
     }
     entry.close();
   }
}

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

Re: Music maker feather with RP2040 SCORPIO

Post by mikeysklar »

The CARDCS pin you are using does not match my suggested pin#.

I had requested you try 7, but you still have it set to 5.

Code: Select all

#define CARDCS 7 // Card chip select pin

User avatar
jhenges1972
 
Posts: 40
Joined: Wed Mar 29, 2023 12:04 pm

Re: Music maker feather with RP2040 SCORPIO

Post by jhenges1972 »

Mike,
Sorry, I didn't mention that I HAD tried all the suggestions that you made:

#define VS1053_CS 8 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 7 // Card chip select pin
// DREQ should be an Int pin *if possible* (not possible on 32u4)
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin

It still didn't work:
I still get:
Couldn't find VS1053, do you have the right pins defined?

I haven't tried any of the other player sketches yet as I thought I was starting with the sure thing. I'll try to give those a shot but it will be late tomorrow when I can try them. It really seems as though we are just not actually transferring anything.

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

Re: Music maker feather with RP2040 SCORPIO

Post by mikeysklar »

I think I see some of the confusion. The pins I'm recommending have worked with a Feather RP2040. However, the Scorpio RP2040 does have some different GPIO names being used for the same pin locations. Remember that the GPIO pins is what you are using and the top silkscreen on these boards is for CircuitPython (the bottom is Arduino).

Try this:

Code: Select all

#define VS1053_RESET -1 // VS1053 reset pin (not used!)
#define VS1053_CS 6 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 5 // Card chip select pin
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin
adafruit_products_feather-rp2040-scorpio-prettypins.png
adafruit_products_feather-rp2040-scorpio-prettypins.png (355.18 KiB) Viewed 66 times
Screenshot from 2023-04-18 17-34-01.png
Screenshot from 2023-04-18 17-34-01.png (451.67 KiB) Viewed 66 times

User avatar
jhenges1972
 
Posts: 40
Joined: Wed Mar 29, 2023 12:04 pm

Re: Music maker feather with RP2040 SCORPIO

Post by jhenges1972 »

So, that is what I thought initially when I looked at the pictures and the silk screen on the boards..

However, same results.
#define VS1053_CS 6 // VS1053 chip select pin (output)
#define VS1053_DCS 10 // VS1053 Data/command select pin (output)
#define CARDCS 5 // Card chip select pin
// DREQ should be an Int pin *if possible* (not possible on 32u4)
#define VS1053_DREQ 9 // VS1053 Data request, ideally an Interrupt pin

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

Re: Music maker feather with RP2040 SCORPIO

Post by mikeysklar »

Great. We are back to your initial post, but at least we agree on what the pinouts should be based on the diagram.

Do you need 5v output? I ask because that is an unusual feature with the Scorpio that is a 3v3 processor with level shifters outputting to 5v by default. You can cut the 5v trace on the bottom and solder the 3v jumper pads to see if that effects things.

I recently resolved an issue with a Metro ESP32-S2 using a Music Maker Shield, but I wired up a Feather Music Maker to the Metro as that is what I had. The key was to use the hardware SPI and cut the jumper pads going to additional GPIOS. We use player_simple.ino in that case. You do not have the jumper pads for additional GPIOs to worry about, but hardware SPI with player_simple.ino might be helpful.

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

Return to “Feather - Adafruit's lightweight platform”