Hello,
I have a problem. I am using a Mega 2560 with CC3000 Wifi shield and the Adafruit Music Maker Shield. My problem is if I initialize both shields at once, then I cannot play MP3 files. A sound comes out but more like a gibberish than the actual audio. The audio stops working as soon as I run this command: cc3000.begin()
If I run the cc3000.stop() command then it works again, however the problem with that method is that when I want to use the WiFi shield again then I have to initialize again and reconnect to the access point (which usually takes 10-15 seconds). As I can see both uses PIN 3 as interrupt and I cannot change it. I tried with PIN 2 but it does not seem to work at all. I also thought maybe SD card causes the issue because both shield have SD card slot.
I am a bit hopeless.
Norbert
CC3000 + MP3SHIELD Audio issue
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: CC3000 + MP3SHIELD Audio issue
You will have to re-wire the DREQ on the Music Maker to digital 2. On the bottom of the board, you will see four pairs of solder pads corresponding to digital pins 2, 3, 5, and 6. The pads are connected by thin copper traces. Use something like an X-Acto knife to cut the trace between the Pin 3 pads. Make sure it's cut all the way through.
On the top of the shield, solder a jumper wire between the hole labeled DRQ and the hole adjacent to digital 2. Change the sketch to specify Pin 2 for the music maker:
On the top of the shield, solder a jumper wire between the hole labeled DRQ and the hole adjacent to digital 2. Change the sketch to specify Pin 2 for the music maker:
Code: Select all
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 2 // VS1053 Data request, ideally an Interrupt pin
- ncseffai
- Posts: 7
- Joined: Thu Feb 09, 2017 4:06 pm
Re: CC3000 + MP3SHIELD Audio issue
Hello Rick,
Thanks for the prompt answer. It is good to hear there is a solution. Before I cut something I should not, can you please confirm if I understood correctly what to cut? The red X marks which I believe I should cut.
Thanks for the prompt answer. It is good to hear there is a solution. Before I cut something I should not, can you please confirm if I understood correctly what to cut? The red X marks which I believe I should cut.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: CC3000 + MP3SHIELD Audio issue
Yes, that's correct
- ncseffai
- Posts: 7
- Joined: Thu Feb 09, 2017 4:06 pm
Re: CC3000 + MP3SHIELD Audio issue
Thanks! I made the modifications and it does work now.
However it only works with the playFullFile method. If I use the startPlayingFile method it plays gibberish for half a second and then it stops.
I used this code from the example if the interrupt is correct and it does not give any warning.
Although as I can see the VS1053_FILEPLAYER_PIN_INT is equals to PIN 5 and the CC3000 also uses PIN 5 for the VBAT. I tried to change that, but then CC3000 does not work at all. I also tried to use but that also did not help.
Any suggestions? :)
Norbert
However it only works with the playFullFile method. If I use the startPlayingFile method it plays gibberish for half a second and then it stops.
I used this code from the example if the interrupt is correct and it does not give any warning.
Code: Select all
if (! musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT))
Serial.println(F("DREQ pin is not an interrupt pin"));
}
Code: Select all
musicPlayer.userInterrupt(2)
Any suggestions? :)
Norbert
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: CC3000 + MP3SHIELD Audio issue
Yes. You want to leave that alone. Don't change it to 2.ncseffai wrote:I used this code from the example if the interrupt is correct and it does not give any warning.
CODE: SELECT ALL | TOGGLE FULL SIZE
if (! musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT))
Serial.println(F("DREQ pin is not an interrupt pin"));
}
instead, you want to define DREQ as 2, and pass that into the constructor:
Code: Select all
// 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
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 2 // VS1053 Data request, ideally an Interrupt pin
// create shield-example object!
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
- jim_lee
- Posts: 709
- Joined: Thu May 24, 2012 8:24 pm
Re: CC3000 + MP3SHIELD Audio issue
There is another way not using interrupts..
I use this (close to this at least) to play music in the background.
In your main loop, call this function every 40ms and you're good to go. You still need a DREQ pin, but there's no more interrupt complications. Start songs just as you always have.
hope this helps.
-jim lee
I use this (close to this at least) to play music in the background.
Code: Select all
void soundCard(void) {
if (musicPlayer->playingMusic) {
noInterrupts();
musicPlayer->feedBuffer();
interrupts();
}
}
hope this helps.
-jim lee
- ncseffai
- Posts: 7
- Joined: Thu Feb 09, 2017 4:06 pm
Re: CC3000 + MP3SHIELD Audio issue
Hello Jim/Rick
@Jim: Your code snippet solved the issue! I am very grateful for that. Thank you!
@Rick: I used the pins you recommended, but playing the audio in the background still had intermittent issue (sometime it worked, sometime it did not), but Jim code solved my issue. Thank you for your assistance!
Norbert
@Jim: Your code snippet solved the issue! I am very grateful for that. Thank you!
@Rick: I used the pins you recommended, but playing the audio in the background still had intermittent issue (sometime it worked, sometime it did not), but Jim code solved my issue. Thank you for your assistance!
Norbert
Please be positive and constructive with your questions and comments.