Adafruit Music Maker Shield and OLED conflict

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mikarmin
 
Posts: 19
Joined: Mon Oct 03, 2022 5:23 pm

Adafruit Music Maker Shield and OLED conflict

Post by mikarmin »

All, Using the Adafruit Music Maker Shield with an Arduino Uno Rev3 board. Have several 128x64 OLED screens supported by the Adafruit_SSD1306.h library. They use I2C communication with 0x3C address by default. I stack the shield onto the Uno. I can run example code from either library (Adafruit_VS1053.h for music maker) and get functionality of music or screen. When I take the player_simple code and add in the OLED to display text on screen rather than the serial monitor, the program hangs when using the begin method. Here are the basic declarations.

// These are the pins used for the music maker shield
#define MP3_RESET -1 // VS1053 reset pin (unused!)
#define SD_CS 4 // SD Card select pin
#define MP3_CS 7 // VS1053 chip select pin (output)
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin, common between breakout and shield
#define MP3_DCS 6 // VS1053 Data/command select pin (output)

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//Create new objects of each item attached to Arduino
Adafruit_VS1053_FilePlayer musicPlayer = Adafruit_VS1053_FilePlayer(MP3_RESET, MP3_CS, MP3_DCS, DREQ, SD_CS);
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

'--------------------------------------------------

Now when I go into setup to start serial data comm and try to begin each hardware item, I get my error. The serial monitor screen shows the failure text "SSD1306 allocation failed". As stated, I can run either example code and get screen and music maker to run independently. But trying to use the screen with the code declaration for the music maker fails to initialize screen. Can't seem to dig in to figure out what the conflict is as I thought the music maker board did not use any of the same resources. Does not matter what is declared first, initialized first, the screen always fails initialization. Revert back to sample code for screen (Same declarations) without changing wiring, all works fine. Going crazy. Any help appreciated.


'----------------------------------------------------

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

if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { //initialize the screen
Serial.println(F("SSD1306 allocation failed"));
while (true); // Don't proceed, loop forever
}
Serial.println("OLED Screen Found");
delay(2000); // wait for initializing
oled.clearDisplay(); // clear display

oled.setTextSize(1); // text size
oled.setTextColor(WHITE); // text color
oled.setCursor(0, 10); // position to display
oled.println("Hello World!"); // text to display
oled.display(); // show on OLED

if (!musicPlayer.begin()) { // initialise the music player
Serial.println(F("Couldn't find VS1053, Check wiring"));
while (true); // Don't proceed, loop forever
}
Serial.println("MP3 Shield Found");


if (!SD.begin(SD_CS)) {
Serial.println(F("SD Card failed, or not present"));
for(;;); // Don't proceed, loop forever
}
Serial.println("Micro SD Card Found");

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

Return to “General Project help”