Argon TFT featherwing 480x320 displaying a bmp from SD card

My second post. I am having issues trying to get my program to compile. I am unable to find an example of this working on a particle/argon. The errors are so numerous that its probably best if someone has a simple example than to try to sort this out. I have been able to get the tft to display text and draw lines, etc… but can’t seem to get a bmp from the sdcard to display. I have tried numerous libraries, of course i included the gfx_RK,and the HX3857_RK which worked for the text and drawing lines… i added SDfat and imageReader libraries and then the trouble started.

Any examples out there?

Thanks, Jim

Not sure (due to HX3857 vs HX8357 - might be a typo), but I could imagine that this sample may provide some hints
https://build.particle.io/libs/Adafruit_HX8357/0.9.8/tab/example/SpiTftBitmap.ino

Yes, that was a typo… sorry. I think i could probably pull off this on an arduino, the issue is the RK libraries, OR, perhaps something else. I know that googling some of the errors i have gotten, those quys with the errors are told to upgrade their libraries. Currently the library for the RK is 1.0.8, the newer libraries that fixed their issues they reported, were 1.1.1 or later. I must admit, my issues are in part moving from arduino and the arduino ide to VScode. So I think i have library issues, pin issues, and lack knowledge of c++. Hence, i was hoping to see a working example on the argon with the featherwing tft/SD card… I have the graphics workiing on the TFT with argon… its the SD card that is kicking my …

I will mention, that example you sent, only has the HX8357 and SDFat libraries… I have those, and in lieu of the HX8357 i have the HX8357_RK plus the GFX_RK, ImageReader,Spiflash (which i don’t think i need), STMPE610, and a few others. My fail to compile displays a lot of errors from the ImageReader, and SPIFlash libraries.

Have you tried this combination?

image

It definitely compiles without error and I can read .bmp files from SD to the screen. My only observation is that the screen write speed is slow - certainly versus a Photon with a ILI9341 (320x240). It is most definitely a HX8357.
Includes were like this
image

And library versions
image

Hope that helps you - did you #include “Particle.h” ?

Thanks so much for the pointers… i have been all over the place with different libraries, but i am using the same ones you are now, except i do have the GFX_RK in addition. The particle library is not declared in the main ino, but it is in the HX8357.h file. I had a second look at what Scruff suggested and have tried using that code (it has gotten me the closest to getting this to work). I have gotten it to compile and flash, but for some reason, my initial program still displays (it draws lines and text on the screen instead of loading a BMP), it flashes for a second a white screen (the bmp is not white and my program is black with white text) but goes right back to the original program. I don’t even understand how that is possible. I even have reinstalled the toolchain a few times.

The sample code i am using:
https://build.particle.io/libs/Adafruit_HX8357/0.9.8/tab/example/SpiTftBitmap.ino

These are my defines… (cause this is about all i have changed to the code linked above - what was there didn’t work)

#define SDcard D2
#define TouchScr D3
#define DisplayCS D4
#define DisplayDC D5
#define TFT_RST -1 
#define SPIMasterIn MISO
#define SPIMasterOut MOSI
#define Clock SCK

And my Adafruit_HX8357 tft() class

Adafruit_HX8357 tft(DisplayCS, DisplayDC, TFT_RST); 

I think the pins in the class above are messed up… i have tried so many different combinations.

Again, thanks for the library version info. Not knowing what is wrong i have been switching out libraries to make it work. even tried using the SD library and an old ImageReader library.

cheers,

jim

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
#define TFT_LITE D6 //Lite wired to D6 pin to control LED brightness
#define TFT_DC D5
#define TFT_CS D4
#define STMPE_CS D3
#define SD_CS D2
#define TFT_RST -1

I think they look right compared to mine.

I do remember having to solder some links to get it working.

I would use the _RK versions - I know they ‘only’ appear to wrap the original versions but they have been tested and therefore tend to work.

Hi Armor,

Yes, I have used the RK files. Exactly the same libraries as you, with the exception of those additional libraries i need, and you need (like the font) libraries which are different.

I did read something about the soldering and was a bit overwhelmed at the time… i may check into that some more. Maybe that is the issue. lol… maybe the code is perfect and it is a hardware issue. That would be a first for this project!

Thanks for your advise, jim

I have just found the board and checked - the ONLY thing I soldered was pin D6 to the pad marked 'Lite'.

I have shared below how I have declared the various objects and setup to draw a .bmp file to screen.

SdFat sd;
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
Adafruit_ImageReader reader;     // Class w/image-reading functions
Adafruit_Image       img;        // An image loaded into RAM
int32_t              width  = 0, // BMP image dimensions
                     height = 0;
//
const char* const zlogo320 = "z32.bmp";
//
void setup()
{
  ImageReturnCode stat;       // Status from image-reading functions
  tft.begin();
  if (SDCardInit())
  {
    tft.fillScreen(HX8357_BLACK);
    stat = reader.drawBMP((char*)zlogo320, tft, sd, 0, 20);
    ts.begin();
  }
  else
  {
    return;
  }
}

Hi Armor,

Well, as embarrassing as this is, I suppose it might help the next guy. Your code works, as well as a tweak of it as I have now. The issue was, I was not using a correct “24bit” graphic. Even though I thought I was. So, my advise if someone happens along this thread, and its not loading a bmp, be sure to do your testing on the images provided in the libraries. It would have saved me about 30 hours of manipulating the code.

Just noticed your reply - good to hear you got it going. Could you make this topic as Solved?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.