Teensyduino Library complications

Status
Not open for further replies.

MogaRaghu

Well-known member
Maybe this is a common topic ... I have an Arduino IDE 1.8.7 and the latest Teensyduino 1.44 on a WIN 10 machine. The target hardware is a Teensy3.5 module.

I developed a code for a single channel data logger which also interacts with a LabVIEW utility on the PC to set parameters like logging interval , data time and download logged data via the Serial1 port. All well.

But had to sweat it out initially due to the library conflicts - even now the SD library is one copied from the Teensy folder and pasted into my sketch folder. Otherwise the code does not compile with the native SD library. In the past had similar issues with Wire Library.


How to force the Compiler to use the Teensy library objects when the Board is a Teensy one ? Isnt this a obvious thing to be done .... maybe its not that easy as it sounds ??

For instance the code below when called provides the name of the log file + bytes in a regualr Atmega 328P MCU. But on the Teensy it produces a funny line like "SYSTEM ~1.." and thats it !!

Code:
void printDirectory(File dir, int numTabs) {
  while (true) {

    File entry =  dir.openNextFile();
    if (! entry) {
      // no more files
      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.print(entry.size(), DEC);
      Serial.println(" bytes");
    }
    entry.close();
  }
}
 
But had to sweat it out initially due to the library conflicts - even now the SD library is one copied from the Teensy folder and pasted into my sketch folder. Otherwise the code does not compile with the native SD library. In the past had similar issues with Wire Library.

Sounds like you might have multiple copies of Arduino installed and/or multiple copies of the Teensy SD library (in your sketchbook/libraries and in core install folders or ??). You could use explorer to search for "SD.h" and see how many you find. you may need to delete extra copies.

How about just trying the listfiles example: File > Examples > SD > listfiles
I'm assuming you are using the BUILTIN microSD on the T3.5, so you need to edit the listfiles example to use BUILTIN_SDCARD for chipSelect

listfiles works for me on Windows 10, Arduino IDE 1.8.7 with teensyduino 1.44
 
Last edited:
Sounds like you might have multiple copies of Arduino installed and/or multiple copies of the Teensy SD library (in your sketchbook/libraries and in core install folders or ??). You could use explorer to search for "SD.h" and see how many you find. you may need to delete extra copies.

How about just trying the listfiles example: File > Examples > SD > listfiles
I'm assuming you are using the BUILTIN microSD on the T3.5, so you need to edit the listfiles example to use BUILTIN_SDCARD for chipSelect

listfiles works for me on Windows 10, Arduino IDE 1.8.7 with teensyduino 1.44

Code:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SD\SD.h
C:\Users\***\Documents\Arduino\libraries\SD\SD.h
C:\Users\***\Documents\Arduino\hardware\espressif\esp32\libraries\SD\src\SD.h
C:\Program Files (x86)\Arduino\libraries\SD\src\SD.h
C:\Users\***\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\SD\src\SD.h

Yes I do use the BUILTIN_SDCARD for chipselect


I have attached the number of SD.h on my computer. I just want to know how to force Teensyduino to use the library of the Teensy. Right now I have copied it from the Teensy folder to the Sketch folder overwriting the native SD library. I kmow it sound of sounds crude. But....
 
Status
Not open for further replies.
Back
Top