Comments (5)
There are a large list of reasons why this may not work:
- SPI speed too high for the display and/or wiring
- Incorrect connections
Based on the GPIO numbers it looks like you're using an older ESP32 (original). That MCU doesn't have a GPIO 39. This could cause an internal exception and prevent the code from running. Have you checked the debug messages coming out of the serial port?
from bb_spi_lcd.
Hi Larry,
Thanks for your answer,
I am using ESP32 WROOM module and use this one for many year already, I confirm with exactly same setup for IO with other library and it works
SPI speed is given in the other library (TFT_eSPI library) to 27000000
I alredy try with that with no more success
I should have that ILI9341 in some old stock, I will check with your original code to confirm tmr
from bb_spi_lcd.
Hi Larry,
Today I get a fresh new ILI9341 from my stock and test it with the other library on same board to confirm all pin setup
I just change those in your original example but only succeed to light the screen
I just change pin and add TFT_BL and TFT_MISO compare to your original
Here is my MOD
//
// ZIP library example sketch
//
// Written by Larry Bank
// June 9, 2021
//
// This example shows how to do the following:
// - Step through all of the files in a ZIP archive
// - Display the name of each file
// - Allocate a buffer for the uncompressed file size
// - Read (decompress) the data into the buffer
// - Display the results (in this case a BMP file) on the SPI LCD
//
#include <unzipLIB.h>
#include <bb_spi_lcd.h>
// Set these to the appropriate values for your SPI LCD display
// -1 means the pin is not connected
// The CLK and MOSI pins might be -1 for your board if it has a default SPI setup
#define TFT_CS 4
#define TFT_RST -1
#define TFT_DC 25
#define TFT_CLK 18
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_BL 13
// Use a zip file in memory for this test
#include "bmp_icons.h"
UNZIP zip; // Statically allocate the 41K UNZIP class/structure
SPILCD lcd; // my display library
void setup() {
Serial.begin(115200);
delay(1000); // give Serial a little time to start
spilcdInit(&lcd, LCD_ILI9341, FLAGS_NONE, 40000000, TFT_CS, TFT_DC, TFT_RST, TFT_BL, TFT_MISO, TFT_MOSI, TFT_CLK);
spilcdSetOrientation(&lcd, LCD_ORIENTATION_90); // for the ILI9341 it's nice to use it in 320x240 orientation
}
void loop() {
int rc, x, y;
char szComment[256], szName[256];
unz_file_info fi;
uint8_t *ucBitmap; // temp storage for each icon bitmap
spilcdFill(&lcd, 0, DRAW_TO_LCD); // Erase the display to black
spilcdWriteString(&lcd, 0, 0, (char *)"Unzip BMP Files Test", 0xffff, 0, FONT_12x16, DRAW_TO_LCD); // white text on a black background
x = 0; y = 24; // starting point to draw bitmaps
rc = zip.openZIP((uint8_t *)bmp_icons, sizeof(bmp_icons));
if (rc == UNZ_OK) {
rc = zip.getGlobalComment(szComment, sizeof(szComment));
Serial.print("Global comment: ");
Serial.println(szComment);
zip.gotoFirstFile();
rc = UNZ_OK;
while (rc == UNZ_OK) { // Display all files contained in the archive
rc = zip.getFileInfo(&fi, szName, sizeof(szName), NULL, 0, szComment, sizeof(szComment));
if (rc == UNZ_OK) {
ucBitmap = (uint8_t *)malloc(fi.uncompressed_size); // allocate enough to hold the bitmap
if (ucBitmap != NULL) { // malloc succeeded (it should, these bitmaps are only 2K bytes each)
zip.openCurrentFile(); // if you don't open it explicitly, readCurrentFile will fail with UNZ_PARAMERROR
spilcdWriteString(&lcd, 0, 224, " ", 0xff1f, 0, FONT_12x16, DRAW_TO_LCD); // erase old name
spilcdWriteString(&lcd, 0, 224, szName, 0xff1f, 0, FONT_12x16, DRAW_TO_LCD); // display current file name at the bottom
rc = zip.readCurrentFile(ucBitmap, fi.uncompressed_size); // we know the uncompressed size of these BMP images
if (rc != fi.uncompressed_size) {
Serial.print("Read error, rc=");
Serial.println(rc, DEC);
}
spilcdDrawBMP(&lcd, ucBitmap, x, y, 1, -1, DRAW_TO_LCD); // Display the BMP file stretched 2X starting at (x,y)
x += 64; // Draw them across the display from left to right
if (x >= 256) { // move down for the next row
x = 0;
y += 64;
}
free(ucBitmap); // finished with this bitmap
}
delay(1000); // Allow time to see it happen, otherwise it will zip by too quickly
}
rc = zip.gotoNextFile();
}
zip.closeZIP();
}
// while (1) {};
}
Serial give : Global comment: 32x32 icon collection in Windows BMP format
from bb_spi_lcd.
What other library are you testing with? Can you show that demo code? Can you share a photo of your display and setuup?
Start simpler - get rid of everything except the display initialization. Clear it to a specific color and draw some text.
from bb_spi_lcd.
Hello Larry,
I finally succed to run your sketch on ILI9341 giving all the pin like this
//
// ZIP library example sketch
//
// Written by Larry Bank
// June 9, 2021
//
// This example shows how to do the following:
// - Step through all of the files in a ZIP archive
// - Display the name of each file
// - Allocate a buffer for the uncompressed file size
// - Read (decompress) the data into the buffer
// - Display the results (in this case a BMP file) on the SPI LCD
//
#include <unzipLIB.h>
#include <bb_spi_lcd.h>
// Set these to the appropriate values for your SPI LCD display
// -1 means the pin is not connected
// The CLK and MOSI pins might be -1 for your board if it has a default SPI setup
#define TFT_CS 4
#define TFT_RST 26
#define TFT_DC 25
#define TFT_CLK 18
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_BL 13
// Use a zip file in memory for this test
#include "bmp_icons.h"
UNZIP zip; // Statically allocate the 41K UNZIP class/structure
SPILCD lcd; // my display library
void setup() {
Serial.begin(115200);
delay(1000); // give Serial a little time to start
spilcdInit(&lcd, LCD_ILI9341, FLAGS_NONE, 40000000, TFT_CS, TFT_DC, TFT_RST, TFT_BL, TFT_MISO, TFT_MOSI, TFT_CLK);
spilcdSetOrientation(&lcd, LCD_ORIENTATION_270); // for the ILI9341 it's nice to use it in 320x240 orientation
}
void loop() {
int rc, x, y;
char szComment[256], szName[256];
unz_file_info fi;
uint8_t *ucBitmap; // temp storage for each icon bitmap
spilcdFill(&lcd, 0, DRAW_TO_LCD); // Erase the display to black
spilcdWriteString(&lcd, 0, 0, (char *)"Unzip BMP Files Test", 0xffff, 0, FONT_12x16, DRAW_TO_LCD); // white text on a black background
x = 0; y = 24; // starting point to draw bitmaps
rc = zip.openZIP((uint8_t *)bmp_icons, sizeof(bmp_icons));
if (rc == UNZ_OK) {
rc = zip.getGlobalComment(szComment, sizeof(szComment));
Serial.print("Global comment: ");
Serial.println(szComment);
zip.gotoFirstFile();
rc = UNZ_OK;
while (rc == UNZ_OK) { // Display all files contained in the archive
rc = zip.getFileInfo(&fi, szName, sizeof(szName), NULL, 0, szComment, sizeof(szComment));
if (rc == UNZ_OK) {
ucBitmap = (uint8_t *)malloc(fi.uncompressed_size); // allocate enough to hold the bitmap
if (ucBitmap != NULL) { // malloc succeeded (it should, these bitmaps are only 2K bytes each)
zip.openCurrentFile(); // if you don't open it explicitly, readCurrentFile will fail with UNZ_PARAMERROR
spilcdWriteString(&lcd, 0, 224, " ", 0xff1f, 0, FONT_12x16, DRAW_TO_LCD); // erase old name
spilcdWriteString(&lcd, 0, 224, szName, 0xff1f, 0, FONT_12x16, DRAW_TO_LCD); // display current file name at the bottom
rc = zip.readCurrentFile(ucBitmap, fi.uncompressed_size); // we know the uncompressed size of these BMP images
if (rc != fi.uncompressed_size) {
Serial.print("Read error, rc=");
Serial.println(rc, DEC);
}
spilcdDrawBMP(&lcd, ucBitmap, x, y, 1, -1, DRAW_TO_LCD); // Display the BMP file stretched 2X starting at (x,y)
x += 64; // Draw them across the display from left to right
if (x >= 256) { // move down for the next row
x = 0;
y += 64;
}
free(ucBitmap); // finished with this bitmap
}
delay(1000); // Allow time to see it happen, otherwise it will zip by too quickly
}
rc = zip.gotoNextFile();
}
zip.closeZIP();
}
// while (1) {};
}
BUT if I change to ILI9488
spilcdInit(&lcd, LCD_ILI9488, FLAGS_NONE, 40000000, TFT_CS, TFT_DC, TFT_RST, TFT_BL, TFT_MISO, TFT_MOSI, TFT_CLK);
it just start illuminate background but didn't display anything
from bb_spi_lcd.
Related Issues (18)
- Does not build (on Linux at least) HOT 1
- How did you create the gif.h? HOT 5
- rlottie widget for bb_spi_lcd HOT 1
- Library crashes when display class is instantiated in c++ style HOT 2
- 'esp_lcd_i80_bus_config_t' has no non-static data member named 'psram_trans_align' HOT 4
- Please add LilyGo T-Dongle S3 [LCD ST7735] HOT 2
- Enhancement: setPower(bool bOn); HOT 1
- Touch controller support. HOT 1
- Errors trying to compile and run on ESP32 HOT 11
- Crash when trying to draw image on ESP32 HOT 10
- DRAW_WITH_DMA only draw half of the screen HOT 4
- Current version from master clashes with bb_captouch HOT 2
- Version <2.5.0 doesn't compile on Teensy HOT 1
- Add support MicroPython HOT 1
- Any example of the void pushImage and drawBMP of this library HOT 1
- 2.6.0 does not compile for #defined ARDUINO_ESP32S3_DEV HOT 4
- DMA option for BB_SPI_LCD::begin to disable DMA when using SD card module on the same SPI bus HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bb_spi_lcd.