RP2040 Feather 1.47" 172*320 ST7789 TFT

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.
Locked
User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

Hello everyone.
I am doing this gif project (https://learn.adafruit.com/mini-gif-players/assemble). I wired a screen. At first, I installed Circuit Python as it said and started the Arduino, but nothing showed up on the screen. The Serial console was jammed by the response. Nothing showed up. I tried again for 30 more minutes. It still didn't work. I restarted the whole board 5 times with the nuke, checked my wiring at least a dozen times, checked connectivity, and restarted the IDE, but nothing would work.
Please help.
Thanks in advance,
Skip_God
Attachments
bob.png
bob.png (643.47 KiB) Viewed 571 times

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

Can you post some photos of your Hardware setup? Maybe there is something off in the wiring or soldering?

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

Okay.

I have already soldered it so it might be really hard to see it.
image_4.jpeg
image_4.jpeg (547.09 KiB) Viewed 565 times
image_3.jpeg
image_3.jpeg (492.44 KiB) Viewed 565 times
image_2.jpeg
image_2.jpeg (546.58 KiB) Viewed 565 times

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Thu Sep 22, 2022 6:58 pm Can you post some photos of your Hardware setup? Maybe there is something off in the wiring or soldering?
I have taken pictures of it on the bottom

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

Thank you for the photos. They are good quality and show all angles of both boards.

The MicroSD board could use some more solder on a few pins where it does not fill the via entirely. Probably best to go over them all (both boards), but the orange, yellow and black wire stood out as not having good enough flow.

Can you post your Arduino code in CODE tags as you have modified it for your pins and display?

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Fri Sep 23, 2022 3:57 pm Thank you for the photos. They are good quality and show all angles of both boards.

The MicroSD board could use some more solder on a few pins where it does not fill the via entirely. Probably best to go over them all (both boards), but the orange, yellow and black wire stood out as not having good enough flow.

Can you post your Arduino code in CODE tags as you have modified it for your pins and display?
Sure:

Code: Select all

#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 172

#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;
File 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)
{
  File *f = static_cast<File *>(pHandle);
  if (f != NULL)
     f->close();
} /* GIFCloseFile() */

int32_t GIFReadFile(GIFFILE *pFile, uint8_t *pBuf, int32_t iLen)
{
    int32_t iBytesRead;
    iBytesRead = iLen;
    File *f = static_cast<File *>(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();
  File *f = static_cast<File *>(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();
}
I just realized that a picture of my Circuit python drive might be helpful to you.
drive_gif.png
drive_gif.png (122.57 KiB) Viewed 445 times

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

It looks like the only significant change you have made to your code was setting the display height to 172 instead of 174. Try setting it back to match the example code.

The drive image you showed is interesting. You do have some dot files that might be considered invisible.

* .Trashes
* .fseventsd
*.meta_never_index
Invisible Mac files will crash the gif decoder. Make sure to remove all hidden files created by Mac OS
Which GIFs have tried playing? I see the badger-172 GIF listed. Can you copy some others from the 320 and 172 folders into the '/' folder as well?

https://github.com/adafruit/Adafruit_Le ... fruit_gifs

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Sun Sep 25, 2022 6:16 pm It looks like the only significant change you have made to your code was setting the display height to 172 instead of 174. Try setting it back to match the example code.

The drive image you showed is interesting. You do have some dot files that might be considered invisible.

* .Trashes
* .fseventsd
*.meta_never_index
Invisible Mac files will crash the gif decoder. Make sure to remove all hidden files created by Mac OS
Which GIFs have tried playing? I see the badger-172 GIF listed. Can you copy some others from the 320 and 172 folders into the '/' folder as well?

https://github.com/adafruit/Adafruit_Le ... fruit_gifs
Okay. I will include some pictures of my newly soldered feather and screen, my code, and my circuit python drive.
Error_Message.png
Error_Message.png (598 KiB) Viewed 290 times
Screenshot 2022-09-26 151557.png
Screenshot 2022-09-26 151557.png (48.79 KiB) Viewed 290 times

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

Also, I have noticed green lights on the feather periodically. Is this good or bad?

Remaining Pictures:
IMG_5170.jpg
IMG_5170.jpg (35.81 KiB) Viewed 289 times
IMG_5171.jpg
IMG_5171.jpg (51.47 KiB) Viewed 289 times
Again, thanks in advance.

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

Green light status with CircuitPython means the code completed running. I'm not sure with Arduino, but I suspect that is also good (not yellow or red).

I'm still concerned with the soldering not having a smooth flow on the RP2040 and the display pins. It is blobby and not filling the vias all the way. What temperature are you soldering at? Are you able to measure conductivity with a multimeter?

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Mon Sep 26, 2022 9:51 pm Green light status with CircuitPython means the code completed running. I'm not sure with Arduino, but I suspect that is also good (not yellow or red).

I'm still concerned with the soldering not having a smooth flow on the RP2040 and the display pins. It is blobby and not filling the vias all the way. What temperature are you soldering at? Are you able to measure conductivity with a multimeter?
I honestly have no idea. The soldering iron was a $20 item. I have been using it for a few years for Adafruit tutorials such as the Pigirrl 2.0 and it has gone through a lot of solder. I wanted to extend its lifespan to the end of this year, but maybe the problem is that I need a new soldering iron. Also, regarding the multimeter, I can't use it right now, but I will update you on that in a little bit.

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

Maybe you have access to another soldering iron? I know it can be an investment, but the trio of:

* quality iron
* good light
* magnification

will make your soldering look like a pro did it.

https://learn.adafruit.com/adafruit-gui ... -soldering

I use a Hakko FX-888D and cannot say enough good things about it.

https://www.adafruit.com/product/1204

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Tue Sep 27, 2022 3:47 pm Maybe you have access to another soldering iron? I know it can be an investment, but the trio of:

* quality iron
* good light
* magnification

will make your soldering look like a pro did it.

https://learn.adafruit.com/adafruit-gui ... -soldering

I use a Hakko FX-888D and cannot say enough good things about it.

https://www.adafruit.com/product/1204
Sure. I will definitely consider buying the Hakko FX-888D for sure. I just checked the screen's connectivity and the multimeter isn't beeping so I guess it is my soldering iron that I need to replace because I have good magnification and good light. I will let you know when I get it, but thanks for helping me.

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

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by mikeysklar »

We can resume this thread if you are still having issues with this setup after repairing all the connections.

User avatar
Skip_God
 
Posts: 18
Joined: Tue Feb 01, 2022 7:23 pm

Re: RP2040 Feather 1.47" 172*320 ST7789 TFT

Post by Skip_God »

mikeysklar wrote: Wed Sep 28, 2022 3:52 pm We can resume this thread if you are still having issues with this setup after repairing all the connections.
Okay, got it.

Thanks

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

Return to “Feather - Adafruit's lightweight platform”