Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 26 to 50 of 70

Thread: Teensyduino 1.54 Beta #3

  1. #26
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    Good idea to do a page or blog about SD... Hopefully also a link up on the forum some place.

    So far I have the new beta installed W10 64bit... And it is working.

    I am sort of curious on the changing the default USB of Serial to now be a composite, as it is now breaking a some utilities like the TyTools.

    Hopefully that one will be fixed soon.


    So far tested simple SD stuff on a few different cards I have sitting here, like Ulta 32, a 16 and an 8... And so far they are working.

    Still wondering about comments in some of the examples like: // Teensy 3.5 & 3.6 & 4.1 on-board: BUILTIN_SDCARD
    Especially for T4 which has ability for builtin as well if one has adapter.

  2. #27
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,742
    BUILTIN_SDCARD should work on Teensy 4.0, if you have the hardware connected. But I haven't personally tested it.

    From a documentation point of view where there's 1 line of space, it's simplest to only mention the 3 boards which come with a SD socket.

  3. #28
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    Yep - I ran a couple of card lists now with T4 (with the 4236 adapter... I am guessing that there are not that many who will install external SD readers on these, unless they need it in a smaller footprint....

  4. #29
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Just ran into an interesting issue with a T3.2.

    Use Case:
    1. Adafruit micro-sd breakout - running listfiles on a SansDisk 128mb card works no issue by itself
    2. ILI9488 - graphicstest works no problem by itself
    3. JPECDEC Slideshow on a ILI9488 get the error message "Unable to Open SD Card" - initialization issue
    4. JPECDEC Slideshow on a ILI9341 get the error message "Unable to Open SD Card" - initialization issue

  5. #30
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    Hi @mjs513 - I don't remember but I think the ILI9488 has issues with MISO pin? Wonder if you disconnect it from the display will it work?

    Note I have a couple of these displays.
    One from BuyDisplay and another from Ebay.

    Another FYI: Saturday I ordered another one from Ebay: https://www.ebay.com/itm/333754817506
    There appears to be many listings out there for probably the same display.

    But may try to set one up...

  6. #31
    Senior Member
    Join Date
    Dec 2015
    Location
    LA
    Posts
    192
    Installed on macOS Catalina 10.15.7
    My older programs compiled and seem to run well. Get this new warning:
    Code:
    n file included from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/stat.h:9:0,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/_default_fcntl.h:188,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/sys/fcntl.h:4,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/arm-none-eabi/include/fcntl.h:1,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SdFat-beta/src/ExFatLib/../common/FsApiConstants.h:30,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SdFat-beta/src/ExFatLib/ExFatFile.h:36,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SdFat-beta/src/ExFatLib/ExFatVolume.h:28,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SdFat-beta/src/ExFatLib/ExFatLib.h:27,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SdFat-beta/src/SdFat.h:33,
                     from /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SD/src/SD.h:6,
                     from /Users/michaelrunyan/Documents/Arduino/myT4multisensor/myT4multisensor.ino:12:
    /Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/Time/time.h:1:2: warning: #warning "Please include TimeLib.h, not Time.h.  Future versions will remove Time.h" [-Wcpp]
     #warning "Please include TimeLib.h, not Time.h.  Future versions will remove Time.h"
    myT4multisensor.ino:12: is #include <TimeLib.h>

  7. #32
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Quote Originally Posted by KurtE View Post
    Hi @mjs513 - I don't remember but I think the ILI9488 has issues with MISO pin? Wonder if you disconnect it from the display will it work?

    Note I have a couple of these displays.
    One from BuyDisplay and another from Ebay.

    Another FYI: Saturday I ordered another one from Ebay: https://www.ebay.com/itm/333754817506
    There appears to be many listings out there for probably the same display.

    But may try to set one up...
    @KurtE - darn it - forgot about that - but thats probably it - when I designed my boards I used a tri-state buffer to get it to work - damn - maybe will try another display

  8. #33
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,063
    Quote Originally Posted by bicycleguy View Post
    Installed on macOS Catalina 10.15.7
    My older programs compiled and seem to run well. Get this new warning:
    Code:
     #warning "Please include TimeLib.h, not Time.h.  Future versions will remove Time.h"
    this will stay to be there until all libraries remove Time.h, or you are not using Windows, or you delete TimeLib library

  9. #34
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    Quote Originally Posted by mjs513 View Post
    @KurtE - darn it - forgot about that - but thats probably it - when I designed my boards I used a tri-state buffer to get it to work - damn - maybe will try another display
    Ok I installed the library JPEGDEC

    Put some JPG files (case sensitive in the example sketch) edited the sketch to use ST7735_t3/ST7789 library and tried it with T3.5 using both Built in SD as well as the SD slot on the 240x320 Adafruit display. And it appears to be working.,

  10. #35
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Quote Originally Posted by KurtE View Post
    Ok I installed the library JPEGDEC

    Put some JPG files (case sensitive in the example sketch) edited the sketch to use ST7735_t3/ST7789 library and tried it with T3.5 using both Built in SD as well as the SD slot on the 240x320 Adafruit display. And it appears to be working.,
    Cool that was my next try - did try the HX display but for some reason not working with the t3.2. Right now trying the tristate buffer but that didnt work with the ILI9488 with the t3,2

    Think will have to try with T3.5 next

  11. #36
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    Quote Originally Posted by mjs513 View Post
    Cool that was my next try - did try the HX display but for some reason not working with the t3.2. Right now trying the tristate buffer but that didnt work with the ILI9488 with the t3,2

    Think will have to try with T3.5 next
    I swapped in T3.2 for 3.5 and so far it appears to work ST7789...

    Sketch:
    Code:
    // A simple image slideshow which reads all the .JPG files from the root
    // directory of a SD card and shows each for 1 second on an ILI9341 display.
    
    #include <JPEGDEC.h>
    #include <ST7735_t3.h>
    #include <ST7789_t3.h>
    
    #include <Bounce.h>
    #include <SD.h>
    
    #define TFT_RST 8
    #define TFT_DC  9
    #define TFT_CS 10
    
    ST7789_t3 tft = ST7789_t3(TFT_CS, TFT_DC, TFT_RST);
    JPEGDEC jpeg;
    
    // Setup - initialize ILI9341 display, wait for serial monitor, open SD card
    void setup() {
      pinMode(34, INPUT_PULLDOWN);
      pinMode(33, OUTPUT);
      digitalWrite(33, HIGH); // pushbuttons short pins 33 & 34 together
      Serial.begin(115200);
      tft.init(240, 320);           // Init ST7789 2.0" 320x240
      tft.setRotation(0);
      tft.fillScreen(ST77XX_BLACK);
      tft.setTextColor(ST77XX_YELLOW);
      tft.setTextSize(2);
      tft.println("Waiting for Arduino Serial Monitor...");
    
      while (!Serial && millis() < 3000); // wait up to 3 seconds for Arduino Serial Monitor
      Serial.println("ILI9341 Slideshow");
      tft.fillScreen(ST77XX_BLACK);
      tft.setCursor(0, 0);
    
      while (!SD.begin(4/*BUILTIN_SDCARD*/)) {
        Serial.println("Unable to access SD Card");
        tft.println("Unable to access SD Card");
        delay(1000);
      }
    }
    
    // Functions to access a file on the SD card
    File myfile;
    
    void * myOpen(const char *filename, int32_t *size) {
      myfile = SD.open(filename);
      *size = myfile.size();
      return &myfile;
    }
    void myClose(void *handle) {
      if (myfile) myfile.close();
    }
    int32_t myRead(JPEGFILE *handle, uint8_t *buffer, int32_t length) {
      if (!myfile) return 0;
      return myfile.read(buffer, length);
    }
    int32_t mySeek(JPEGFILE *handle, int32_t position) {
      if (!myfile) return 0;
      return myfile.seek(position);
    }
    
    // Function to draw pixels to the display
    void JPEGDraw(JPEGDRAW *pDraw) {
      //Serial.printf("jpeg draw: x,y=%d,%d, cx,cy = %d,%d\n",
         //pDraw->x, pDraw->y, pDraw->iWidth, pDraw->iHeight);
      tft.writeRect(pDraw->x, pDraw->y, pDraw->iWidth, pDraw->iHeight, pDraw->pPixels);
    }
    
    // Main loop, scan for all .JPG files on the card and display them
    void loop() {
      int filecount = 0;
      tft.setCursor(0, 0);
      File dir = SD.open("/");
      while (true) {
        File entry = dir.openNextFile();
        if (!entry) break;
        if (entry.isDirectory() == false) {
          const char *name = entry.name();
          const int len = strlen(name);
          if (len > 3 && strcmp(name + len - 3, "JPG") == 0) {
            Serial.print("File: ");
            Serial.println(name);
            tft.print("File: ");
            tft.println(name);
            jpeg.open((const char *)name, myOpen, myClose, myRead, mySeek, JPEGDraw);
            jpeg.decode(0, 0, 0);
            jpeg.close();
            filecount = filecount + 1;
            if (digitalRead(34) == LOW) {
              // skip delay between images when pushbutton is pressed
              delay(1000);
            }
          }
        }
        entry.close();
      }
      if (filecount == 0) {
        Serial.println("No .JPG files found");
        tft.println("No .JPG files found");
        delay(2000);
      }
    }
    Note: the line in RED where I edited the CS pin... Probably should move to #define... But...

  12. #37
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Quote Originally Posted by KurtE View Post
    I swapped in T3.2 for 3.5 and so far it appears to work ST7789...

    Note: the line in RED where I edited the CS pin... Probably should move to #define... But...
    Ok with a tri-state buffer doesn't seem to work. So I added a tri-state buffer to the MISO line on the ILI9488 and tested with an external card on the T3.2, T3.5 and T4.1:
    1. T3.2: No luck - keep getting a Unable to access the SDCARD
    2. Swapped the T3.2 with a T3.5 and worked like a charm - Displays JPEG images and reads from the external card no problem.
    3. Swapped the T4.1 for the T3.5 and again no issue with the external card and JPEG demo sketch with the external card.

  13. #38
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    8,470
    @mjs513 - What size card? I am using 8gb one. right now...

    But wonder if memory issue by size of card?

  14. #39
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Testing with SansDisk Extreme 512Gbmicro SD:

    Builtin_SDCARD Cardinfo:
    Code:
    Initializing SD card...Wiring is correct and a card is present.
    
    Card type: SDHC
    Volume type is FAT64
    
    Volume size (Kbytes): 499806208
    Volume size (Mbytes): 488092
    Extern Card Reader:
    Code:
    Initializing SD card...Wiring is correct and a card is present.
    Card type: SDHC
    Volume type is FAT64
    Volume size (Kbytes): 499806208
    Volume size (Mbytes): 488092
    Also tried it with the ILI9341_slideshow JPEG sketch and read and displayed no issues

    So far it seems to be working as tested
    Last edited by mjs513; 11-03-2020 at 08:35 AM.

  15. #40
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Quote Originally Posted by KurtE View Post
    @mjs513 - What size card? I am using 8gb one. right now...

    But wonder if memory issue by size of card?
    Using my standard 32gb card. As long as I am not accessing the display it does read the card. Not sure what is going on - power issue - clocking?

    EDIT: remember this is with a ILI9488 display and a tristate buffer.

  16. #41
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,063
    Quote Originally Posted by mjs513 View Post
    Testing with SansDisk Extreme 512Mb micro SD:
    512 Gb, right?

  17. #42
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,462
    8 hour run of edited :: ...examples\SimultaneousPlay\SimultaneousPlay.ino

    Only cycling through 4 WAV's on T_3.2 on Audio Kit from a 64GB uSD. Odd note is the pulsing of the ILI9341 backlight. It is running from 5V USB

    The four WAV's are NUM 1, 2 and 3 and the fourth added as NUM0==playNumber(0); is renamed SDTEST1.WAV - the 16KB song.

    Running in loop w/3500 ms delay the song starts and then 3.5s intervals nums 1, 2 and 3 are merged - then it restarts.

    So it seems Longer term all is well - it is just the init and startup beyond some point of added WAV's.

    Also I renamed the NUM6 file and then copied NUM1 again as NUM6 - and that still wouldn't help it work in cycling as tried ??? So it isn't the NUM6=='SIX' audio file as the problem.

    @Paul - not sure what final param here is to do ? Should be numbered 0-3 to associate properly per mixer?
    Code:
    AudioConnection          patchCord1(playSdWav6, 0, mixer1, 3);
    AudioConnection          patchCord2(playSdWav3, 0, mixer1, 2);
    AudioConnection          patchCord3(playSdWav5, 0, mixer2, 1);
    AudioConnection          patchCord4(playSdWav4, 0, mixer2, 2);
    AudioConnection          patchCord0(playSdWav0, 0, mixer2, 2);
    AudioConnection          patchCord5(playSdWav2, 0, mixer1, 1);
    AudioConnection          patchCord6(playSdWav1, 0, mixer1, 0);
    It works as above where :: mixer2, 2
    is duplicated - but if I move it to : patchCord0(playSdWav0, 0, mixer2, 0);

    It fails to even start up playing ???

    Of course I cannot play SdWav4 like this

  18. #43
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,063
    Quote Originally Posted by defragster View Post
    not sure what final param here is to do ? Should be numbered 0-3 to associate properly per mixer?
    I guess you know that the AudioConnection if defining link between (Object, OutChannel -> Object, InChannel)

  19. #44
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,462
    Quote Originally Posted by WMXZ View Post
    I guess you know that the AudioConnection if defining link between (Object, OutChannel -> Object, InChannel)
    Indeed that was my assumption - clicked a few times on pjrc.com audio and it wasn't spelled out - and didn't get as far as to look at the code.

    Which suggests it is a problem when these - wrong - values works better:
    Code:
    AudioConnection          patchCord4(playSdWav4, 0, mixer2, 2);
    AudioConnection          patchCord0(playSdWav0, 0, mixer2, 2);
    Than this does? - though as noted above when playSdWav4 not played:
    Code:
    AudioConnection          patchCord4(playSdWav4, 0, mixer2, 2);
    AudioConnection          patchCord0(playSdWav0, 0, mixer2, 0);
    Assuming also it is ZERO based following that portion Paul created when posting the sketch.

    Was hoping - if relevant - it would trigger something with Paul in the setup/handling of the linkages.

    Also found that when Meter + probe in wrong jack (for current measure) it shorts probes and kills Teensy trying to measure voltage. Wanted to see the 3.3V on the ili9341 that was pulsing the LED backlight as it played.

    >> What I saw was shorting those restarted the Teensy - and on restart what played for 8 hours would not - even after proper power off restart until it was reprogrammed ??? Maybe if put the uSD processor in an odd state? But read only - and it went back to working only with fresh upload ???

  20. #45
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,462
    Quote Originally Posted by WMXZ View Post
    I guess you know that the AudioConnection if defining link between (Object, OutChannel -> Object, InChannel)
    Indeed that was my assumption - clicked a few times on pjrc.com audio and it wasn't spelled out - and didn't get as far as to look at the code.

    Which suggests it is a problem when these - wrong - values works better:
    Code:
    AudioConnection          patchCord4(playSdWav4, 0, mixer2, 2);
    AudioConnection          patchCord0(playSdWav0, 0, mixer2, 2);
    Than this does? - though as noted above when playSdWav4 not played:
    Code:
    AudioConnection          patchCord4(playSdWav4, 0, mixer2, 2);
    AudioConnection          patchCord0(playSdWav0, 0, mixer2, 0);
    Assuming also it is ZERO based following that portion Paul created when posting the sketch.

    Was hoping - if relevant - it would trigger something with Paul in the setup/handling of the linkages.

    Also found that when Meter + probe in wrong jack (for current measure) it shorts probes and kills Teensy trying to measure voltage. Wanted to see the 3.3V on the ili9341 that was pulsing the LED backlight as it played.

    >> What I saw was shorting those restarted the Teensy - and on restart what played for 8 hours would not - even after proper power off restart until it was reprogrammed ??? Maybe if put the uSD processor in an odd state? But read only - and it went back to working only with fresh upload ???

  21. #46
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,742
    Well, this was an embarrassing little mistake!

    https://github.com/PaulStoffregen/Au...53e1349890a0e6

    With this fix, all 6 files should play. Well, at least as long as you don't try to go too fast - which is the issue I meant to test...

  22. #47
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,337
    Quote Originally Posted by WMXZ View Post
    512 Gb, right?
    Oops 512gb. Have to fix

  23. #48
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,462
    Is this a double use of mixer2 4th param with channel '1':
    Code:
    AudioConnection          patchCord3(playSdWav5, 0, mixer2, 1);
    ...
    AudioConnection          patchCord9(mixer2, 0, i2s1, 1);
    Quote Originally Posted by PaulStoffregen View Post
    Well, this was an embarrassing little mistake!

    https://github.com/PaulStoffregen/Au...53e1349890a0e6

    With this fix, all 6 files should play. Well, at least as long as you don't try to go too fast - which is the issue I meant to test...
    Indeed it does - that explains last file#6 seeming broken.

    T_3.2 works at :: const int milliseconds = 1800; , But not much below that.

    Something odd - removed 64GB card and put '6' back instead of renamed file - then plugged and repowered and got noise before it got to 6, where it was working on prior file. Had to reupload and it works again ... something seems on the edge?

    BUZZ noise varies - supposing that is request for SD to fill buffer not complete when buffer is needed so it then running on a void or ill formed buffer - then it breaks?

    Very odd that 4 playNumber( # ) sequentially CAN work [it varies upload to upload ] with NO DELAY - because at least one valid buffer is ready, but multiple numbers are overlaid audibly well. But putting even 1ms delay between them allows one to fail and it gets lost and goes buzzy.

    If so - I don't suppose there is a way to make a persistent 'silent' (?) buffer to set as a placeholder *ptr until the SD card data fills a usable buffer? Still 'broken' - but fail gracefully when SD data not ready?


    In testing have had multiples playing/mixing at once, the SDTEST1.WAV to make the numbers less boring.
    Trying to add that again as last in the list and the next to last number gets elevated volume - and then either skips the song or goes buzzy.
    Just noted above mixer channel re-use? So two 4 ch mixers won't allow for a 7th sample with two i2s channels?

  24. #49
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,742
    Here's a patch which greatly improves the WAV simultaneous playback.

    https://github.com/PaulStoffregen/Au...f7efe3b778a629

    I'm not sure if this solves 100% of the issues. But it is playing on my workbench right now with the delay at only 300 ms.

  25. #50
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,742
    Quote Originally Posted by defragster View Post
    Is this a double use of mixer2 4th param with channel '1':
    Code:
    AudioConnection          patchCord3(playSdWav5, 0, mixer2, 1);
    ...
    AudioConnection          patchCord9(mixer2, 0, i2s1, 1);
    Nope, it's correct because the 1st & 2nd parameters are the connection's source and the 3rd & 4th parameters are the connection's destination.

    This is the drawing from the design tool which generated those connections.

    Click image for larger version. 

Name:	sc.png 
Views:	11 
Size:	33.4 KB 
ID:	22299

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •