RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Hi,

I need help regarding this project: https://learn.adafruit.com/mini-gif-players/overview. I went through all the steps but my screen stays black and my serial monitor seems to get stuck at "Error opening file ._Arduino-Logo-320-B.gif = 8".

This is what I am working with:
-a black Feather RP2040
-Adafruit 1.9" 320x170 Color IPS TFT Display - ST7789
-Lithium Ion Polymer Battery with Short Cable - 3.7V 420mAh
-Data sync usb-c to c cable
-switch is connected with alligator clips

This what I already did:
-double checked my soldering with a multimeter
-double checked my wiring many times
-followed the steps of Adafruits website to prepare my RP2040
-installed CicuitPython on the drive
-Cleaned up my flash memory with "Nuke"
-downloaded Adafruits GIF and created my own GIFs with the displays' dimension and tried both
-tested the Feather and the TFT screen separetly and they both work perfect
-I copy pasted the code from Adafruit website and uploaded to the board. I uploaded it as is and also after changing dimensions to fit my screen (320 x 170).

Things I noticed that might be wierd:
-I have invisible files appearing each time I reboot or replug my Feather on computer. I delete them each time before uploading my code to the board, but the invisible folder ".Trashes" cannot be deleted
-My drive is ejected each time after the code is done uploading
-when I open Arduino IDE or a new project, there is a window saying "The "xcrun" command requires the command line developper tools. Would you like to install it now?"
-Most importantly, this is what appears in my serial monitor when the code is uploaded:

Adafruit SPIFlash Animated GIF Example
Flash chip JEDEC ID: 0xC84017
Mounted filesystem!
282595 2022-10-06 15:43:56 Arduino-Logo-320-B.gif
4096 2022-10-12 18:34:24 ._Arduino-Logo-320-B.gif
22 2020-01-01 00:00:04 code.py
0 2020-01-01 00:00:04 lib/
115 2020-01-01 00:00:06 boot_out.txt
0 2022-10-12 18:53:52 .Trashes/
282595 2022-10-06 15:43:56 Arduino-Logo-320-B.gif
Successfully opened GIF Arduino-Logo-320-B.gif; Canvas size = 320 x 170
frame count: 1
duration: 40 ms
max delay: 40 ms
min delay: 10000 ms
4096 2022-10-12 18:34:24 ._Arduino-Logo-320-B.gif
Error opening file ._Arduino-Logo-320-B.gif = 8

(also) I would like to upload images of my set-up, but I am not sure how to insert images in these messages... Basically, I have everything wired on a breadboard and there is a white light behind the screen. The screen itself is black.

Looking forward to hear back from you!

Laïla

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

Thank you for the summary of your setup.

You can upload images via attachments tab below the text box you submit text in here. However, we can focus on the code first as this error message looks like the $$$.

Code: Select all

Error opening file ._Arduino-Logo-320-B.gif = 8
Can you post your code. It appears the file name might have a syntax issue (quotes or line break, maybe)? Please place the code in CODE tags.

Did you drag-n-drop the GIF onto the CIRCUITPY drive?

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Thank you so much for your reply,

Here is my code :

Code: Select all

// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries
//
// SPDX-License-Identifier: MIT

#include <AnimatedGIF.h>
#include <SdFat.h>
#include <Adafruit_SPIFlash.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789

#define TFT_CS         5
#define TFT_DC         6
#define TFT_RST        9

#define DISPLAY_WIDTH 320
#define DISPLAY_HEIGHT 170

#define GIFDIRNAME "/"
#define NUM_LOOPS 5

#if defined(ARDUINO_ARCH_ESP32)
  // ESP32 use same flash device that store code.
  // Therefore there is no need to specify the SPI and SS
  Adafruit_FlashTransport_ESP32 flashTransport;

#elif defined(ARDUINO_ARCH_RP2040)
  // RP2040 use same flash device that store code.
  // Therefore there is no need to specify the SPI and SS
  // Use default (no-args) constructor to be compatible with CircuitPython partition scheme
  Adafruit_FlashTransport_RP2040 flashTransport;

  // For generic usage: Adafruit_FlashTransport_RP2040(start_address, size)
  // If start_address and size are both 0, value that match filesystem setting in
  // 'Tools->Flash Size' menu selection will be used

#else
  // On-board external flash (QSPI or SPI) macros should already
  // defined in your board variant if supported
  // - EXTERNAL_FLASH_USE_QSPI
  // - EXTERNAL_FLASH_USE_CS/EXTERNAL_FLASH_USE_SPI
  #if defined(EXTERNAL_FLASH_USE_QSPI)
    Adafruit_FlashTransport_QSPI flashTransport;

  #elif defined(EXTERNAL_FLASH_USE_SPI)
    Adafruit_FlashTransport_SPI flashTransport(EXTERNAL_FLASH_USE_CS, EXTERNAL_FLASH_USE_SPI);

  #else
    #error No QSPI/SPI flash are defined on your board variant.h !
  #endif
#endif

Adafruit_SPIFlash flash(&flashTransport);

// file system object from SdFat
FatFileSystem fatfs;

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
AnimatedGIF gif;
File32 f, root;

void * GIFOpenFile(const char *fname, int32_t *pSize)
{
  f = fatfs.open(fname);
  if (f)
  {
    *pSize = f.size();
    return (void *)&f;
  }
  return NULL;
} /* GIFOpenFile() */

void GIFCloseFile(void *pHandle)
{
  File32 *f = static_cast<File32 *>(pHandle);
  if (f != NULL)
     f->close();
} /* GIFCloseFile() */

int32_t GIFReadFile(GIFFILE *pFile, uint8_t *pBuf, int32_t iLen)
{
    int32_t iBytesRead;
    iBytesRead = iLen;
    File32 *f = static_cast<File32 *>(pFile->fHandle);
    // Note: If you read a file all the way to the last byte, seek() stops working
    if ((pFile->iSize - pFile->iPos) < iLen)
       iBytesRead = pFile->iSize - pFile->iPos - 1; // <-- ugly work-around
    if (iBytesRead <= 0)
       return 0;
    iBytesRead = (int32_t)f->read(pBuf, iBytesRead);
    pFile->iPos = f->position();
    return iBytesRead;
} /* GIFReadFile() */

int32_t GIFSeekFile(GIFFILE *pFile, int32_t iPosition)
{ 
  int i = micros();
  File32 *f = static_cast<File32 *>(pFile->fHandle);
  f->seek(iPosition);
  pFile->iPos = (int32_t)f->position();
  i = micros() - i;
//  Serial.printf("Seek time = %d us\n", i);
  return pFile->iPos;
} /* GIFSeekFile() */

// Draw a line of image directly on the LCD
void GIFDraw(GIFDRAW *pDraw)
{
    uint8_t *s;
    uint16_t *d, *usPalette, usTemp[320];
    int x, y, iWidth;

    iWidth = pDraw->iWidth;
    // Serial.printf("Drawing %d pixels\n", iWidth);

    if (iWidth + pDraw->iX > DISPLAY_WIDTH)
       iWidth = DISPLAY_WIDTH - pDraw->iX;
    usPalette = pDraw->pPalette;
    y = pDraw->iY + pDraw->y; // current line
    if (y >= DISPLAY_HEIGHT || pDraw->iX >= DISPLAY_WIDTH || iWidth < 1)
       return; 
    s = pDraw->pPixels;
    if (pDraw->ucDisposalMethod == 2) // restore to background color
    {
      for (x=0; x<iWidth; x++)
      {
        if (s[x] == pDraw->ucTransparent)
           s[x] = pDraw->ucBackground;
      }
      pDraw->ucHasTransparency = 0;
    }

    // Apply the new pixels to the main image
    if (pDraw->ucHasTransparency) // if transparency used
    {
      uint8_t *pEnd, c, ucTransparent = pDraw->ucTransparent;
      int x, iCount;
      pEnd = s + iWidth;
      x = 0;
      iCount = 0; // count non-transparent pixels
      while(x < iWidth)
      {
        c = ucTransparent-1;
        d = usTemp;
        while (c != ucTransparent && s < pEnd)
        {
          c = *s++;
          if (c == ucTransparent) // done, stop
          {
            s--; // back up to treat it like transparent
          }
          else // opaque
          {
             *d++ = usPalette[c];
             iCount++;
          }
        } // while looking for opaque pixels
        if (iCount) // any opaque pixels?
        {
          tft.startWrite();
          tft.setAddrWindow(pDraw->iX+x, y, iCount, 1);
          tft.writePixels(usTemp, iCount, false, false);
          tft.endWrite();
          x += iCount;
          iCount = 0;
        }
        // no, look for a run of transparent pixels
        c = ucTransparent;
        while (c == ucTransparent && s < pEnd)
        {
          c = *s++;
          if (c == ucTransparent)
             iCount++;
          else
             s--; 
        }
        if (iCount)
        {
          x += iCount; // skip these
          iCount = 0;
        }
      }
    }
    else
    {
      s = pDraw->pPixels;
      // Translate the 8-bit pixels through the RGB565 palette (already byte reversed)
      for (x=0; x<iWidth; x++)
        usTemp[x] = usPalette[*s++];
      tft.startWrite();
      tft.setAddrWindow(pDraw->iX, y, iWidth, 1);
      tft.writePixels(usTemp, iWidth, false, false);
      tft.endWrite();
    }
} /* GIFDraw() */


void setup() {
  Serial.begin(115200);
  while (!Serial);

  Serial.println("Adafruit SPIFlash Animated GIF Example");

  // Initialize flash library and check its chip ID.
  if (!flash.begin()) {
    Serial.println("Error, failed to initialize flash chip!");
    while(1);
  }
  Serial.print("Flash chip JEDEC ID: 0x"); Serial.println(flash.getJEDECID(), HEX);

  // First call begin to mount the filesystem.  Check that it returns true
  // to make sure the filesystem was mounted.
  if (!fatfs.begin(&flash)) {
    Serial.println("Failed to mount filesystem!");
    Serial.println("Was CircuitPython loaded on the board first to create the filesystem?");
    while(1);
  }
  Serial.println("Mounted filesystem!");

  if (!root.open(GIFDIRNAME)) {
    Serial.println("Open dir failed");
  }
  while (f.openNext(&root, O_RDONLY)) {
    f.printFileSize(&Serial);
    Serial.write(' ');
    f.printModifyDateTime(&Serial);
    Serial.write(' ');
    f.printName(&Serial);
    if (f.isDir()) {
      // Indicate a directory.
      Serial.write('/');
    }
    Serial.println();
    f.close();
  }
  root.close();
  
  tft.init(DISPLAY_HEIGHT, DISPLAY_WIDTH);
  tft.fillScreen(ST77XX_BLUE);
  tft.setRotation(1);
  gif.begin(LITTLE_ENDIAN_PIXELS);
}

void loop() {
  char thefilename[80];
  
  if (!root.open(GIFDIRNAME)) {
    Serial.println("Open GIF directory failed");
    while (1);
  }
  while (f.openNext(&root, O_RDONLY)) {
    f.printFileSize(&Serial);
    Serial.write(' ');
    f.printModifyDateTime(&Serial);
    Serial.write(' ');
    f.printName(&Serial);
    if (f.isDir()) {
      // Indicate a directory.
      Serial.write('/');
    }
    Serial.println();
    f.getName(thefilename, sizeof(thefilename)-1);
    f.close();
    if (strstr(thefilename, ".gif") || strstr(thefilename, ".GIF")) {
      // found a gif mebe!
      if (gif.open(thefilename, GIFOpenFile, GIFCloseFile, GIFReadFile, GIFSeekFile, GIFDraw)) {
        GIFINFO gi;
        Serial.printf("Successfully opened GIF %s; Canvas size = %d x %d\n",  thefilename, gif.getCanvasWidth(), gif.getCanvasHeight());
        if (gif.getInfo(&gi)) {
          Serial.printf("frame count: %d\n", gi.iFrameCount);
          Serial.printf("duration: %d ms\n", gi.iDuration);
          Serial.printf("max delay: %d ms\n", gi.iMaxDelay);
          Serial.printf("min delay: %d ms\n", gi.iMinDelay);
        }
        // play thru n times
        for (int loops=0; loops<NUM_LOOPS; loops++) {
          while (gif.playFrame(true, NULL));
          gif.reset();
        }
        gif.close();
      } else {
        Serial.printf("Error opening file %s = %d\n", thefilename, gif.getLastError());
      }
    }
  }
  root.close();
}


As you can see, the only difference from the original code form Adafruit is the modification of height dimension which I adapted to fit the dimension of my display.

Yes, i did drag-n-drop the GIF onto the CIRCUITPY drive. I tried with different GIFs. Is there a way to know if the GIF has the right format forthis project (size, frame number, etc.) ?

When you are talking about syntax issues, do you mean that the name of the GIF file has to be a certain way? or is this about the code?


Laïla

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

Laïla,

Have you been able to load the stock example 320 resolution GIF's that adafruit provides? Do not rename the files.

If not, can you start with those.

Also the code change you made for the DISPLAY from 174 --> 170. Please set that back initially in case it has any effect.

I'd like to get you going with loading the stock examples first then we can get into a custom GIF discussion.

I take it you are developing on a MAC? You mentioned invisible files showing up. Make sure to remove the ones you can then power the controller from a dumb-USB power supply (eg. non-computer) or another OS.
Invisible Mac files will crash the gif decoder. Make sure to remove all hidden files created by Mac OS

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Thank you for you reply.

1-First of all, I noticed that there is a modification in the code provided on arn.adafruit.com/mini-gif-players/codin ... if-players . Is this a recent update from Adafruit? However, now when I Verify the code on Arduino IDE, I recieve the following error message :
Screen Shot 2022-10-19 at 3.20.05 PM.png
Screen Shot 2022-10-19 at 3.20.05 PM.png (633.55 KiB) Viewed 287 times
I deleted the "32" on every "File32" to make it work, but when I upload it on my RP2040, the same error message "Error opening file ._Arduino-Logo-320.gif = 8" appear on my serial monitor.

Here is the entire message on the serial monitor:
115 2020-01-01 00:00:06 boot_out.txt
0 2022-10-12 18:53:52 .Trashes/
142692 2022-10-19 14:27:08 Arduino-Logo-320.gif
Successfully opened GIF Arduino-Logo-320.gif; Canvas size = 320 x 170
frame count: 1
duration: 40 ms
max delay: 40 ms
min delay: 10000 ms
4096 2022-10-19 14:27:44 ._Arduino-Logo-320.gif
Error opening file ._Arduino-Logo-320.gif = 8

2- I am using the GIF "Arduino-Logo-320.gif" downloaded from Adafruit's website (attached). Is that the stock example 320 resolution GIF? I didn't rename the file.

3- I tried without changing the DISPLAY from 174 to 170 and it also gave me the "Error opening file ._Arduino-Logo-320.gif = 8". error message.

4- Yes, I am working on MAC. I delete the invisible Mac files everytime I reconnect my RP2040 but the .Trashes folder is an invisible file that can not be deleted. This is a screen capture of my drive before uploading the code:
Screen Shot 2022-10-12 at 6.33.06 PM.png
Screen Shot 2022-10-12 at 6.33.06 PM.png (115.31 KiB) Viewed 287 times
5- I don't have access to a dumb-USB power supply for now, but I am powering the whole thing with a lithium battery as proposed in the Adafruit guide. Here are some photos of my set-up:
Image
Attachments
Arduino-Logo-320.gif
Arduino-Logo-320.gif (139.35 KiB) Viewed 287 times

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

IMG_8125 copy.jpg
IMG_8125 copy.jpg (180.04 KiB) Viewed 287 times

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Sorry, I just want to correct :

-Point 1, the URL is :https://learn.adafruit.com/mini-gif-pla ... if-players

-Point 4, the screen capture of my drive before uploading the code is
Screen Shot 2022-10-12 at 6.34.34 PM.png
Screen Shot 2022-10-12 at 6.34.34 PM.png (96 KiB) Viewed 287 times
:

Sorry for the confusions

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

The code is looking for a file called:

Code: Select all

Arduino-Logo-320.gif
but in your screenshots from the file manager I see:

Arduino-Logo-320-B.gif

Why the '-B'?

I see a change to the Mini_GIF_Players.ino taking place 3-days ago. It was the File --> File32 change.

https://github.com/adafruit/Adafruit_Le ... 5dff656101

Which version of Arduino are you using? It looks like a 2.x interface. It would be a good idea to be using 1.8.19.

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Thank you for your reply,

The "B" was my mistake. I tried again with the and this is the message I get in my serial monitor:

Adafruit SPIFlash Animated GIF Example
Flash chip JEDEC ID: 0xC84017
Mounted filesystem!
22 2020-01-01 00:00:04 code.py
115 2020-01-01 00:00:06 boot_out.txt
0 2022-10-12 18:53:52 .Trashes/
142692 2022-10-19 14:27:08 Arduino-Logo-320.gif
4096 2022-10-19 14:27:44 ._Arduino-Logo-320.gif
22 2020-01-01 00:00:04 code.py
115 2020-01-01 00:00:06 boot_out.txt
0 2022-10-12 18:53:52 .Trashes/
142692 2022-10-19 14:27:08 Arduino-Logo-320.gif
Successfully opened GIF Arduino-Logo-320.gif; Canvas size = 320 x 170
frame count: 1
duration: 40 ms
max delay: 40 ms
min delay: 10000 ms
4096 2022-10-19 14:27:44 ._Arduino-Logo-320.gif
Error opening file ._Arduino-Logo-320.gif = 8
Screen Shot 2022-10-20 at 12.51.39 PM.png
Screen Shot 2022-10-20 at 12.51.39 PM.png (114.12 KiB) Viewed 280 times
I tried to download Arduino IDE 1.8.19 on
https://www.arduino.cc/en/software but when I download the Mac OS version, it gives me Arduino and not Arduino IDE software.
On Adafruit website it is written :
Screen Shot 2022-10-20 at 1.25.14 PM.png
Screen Shot 2022-10-20 at 1.25.14 PM.png (41.93 KiB) Viewed 280 times
Is this project supposed to work with Mac computer?

Is there a way I can do work with Arduino IDE 1.8.19. interface on Mac, or should I work with Arduino 1.8.19. ?

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

Arduino and Arduino IDE are being used interchangeably here.

As long as you grabbed the legacy v1.8.19 release you should be able to then install the Philhower core.

https://downloads.arduino.cc/arduino-1.8.19-macosx.zip

I am concerned that the '.Trashes/' folder that MacOS keeps adding might be an issue. Notice how the Arduino-Logo-320.gif file has a '._' prefix on when the file is found, but fails to open.

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Yes, I think this prefix is the main issue and I don’t know where it comes from.

Do you know how to delete invisible Trash file? Should I simply try to do the same thing on a non Mac comptuter?

I am going to try with Arduino 1.8.19 tomorrow.

could you confirm the libraries I will have to install on Arduino 1.8.19 for this project?

Thank you very much!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

You can stop some OSX file system polution:

Code: Select all

touch /Volumes/CIRCUITPY/.metadata_never_index
chmod 444 /Volumes/CIRCUITPY/.metadata_never_index
It will still try and create a .Trashes folder. The easiest way to prevent the folder from being produced is to trash the existing .Trashes and touch a file version (not a directory). This could still mess up the GIF player, but is worth a try.

Code: Select all

cd /Volumes/CIRCUITPY
sudo rm -rf .Trashes
touch .Trashes
If the Arduino code is still adding the '._' when loading the file then using another machine would be in order.

These libraries need to be installed along with the PhilHower Core.

https://learn.adafruit.com/adafruit-fea ... -ide-setup

Adafruit SPIFlash
Adafruit GFX
Adafruit ST7789
Adafruit SdFat (Fork)

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Hi,

I downlowded Arduino 1.8.19 and went througth the steps to prepare my RP2040. I ran a Blink sketch with his software sketch and it worked well.

Now, when I uploaded the code for the GIF animation, my serial Monitor was showing this message:

Adafruit SPIFlash Animated GIF Example
Flash chip JEDEC ID: 0xC84017
Failed to mount filesystem!
Was CircuitPython loaded on the board first to create the filesystem?

and the screen was black. So I restarted my RP2040 and re-"drag-n-drop" Cytcuitpyton on the drive. After uploading the code on the drive, I could see this message on my serial monitor:

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.


I guess its a good sing because there is a green light flashing on my RP2040 now and because the error message is not there anymore... but I still don't see any image displayed on my screen. Also, I left the "File32" as is in the code and it doesn't seem to cause problem on this Arduino this time. Also, this message appear at the bottom on the Arduino window and I don't know if there is something there:
Screen Shot 2022-10-22 at 3.55.57 PM.png
Screen Shot 2022-10-22 at 3.55.57 PM.png (83.95 KiB) Viewed 270 times
Do you think I should do something more about invisible Mac files? I have to say that it is diffuclt for me to understand the explainations you gave me on this matter. Is this a code to include in my arduino code?

"touch /Volumes/CIRCUITPY/.metadata_never_index
chmod 444 /Volumes/CIRCUITPY/.metadata_never_index"

I also don't really understand what it means "trash the existing .Trashes and touch a file version (not a directory)." and I am not sure that the problem is there.

Thank you in advance for your help

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by mikeysklar »

The part that is concerning and we should resolve first is:
Failed to mount filesystem!

Code: Select all

  // First call begin to mount the filesystem.  Check that it returns true
  // to make sure the filesystem was mounted.
  if (!fatfs.begin(&flash)) {
    Serial.println("Failed to mount filesystem!");
    Serial.println("Was CircuitPython loaded on the board first to create the filesystem?");
It sounds like you tried to update the Arduino code, but had not re-installed CircuitPython first. Since you post went on to the CircuitPython part later with "Hello, World" showing up on the console you should be able to go back to Arduino now and re-upload the GIF viewer.

The Mini GIF guide provides a NUKE UF2 image which might be necessary to start fresh and go in this order:

* Nuke Image
* CircuitPython Install
* cp GIF files
* Arduino Code upload

The command I provided in my previous reply to remove the dot files are intended to be run via command line.

User avatar
Laila_Mestari
 
Posts: 50
Joined: Wed Oct 12, 2022 8:00 pm

Re: RP2040 and TFT, Mini GIF player "Error opening file" (black screen)

Post by Laila_Mestari »

Hi,

I followed steps you gave + I used the CircuitPython 8.0.0-beta.3 instead of CircuitPython 7.3.3

good news: I was able to delete all invisible Mac files.

But when I upload the code on Arduino, the serial monitor still shows:
Adafruit SPIFlash Animated GIF Example
Flash chip JEDEC ID: 0xC84017
Failed to mount filesystem!
Was CircuitPython loaded on the board first to create the filesystem?

Now, when I upload it throught Arduino IDE, I get this error message:

Sketch uses 74188 bytes (0%) of program storage space. Maximum is 8384512 bytes.
Global variables use 33300 bytes (12%) of dynamic memory, leaving 228844 bytes for local variables. Maximum is 262144 bytes.
Resetting /dev/cu.usbmodem14201
Converting to uf2, output size: 179712, start address: 0x2000
No drive to deploy.
Failed uploading: uploading error: exit status 1


The wierd thing this is that when I plug everything on the computer and BEFORE LOADING THE CODE, My Arduino serial monitor shows this(+the RP2040 flashes green but the sceen doesnt play anything):

Press any key to enter the REPL. Use CTRL-D to reload.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
]0;🐍code.py | 8.0.0-beta.3\Hello World!
]0;🐍Done | 8.0.0-beta.3\
Code done running.


Also, I go online to get the code each time that I work on this project and I realise that the code is constantly modified. Is that normal? Do you know if this project is working for other people?


Thank you

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

Return to “Feather - Adafruit's lightweight platform”