Need help with SD card & OLED screen not working together.

Status
Not open for further replies.

jim lee

Well-known member
I have a setup, Adafruit 1.5" OLED screen (Adafruit_SSD1351), Teensy 3.2, and now a adafruit Music card (Adafruit_VS1053) Everything is running on the SPI bus. With this same hardware I can A) do a mp3 player with a Serial command line interface, or B) a breakout game running on the OLED. C) With a different display (Adafruit_ILI9341) I did the calculator & vacuum gauge. The vacuum gauge used the SD card to read in its .bmp file background image. It works with SD.

I can NOT get the OLED to work with the SD file library. If I start with SD.begin(SD_PIN) the screen won't work, If I start with OLED.begin() the SD card won't work. I suspect there's something that the OLED library is doing that the SD stuff doesn't like. But I'm too weak in the low level SPI stuff to understand what's going wrong. And by now my head hurts.

My SD select pin is 4, I can't find anywhere that the OLED could think that pin 4 is something it it uses. IS there something anyone knows about OLED & SD files stuff not working together that I missed?

The OLED begin() that "I think" is causing trouble.
Code:
void Adafruit_SSD1351::begin(void) {
    // set pin directions
    pinMode(_rs, OUTPUT);
    
    if (_sclk) {
        pinMode(_sclk, OUTPUT);
        
        pinMode(_sid, OUTPUT);
    } else {
        // using the hardware SPI
        SPI.begin();
        SPI.setDataMode(SPI_MODE3);
    }
	
    // Toggle RST low to reset; CS low so it'll listen to us
    pinMode(_cs, OUTPUT);
    digitalWrite(_cs, LOW);
    
    if (_rst) {
        pinMode(_rst, OUTPUT);
        digitalWrite(_rst, HIGH);
        delay(500);
        digitalWrite(_rst, LOW);
        delay(500);
        digitalWrite(_rst, HIGH);
        delay(500);
    }

    // Initialization Sequence
    writeCommand(SSD1351_CMD_COMMANDLOCK);  // set command lock
    writeData(0x12);  
    writeCommand(SSD1351_CMD_COMMANDLOCK);  // set command lock
    writeData(0xB1);

    writeCommand(SSD1351_CMD_DISPLAYOFF);  		// 0xAE

    writeCommand(SSD1351_CMD_CLOCKDIV);  		// 0xB3
    writeCommand(0xF1);  						// 7:4 = Oscillator Frequency, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16)
    
    writeCommand(SSD1351_CMD_MUXRATIO);
    writeData(127);
    
    writeCommand(SSD1351_CMD_SETREMAP);
    writeData(0x74);
  
    writeCommand(SSD1351_CMD_SETCOLUMN);
    writeData(0x00);
    writeData(0x7F);
    writeCommand(SSD1351_CMD_SETROW);
    writeData(0x00);
    writeData(0x7F);

    writeCommand(SSD1351_CMD_STARTLINE); 		// 0xA1
    if (SSD1351HEIGHT == 96) {
      writeData(96);
    } else {
      writeData(0);
    }


    writeCommand(SSD1351_CMD_DISPLAYOFFSET); 	// 0xA2
    writeData(0x0);

    writeCommand(SSD1351_CMD_SETGPIO);
    writeData(0x00);
    
    writeCommand(SSD1351_CMD_FUNCTIONSELECT);
    writeData(0x01); // internal (diode drop)
    //writeData(0x01); // external bias

//    writeCommand(SSSD1351_CMD_SETPHASELENGTH);
//    writeData(0x32);

    writeCommand(SSD1351_CMD_PRECHARGE);  		// 0xB1
    writeCommand(0x32);
 
    writeCommand(SSD1351_CMD_VCOMH);  			// 0xBE
    writeCommand(0x05);

    writeCommand(SSD1351_CMD_NORMALDISPLAY);  	// 0xA6

    writeCommand(SSD1351_CMD_CONTRASTABC);
    writeData(0xC8);
    writeData(0x80);
    writeData(0xC8);

    writeCommand(SSD1351_CMD_CONTRASTMASTER);
    writeData(0x0F);

    writeCommand(SSD1351_CMD_SETVSL );
    writeData(0xA0);
    writeData(0xB5);
    writeData(0x55);
    
    writeCommand(SSD1351_CMD_PRECHARGE2);
    writeData(0x01);
    
    writeCommand(SSD1351_CMD_DISPLAYON);		//--turn on oled panel    
}

void  Adafruit_SSD1351::invert(boolean v) {
   if (v) {
     writeCommand(SSD1351_CMD_INVERTDISPLAY);
   } else {
     	writeCommand(SSD1351_CMD_NORMALDISPLAY);
   }
 }


The "other tft" screen that works fine has this at the top of the file.
Code:
// If the SPI library has transaction support, these functions
// establish settings and protect from interference from other
// libraries.  Otherwise, they simply do nothing.
#ifdef SPI_HAS_TRANSACTION
static inline void spi_begin(void) __attribute__((always_inline));
static inline void spi_begin(void) {
#if defined (ARDUINO_ARCH_ARC32)
  // max speed!
  SPI.beginTransaction(SPISettings(16000000, MSBFIRST, SPI_MODE0));
#else
    // max speed!
  SPI.beginTransaction(SPISettings(24000000, MSBFIRST, SPI_MODE0));
#endif
}
static inline void spi_end(void) __attribute__((always_inline));
static inline void spi_end(void) {
  SPI.endTransaction();
}
#else
#define spi_begin()
#define spi_end()
#endif

And its begin..

Code:
void Adafruit_ILI9341::begin(void) {
  if (_rst > 0) {
    pinMode(_rst, OUTPUT);
    digitalWrite(_rst, LOW);
  }

  pinMode(_dc, OUTPUT);
  pinMode(_cs, OUTPUT);

#if defined (USE_FAST_PINIO)
  csport    = portOutputRegister(digitalPinToPort(_cs));
  cspinmask = digitalPinToBitMask(_cs);
  dcport    = portOutputRegister(digitalPinToPort(_dc));
  dcpinmask = digitalPinToBitMask(_dc);
#endif

  if(hwSPI) { // Using hardware SPI
    SPI.begin();

#ifndef SPI_HAS_TRANSACTION
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SPI_MODE0);
  #if defined (_AVR__)
    SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
    mySPCR = SPCR;
  #elif defined(TEENSYDUINO)
    SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
  #elif defined (__arm__)
    SPI.setClockDivider(11); // 8-ish MHz (full! speed!)
  #endif
#endif
  } else {
    pinMode(_sclk, OUTPUT);
    pinMode(_mosi, OUTPUT);
    pinMode(_miso, INPUT);

#if defined (USE_FAST_PINIO)
    clkport     = portOutputRegister(digitalPinToPort(_sclk));
    clkpinmask  = digitalPinToBitMask(_sclk);
    mosiport    = portOutputRegister(digitalPinToPort(_mosi));
    mosipinmask = digitalPinToBitMask(_mosi);
    *clkport   &= ~clkpinmask;
    *mosiport  &= ~mosipinmask;
#endif
  }

  // toggle RST low to reset
  if (_rst > 0) {
    digitalWrite(_rst, HIGH);
    delay(5);
    digitalWrite(_rst, LOW);
    delay(20);
    digitalWrite(_rst, HIGH);
    delay(150);
  }

  /*
  uint8_t x = readcommand8(ILI9341_RDMODE);
  Serial.print("\nDisplay Power Mode: 0x"); Serial.println(x, HEX);
  x = readcommand8(ILI9341_RDMADCTL);
  Serial.print("\nMADCTL Mode: 0x"); Serial.println(x, HEX);
  x = readcommand8(ILI9341_RDPIXFMT);
  Serial.print("\nPixel Format: 0x"); Serial.println(x, HEX);
  x = readcommand8(ILI9341_RDIMGFMT);
  Serial.print("\nImage Format: 0x"); Serial.println(x, HEX);
  x = readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("\nSelf Diagnostic: 0x"); Serial.println(x, HEX);
*/
  //if(cmdList) commandList(cmdList);
  
  if (hwSPI) spi_begin();
  writecommand(0xEF);
  writedata(0x03);
  writedata(0x80);
  writedata(0x02);

  writecommand(0xCF);  
  writedata(0x00); 
  writedata(0XC1); 
  writedata(0X30); 

  writecommand(0xED);  
  writedata(0x64); 
  writedata(0x03); 
  writedata(0X12); 
  writedata(0X81); 
 
  writecommand(0xE8);  
  writedata(0x85); 
  writedata(0x00); 
  writedata(0x78); 

  writecommand(0xCB);  
  writedata(0x39); 
  writedata(0x2C); 
  writedata(0x00); 
  writedata(0x34); 
  writedata(0x02); 
 
  writecommand(0xF7);  
  writedata(0x20); 

  writecommand(0xEA);  
  writedata(0x00); 
  writedata(0x00); 
 
  writecommand(ILI9341_PWCTR1);    //Power control 
  writedata(0x23);   //VRH[5:0] 
 
  writecommand(ILI9341_PWCTR2);    //Power control 
  writedata(0x10);   //SAP[2:0];BT[3:0] 
 
  writecommand(ILI9341_VMCTR1);    //VCM control 
  writedata(0x3e); //¶Ô±È¶Èµ÷½Ú
  writedata(0x28); 
  
  writecommand(ILI9341_VMCTR2);    //VCM control2 
  writedata(0x86);  //--
 
  writecommand(ILI9341_MADCTL);    // Memory Access Control 
  writedata(0x48);

  writecommand(ILI9341_PIXFMT);    
  writedata(0x55); 
  
  writecommand(ILI9341_FRMCTR1);    
  writedata(0x00);  
  writedata(0x18); 
 
  writecommand(ILI9341_DFUNCTR);    // Display Function Control 
  writedata(0x08); 
  writedata(0x82);
  writedata(0x27);  
 
  writecommand(0xF2);    // 3Gamma Function Disable 
  writedata(0x00); 
 
  writecommand(ILI9341_GAMMASET);    //Gamma curve selected 
  writedata(0x01); 
 
  writecommand(ILI9341_GMCTRP1);    //Set Gamma 
  writedata(0x0F); 
  writedata(0x31); 
  writedata(0x2B); 
  writedata(0x0C); 
  writedata(0x0E); 
  writedata(0x08); 
  writedata(0x4E); 
  writedata(0xF1); 
  writedata(0x37); 
  writedata(0x07); 
  writedata(0x10); 
  writedata(0x03); 
  writedata(0x0E); 
  writedata(0x09); 
  writedata(0x00); 
  
  writecommand(ILI9341_GMCTRN1);    //Set Gamma 
  writedata(0x00); 
  writedata(0x0E); 
  writedata(0x14); 
  writedata(0x03); 
  writedata(0x11); 
  writedata(0x07); 
  writedata(0x31); 
  writedata(0xC1); 
  writedata(0x48); 
  writedata(0x08); 
  writedata(0x0F); 
  writedata(0x0C); 
  writedata(0x31); 
  writedata(0x36); 
  writedata(0x0F); 

  writecommand(ILI9341_SLPOUT);    //Exit Sleep 
  if (hwSPI) spi_end();
  delay(120); 		
  if (hwSPI) spi_begin();
  writecommand(ILI9341_DISPON);    //Display on 
  if (hwSPI) spi_end();

}

Thanks for looking at this. I really appreciate it!

-jim lee
 
Last edited:
So... I'm not crazy? This has been an issue in the past? Enough for someone to write their own library? Thanks for the link! I"ll roll that in tonight and see how it works for me.

Thanks again!

-jim lee
 
Hope it works - That lib should be done right for SPI sharing with Transactions - where I'm not sure about Adafruit version that may be the source of conflict.

It is a general type of problem with outside libs or older libs not up to PJRC Teensy standards. Since I just used this lib for SSD1331 it seemed like a safe guess.

I don't see any reason to question your sanity :) - but couldn't say with certainty about that ;) The Teensy SPI system and hardware offer opportunities for great improvement over what 'can work' on other systems - so customized code does get made to work more generically to play well and run faster.
 
I've been having the time of my life writing code for the thing! I loved how simple the Arduino was, but it was like writing code "ship in a bottle". This is also my first real exposure to hardware so its all new and fun.

I wish I could come up with a slick way to mount the little thing though. That bits kinda' a puzzle.

-jim lee
 
This OLED lib has and option for slower bitbang where you give it all the pin numbers, right?

What happens if you connect the display to 5 completely separate pins? Envelope if that's too slow, it'd be helpful to know if the compatibility issue between these libs is only SPI.

Also, as I recall, that MP3 player lib had a few different options for how it runs, like polling vs pin interrupt vs timer interrupt. Maybe those make a difference?
 
The mp3 lib has "do it by interrupt" or "sit in loop and play entire song". My stuff has polling built in so I just hooked mine into that. Hopefully later today I'll see if this all works. Gotta go!

-jim lee
 
Well.. Not yet.

I went through the allowed pins and made sure the SPI was using what it wanted. The included basicSetup.ino yapped when I used anything different. Then made sure everyone else on the bus was NOT using those pins. Ran all my test programs. Command line .mp3 player & disk manipulator. The breakout game. All using the old drivers. So no change there.

When I run SumoToy's basic setup, I can see it work it way through with no errors. But, in the end, nothing come out on the screen. Trying my breakout game with his drives had the same result no errors, but nothing on the screen either.

So for the moment, I'm stumped.

-jim lee
 
I've traced the data as far as writedata16_cont() and lost the trail. Everything is inlined for the 3.2. How many holes can it come out of? I'm assuming I'll have to look for them in the SPI library.

debugging by Serial.println()s takes forever!

-jim lee
 
Should I try to look into this issue?

If so, is using only Adafruit_SSD1351 and the SD library enough? Or is using the MP3 player also needed? What Arduino sketch should I run to reproduce the problem?
 
Good question Paul - when I read this I wasn't sure if it worked "with no errors" stand alone ? - then what is added to get 'in the end ...', or if the USB text displays but nothing EVER shows on the display:
...
When I run SumoToy's basic setup, I can see it work it way through with no errors. But, in the end, nothing come out on the screen.
 
Hang on, I'm on it.

I grabbed another OLED and a fresh Teensy 32.2, hooked them together all by their lonesome. Didn't work. So I added the rest of the parameters to the constructor in SUMOTOY's Basic setup example. He only had the first two. And VOLA! I get "ready" on the screen.

Nothing else works but this is at least a big enough breakthrough that I may be able to grind through the rest. Or get enough bits figured out I will be able to get better info. out here.

The project is a .mp3 playing doorbell for my Kid. So it needs the sound card & SD drive to function. all that was working. It just went south when I tried to include the OLED code.

Anyway, I now have something that at least draws on the screen and something that does not. I can compare them and hopefully solve this. Also I'll try adding SD.begin() to the new simple working setup to see if the problem is there. It could be my wiring, or the sound card. I donno'.

-jim lee
 
Ok, I now have SUMOTOY's stuff running in my library. And its running on my hardware. I can play breakout on it. It looks as if I can use the SD drive as well. That's a big step forward. But, once I try to bring the Adafruit sound card online, the screen stops working.

There are special pins called out for SPI on here, I don't understand that. Is it just for the OLED? Or is it for EVERYTHING running on SPI?
Another annoying but trivial issue, the SUMOTOY stuff doesn't seem to want to print spaces to the screen. So my text alignment & erasing is all messed up. I'll have to look into that.

So right now it looks like everything works as long as the sound card never sees begin();

-jim lee
 
Awesome the Sumotoy library works! And working with the SD card is a good sign those two play well together.

I haven't looked at the Adafruit sound card - their library for that isn't cool - or the hardware isn't treating the data lines properly and/or respecting the CS pins? Not sure how it works with the attached SD on their code some misfit with improved use on Teensy.

From my general understanding: SPI can be done manually timing the bits and responding on cue - or it can be done in a more efficient 'Transaction' oriented hardware controlled way often using predefined specific subsets of pins to optimize hardware support and efficiency. These two methods on the same bus won't play well. It could be that - or that the electrical properties and setup of the hardware aren't being respected and the devices are getting confused watching data or writing data or holding the lines in ways that don't allow other devices to run cleanly. Others here could look at the hardware or the library and perhaps spot that.

Per Paul's post #10 - if you show current code and indicate what is being added to go working to non-working it could be looked at.
 
Well, at the beginning I had no idea where to look and its a LOT of code. And a lot of wire. So I figured I'd better do my due diligence and see if I could narrow it down some. The plan was to get a simple OLED & processor setup with the basic Setup sketch to see if I could make that fail. And I did, but I fixed it. Then I got it working on my system and it looks like everything works. Until I call begin() on the sound board.

The sound board will actually play but the screen is just black after the begin();

Here's their begin()

I need help now. I'm beyond the edge of my map.

Code:
void Adafruit_VS1053::reset() {
  // TODO: http://www.vlsi.fi/player_vs1011_1002_1003/modularplayer/vs10xx_8c.html#a3
  // hardware reset
  if (_reset >= 0) {
    digitalWrite(_reset, LOW);
    delay(100);
    digitalWrite(_reset, HIGH);
  }
  digitalWrite(_cs, HIGH);
  digitalWrite(_dcs, HIGH);
  delay(100);
  softReset();
  delay(100);

  sciWrite(VS1053_REG_CLOCKF, 0x6000);

  setVolume(40, 40);
}

uint8_t Adafruit_VS1053::begin(void) {
  if (_reset >= 0) {
    pinMode(_reset, OUTPUT);
    digitalWrite(_reset, LOW);
  }

  pinMode(_cs, OUTPUT);
  digitalWrite(_cs, HIGH);
  pinMode(_dcs, OUTPUT);
  digitalWrite(_dcs, HIGH);
  pinMode(_dreq, INPUT);

  if (! useHardwareSPI) {
    pinMode(_mosi, OUTPUT);
    pinMode(_clk, OUTPUT);
    pinMode(_miso, INPUT);
  } else {
    SPI.begin();
    SPI.setDataMode(SPI_MODE0);
    SPI.setBitOrder(MSBFIRST);
    SPI.setClockDivider(SPI_CLOCK_DIV128); 
  }

  reset();

  return (sciRead(VS1053_REG_STATUS) >> 4) & 0x0F;
}

And here's what calls it..

Code:
boolean Adafruit_VS1053_FilePlayer::begin(void) {
  uint8_t v  = Adafruit_VS1053::begin();   

  //dumpRegs();
  //Serial.print("Version = "); Serial.println(v);
  return (v == 4);
}

And what calls that..

(my code)

Code:
boolean soundCard::begin(void) { 

    start();                    // Whatever happens, lets get the timer rolling.
    switch (setupType) {
      case soundCard_SHIELD :
        musicPlayer = new Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, soundCard_SD_CS);
      break;
      case soundCard_BREAKOUT :
        musicPlayer = new Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, soundCard_SD_CS);
      break;
      default : setError(badSetup); return false;
    }
    if (musicPlayer) {
      if (musicPlayer->begin()) {
        hookup();
        return true;
      } else {
        setError(initErr);
      }
    } else {
      setError(mallocErr);
    }
    return false;
  }

My .h file

Code:
#ifndef soundCard_h
#define soundCard_h

#include <SD.h>
#include <Adafruit_VS1053.h>

#include <idlers.h>
#include <timeObj.h>


// The usual SPI pins..
//#define CLK 13       // SPI Clock, shared with SD card
//#define MISO 12      // Input data, from VS1053/SD card
//#define MOSI 11      // Output data, to VS1053/SD card

// These are the pins used for the breakout example
#define BREAKOUT_RESET  2      // VS1053 reset pin (output)
#define BREAKOUT_CS     1     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    9      // VS1053 Data/command select pin (output)

// 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)      

// The default SD card select pin. (Fixed for the Shield type)
#define soundCard_SD_CS 4  

// Possible setups 
#define soundCard_SHIELD   0
#define soundCard_BREAKOUT 1

// how long 'till we load in more sound data.
#define soundCard_SLEEP_MS 40

enum action { play, pause, restart };

enum soundCardErr { 
  noErr, badSetup, initErr, badCommand, 
  noFileErr,mallocErr,nullStrErr, unknownErr
  };


class soundCard : public idler, public timeObj {

  public:
    soundCard(byte boardSetup);
    ~soundCard(void);

          boolean       begin(void);
          boolean       setSoundfile(char* inFilePath);
          boolean       command(action inCommand);
          boolean       isPlaying(void);
          void          setVolume(byte volume);
          byte					getVolume(void);
          void          setError(soundCardErr inErr);
          soundCardErr 	getLastError(void);

  protected:
  virtual void idle(void);

    Adafruit_VS1053_FilePlayer* musicPlayer;
    soundCardErr lastErr;
    byte          setupType;
    char*         filePath;
    byte					volume;
    boolean       playing;
};

#endif

I -think- the trouble is in there.

..probably my pin numbers or something..

-jim lee
 
Last edited:
You should post your INO too.

With a minute now first thing I did was download : https://github.com/adafruit/Adafruit_VS1053_Library/archive/master.zip

I see it is using transactions when :: #ifdef SPI_HAS_TRANSACTION

I don't see where the library ( .cpp or .h ) code selectively sets that - not sure if you need to do something at like line #15 in the .h file :: #define SPI_HAS_TRANSACTION 1
It does have an " #if defined(TEENSYDUINO)" so the code has been tested to work before it seems.

I'd try with that #define and then double check your pin definitions are right and true and not conflicting with unique pins where needed - I didn't scan the device to see what the pins need to be beyond standard SPI assumptions:

Code:
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) {
  _mosi = mosi;  << COMMON
  _miso = miso;  << COMMON
  _clk = clk;  << COMMON
  _reset = rst; << UNIQUE if needed ?
  _cs = cs; << UNIQUE
  _dcs = dcs; << UNIQUE
  _dreq = dreq; << UNIQUE if needed ?
 
Ok, here's the "simple" sketch I'm testing with.

Code:
#include <SSD_13XX.h>
#include <Adafruit_VS1053.h>

#include <SSD_13XX_Obj.h>

#include <colorObj.h>
#include <idlers.h>
#include <lists.h>
#include <mapper.h>
#include <multiMap.h>
#include <runningAvg.h>
#include <timeObj.h>

#include <bmpPipe.h>
#include <bmpLabel.h>
#include <displayObj.h>
#include <drawObj.h>
#include <label.h>
#include <lineObj.h>
#include <screen.h>

#include <soundCard.h>

#define DISP_BG_FILE  "/dbos/paper.bmp"
bmpPipe paper;
bmpLabel label1(20,6,100,10,"File name 1",&paper);

soundCard thePlayer(soundCard_BREAKOUT);

void setup() {

  Serial.begin(9600); while(!Serial);
  Serial.println("Serial's online.");

  if (!initScreen(SUMO_TOY_SSD_13XX,INV_PORTRAIT,4)) {
    Serial.println("Init screen card fail.");
    while(true); // Kill the process.
  }

  
  if (thePlayer.begin()) {
    Serial.println("Sound card OK?");
    if (thePlayer.setSoundfile("Corvette.mp3")) {
      Serial.println("Happy with Corvette?");
      thePlayer.command(play);
    } else {
      Serial.println("Couldn't open Corvette.");
    }
  } else {
    Serial.println("Sound card fail!");
  }
  
  
  screen->fillScreen(&blue);
  Serial.println("Screen\'s online.");
  if (paper.openPipe(DISP_BG_FILE)) {
    Serial.println("Opened pipe.");
    paper.drawBitmap(0,0);
    point pos = label1.getCorner(topLeftPt);
    for (int i=0;i<10;i++) {
      label1.setLocation(pos.x,pos.y+(i*12));
      label1.drawSelf();
    }
  } else {
    Serial.println("Failed to open pipe.");
  }
}


void loop() {
  idle();

}

Most of this stuff is in the framework though..

-jim
 
So if you swap the chunks around. Sound first, screen second. The screen works and the sound fails.


odd odd odd!

-jim lee
 
Did you try it with the forced :: #ifdef SPI_HAS_TRANSACTION.

Something is stepping on something else - Transaction usage can prevent that.

Indeed - the INO doesn't show the device declarations with pin #'s? I'd start with an MP3 code simple sample and add the screen init and test from a simple sumotoy sample. That would be easier to work with/post/debug.
 
I tried putting

#define SPI_HAS_TRANSACTION 1

into the adafruit header and it didn't have a noticeable effect.

In order to do the simpler test I'm going to need to get to the shop and hit the solder iron. Can only do code at home.

-jim lee
 
Interesting thing, Now, at least the SD card works in all cases. Before it wouldn't work at all with the OLED online.

-jim lee
 
Nice the SD and Display work together.

I tried putting

#define SPI_HAS_TRANSACTION 1

I only guessed at the needed syntax. Do that and put an error inside the nearest #ifdef in the .cpp and compile - it should show the error line. Then remove the #define from the header file and see if the error is skipped. That will show the compiler is adding that code section.
 
Hang on, I'm on it.

Ok, for now I'm not putting this on my list of library compatibility issues to investigate.

If you want me to look into this problem, I'll need to know exactly which libs, what hardware, and what program to run to reproduce the problem. If the conflict is only between SD and a display lib, please try to provide a complete test program without the MP3 player.
 
Sorry, I had to take a break from this for a bit. It was driving me nuts. There are other sections of this project that needed attention, so I worked on those. In a day or so I'll come back and do a simple sketch and see what messes with what.

I do have one question, about pins. On your picture of the 3.2 you have a bunch of pins labeled CS. If I used some other pin for CS would that cause issues? I assume now that it would. But what kind of issues?

Thanks again for the help!

-jim lee
 
If I used some other pin for CS would that cause issues?

It depends on the library. Most libraries can use any digital pin. I can confirm the Arduino SD library has the ability to use any digital pin.

Some libraries require the 5 pins indicated as CS signals. I really depends on the specific library. You didn't mention in this question exactly which libraries you're using. Perhaps that's because you didn't know it depends on the library's design?

This may sound a bit blunt, but honestly this thread looks like a confusing mess to me. There's a lot of talk about different libraries, but very little of it is specific about exactly which libraries or which versions of those libs. If you don't give a link to the exact lib, or specify it's the one with a certain name installed by a specific version of Teensyduino, you leave a lot of painful guesswork for anyone trying to help you. Likewise, I see many code fragments that aren't complete programs, and some complete programs which can't be just copied into Arduino and used because they depend on lits of other stuff that isn't clearly defined where someone wanting to help you should get exactly the same files you used.

I know this is all very frustrating for you. But if you can do just one thing, please try to improve how you're asking for help here. We can do much, much more to help if you would only be more specific. That's why we have the "Forum Rule" in red text at the top of every page. When you post complete programs and all the info needed for anyone reading your message to copy the files into Arduino, and get the exact same libs, they can compile and even run the code and see what's wrong. We really do much better at helping under those circumstances, as you can probably see if you look at the many other threads on this forum.

Please, do yourself a favor by taking just a little extra time to write better posts here. Imagine you're a reader with a clean computer who will try to actually run the code you've posted. Does your message have all the code needed, and links or specific info about the exact copies of all the required libs, so they can get exactly the same result? If you can just do that, I believe you'll find we can help you much better.
 
Status
Not open for further replies.
Back
Top