Music Maker and GPIOs

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
RalfG
 
Posts: 4
Joined: Sun Aug 03, 2014 5:31 am

Music Maker and GPIOs

Post by RalfG »

I have two questions on GPIO usage with the Music Maker shield. I am using it with Arduino Uno.

First I am not sure which Arduino GPIOs are used by the shield. At the moment I am using 2, 8 and 9 for my needs and this works. I have tried 10, but this is accessed by some routine while setup, I suspect the SD card functions.
It would be helpful to have this documented more detailed in the manual.

And my second problem are the onboard GPIOs. If I start the player in interrupt mode and make read access to one of the GPIOs while loop() then the player stops after some seconds. Without access on the GPIOs the player works as expected. I have condensed the code to the relevant parts, here is the code that does not work for me, if I comment out the musicPlayer.GPIO_digitalRead(1) line, then it works. Did I miss something?

Code: Select all

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

// These are the pins used for the music maker shield
#define SHIELD_RESET  -1     // VS1053 reset pin (unused!)
#define SHIELD_CS      7     // VS1053 chip select pin (output)
#define SHIELD_DCS     6     // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield
#define CARDCS 4     // Card chip select pin
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer = 
  // create shield object
  Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);


int x;
char CurrentFileName[]="trac0004.mp3";

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

  // initialise the music player
  if (! musicPlayer.begin())
  { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }

  if (!SD.begin(CARDCS))
  {
    Serial.println(F("SD-Karte defekt oder fehlt."));
  }

  musicPlayer.setVolume(0,0);

  if (! musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT))
    Serial.println(F("DREQ pin is not an interrupt pin"));
}

void loop()
{
  if(!musicPlayer.playingMusic)
  {
    musicPlayer.startPlayingFile(CurrentFileName);
  }

  x=musicPlayer.GPIO_digitalRead(1);
  delay(10);  
}

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Music Maker and GPIOs

Post by adafruit_support_rick »

The shield uses the SPI pins, 11, 12, and 13, and it uses 7, 6, 4, and 3.

I'll check on the GPIO access

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Music Maker and GPIOs

Post by adafruit2 »

We haven't tried GPIO access during playback but yeah it could be that the internal firmware of the VS1053 does not support GPIO access and playback. I think they designed the chip with the expectation that you press a button (on the GPIO) and it activates playback. its kind of an 'extra' that we have working but haven't done a lot with

RalfG
 
Posts: 4
Joined: Sun Aug 03, 2014 5:31 am

Re: Music Maker and GPIOs

Post by RalfG »

Thank you very much for your answers. If I know that it "works as designed" I have no problem with it. I am using the Music Maker GPIO now only while not playing and this works. And I had GPIO 5 of Arduino still left.

My little project is finished now, I have replaced the car cassette drive of an old "Bimbo Box" (look at Youtube) with the Music Maker shield and adafruit's 20W amplifier. The program checks the coin checking device (with debouncing), counts the coins, controls the motor by a relay card, plays music and stores the position in the arduino's eeprom (with primitive wear leveling), can play in random order and checks a cancel button to jump to the next track. It seems to work stable. If someone is interested in the code I could it put on a website (but my comments are mostly in German).

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Music Maker and GPIOs

Post by adafruit_support_rick »

How about some pictures?

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

Return to “Arduino Shields from Adafruit”