AnimatedGIFs with SDIO SD card

Hello.

Its possible use AnimatedGIFs example code with SDIO SD card, instead of with SD by SPI ?

In my custom boards, I install always SDIO 4bit parallel SD card access, because its faster than SPI, now I need play some animated GIF, and need store and read files from SD by SDIO.

Kind Regards.

I’m unfamiliar with SDIO, are you using a breakout/shield? If so, can you provide a link? Do you know if there is an Arduino library?

No, I design all my boards, its a custom board with a Kinetis MK66 (same that install Teensy 3.6), and a SD card socket connected by SDIO 4bit parallel. SD schematic is same that Teensy 3.6.

I have SdFAT library for Teensy 3.6 (this support SDIO), tested work fine, but also need that AnimatedGIFs code support SDIO instead of SPI, because my schematic connect SD by SDIO.

https://github.com/greiman/SdFat-beta/tree/master/SdFat/examples/TeensySdioDemo

1 Like

I think I tried this a while back, you just set the chip select pin to BUILTIN_SDCARD on the Teensy 3.5 or 3.6 and it should work.

Thanks Louis.

Do you mean that simply need change chip select assign, so I change this in AnimatedGif source ??

// Chip select for SD card on the SmartMatrix Shield
#define SD_CS 1

to

#define SD_CS BUILTIN_SDCARD

With this source change, access to SD will be by SDIO instead of by SPI ?

That’s correct, please let me know if it works

OK, thank you Louis, I go to check it.

I have apply modification and yes, now work with SDIO.
But I have a problem, imagen blink, I do not know if this is because of this modification, but I remember first tests I made with SD by SPI, and the image was perfect, did no blink.

This is configuration in source code, same I used with first test by SPI.

/* SmartMatrix configuration and memory allocation */
#define COLOR_DEPTH 24
const uint8_t kMatrixWidth = 128; // known working: 32, 64, 96, 128
const uint8_t kMatrixHeight = 32; // known working: 16, 32, 48, 64
const uint8_t kRefreshDepth = 24; // known working: 24, 36, 48 //
const uint8_t kDmaBufferRows = 2; // known working: 2-4
const uint8_t kPanelType = SMARTMATRIX_HUB75_32ROW_MOD16SCAN;
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
const uint8_t kScrollingLayerOptions = (SM_SCROLLING_OPTIONS_NONE);

Have you tried making these changes: Teensy 3.6 onboard sd slot - #4 by Jason

Thanks Louis, I will check. Though with Teensy 3.2 and SPI SD, works perfectly without modify Smartmatrix sources. I do not know if problem is with Teensy 3.6 or with SDIO modification.

Hello Louis
But then it’s possible that it works fine with Teensy 3.2 and fail with Teensy 3.6 ?
I remember now, my first test was with Teensy 3.2 and SD by SPI, and worked perfect.

It’s likely the Teensy 3.6 that is causing the problem, SmartMatrix Library wasn’t designed to work with the Teensy 3.6 so it needs a fix

Hello Louis.

I’ve thought that perhaps problem with AnimatedGIF and Teensy 3.6, is because of MK66 is faster and then may be need modify source code to change delay between frames (to remove blinks).

I can run Smartmatrix with MK66 with another source code and it works fine, so I think it’s not a Smartmatrix library problem, but specifically the AnimatedGIF source code.

I’ve looked at the source code, and I think if I modify the calculation of the delay between frames (nextFrameTime_ms), it could work fine with Teensy 3.6 and my custom board with Kinetis MK66.

What do you think about it ?

// wait until time to display next frame
while(nextFrameTime_ms > millis());

// calculate time to display next frame
nextFrameTime_ms = millis() + (10 * frameDelay);
if(updateScreenCallback)
    (*updateScreenCallback)();

millis() should work on the Teensy 3.6 as well as Teensy 3.2, but it could be a problem. I’ll have to take a look at this at some point.

Thank you Louis,
I will do some source modification tests to see if I fix AnimatedGif problem with Kinetis MK66. If you solve problem, please share solution.

Kind Regards

There’s a new SmartMatrix Library release with better support for Teensy 3.6, please give it a try and see if it fixes the AnimatedGIFs issues