Giter Club home page Giter Club logo

Comments (12)

Bodmer avatar Bodmer commented on August 13, 2024 1

It would be possible to add some circuitry between the display and ESP32 but it would need some knowledge of electronics. Essentially you would need to prevent the SCK getting to the display while accessing the SD card, this could be done with an AND gate or equivalent circuit to keep the clock line to the display low while the SD card is being accessed. If you can tolerate a longer wait for displays from China (3-4weeks) then they are available from Aliexpress, so that is where I get mine.

The display without the chip select will still work but cannot share the SPI bus with anything else so you may still find it is useful on another project, like this Weather station which just needs a display and a WiFi internet connection to work.

Glad to hear you have it working.

from jpegdecoder.

Bodmer avatar Bodmer commented on August 13, 2024

Are you using the TFT_eSPI library or another graphics library?

I would guess you are using TFT_eSPI in that case run this example, which reads the Jpeg image from arrays stored in program memory. And this example which is for a bigger display.

You will need to set the CS line for the SD Card to high, or remove the SD Card to run these examples to avoid the SD card driving the SPI bus.

Run the graphics test to see if the display interface is working correctly.

Do the white blocks appear over a correct image or are those blocks always white if the image is repainted without clearing the screen?

Are the white blocks always in the same place on the same image?

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

Yes, i'm using TFT_eSPI library
I already tested the second example but i'm not interested in array storage because i need to show many images and memory goes down. However second example works fine but does not use JPEGdecoder.
First example seems made for arduino and seems does not work on ESP32. This example is not good for my goal because it uses array too.
Array or bmp (jpg, giff etc) must be on SD card and must be out from flash memory - the sketch is very big and i need memory for it :-(

the blocks are always white if the image is repainted without clearing the screen.
This is the code i tried:

tft.setRotation(2); // portrait
tft.fillScreen(random(0xFFFF));
drawSdJpeg("/lena20k.jpg", 0, 0);
delay(1000);
drawSdJpeg("/lena20k.jpg", 0, 0);

those blocks are always in the same place if the same image is reloaded, but every images has "proprietary" blocks, different from other images (the images of prevoius post are a valid example. them repeat the same error : blocks in the same place).

I do not necessarily need to display the jpeg format. Any format and any solution are fine. It is however mandatory that it is compatible with ESP32 and that the images are on an SD card

from jpegdecoder.

Bodmer avatar Bodmer commented on August 13, 2024

Both the examples linked to above use the jpeg decoder, you probably ran the wrong sketch. Make sure the sketch name you ran ends in _jpg

The request to run these is not to show an alternative storage method but to show if the FLASH jpeg examples work and decode and display correctly. This demonstrates therefore that the JPEGDecoder library must be working OK with your hardware and your interface to the TFT is reliable. This means the problem must lie with the sketch or the SD Card interface, or the SD library. In this case there is little I can do to advise you as I have run the sketch and it works fine on my setup with and ESP32.

The blocks you see as white are 16x16 pixel "Minimum Coding Units", it is likely that in each one of these blocks there is a bad byte which breaks the compression decoding. It could be that power cycling your setup or inserting and removing the card with the setup powered and running has corrupted each file. File corruption is indicated as the errors are always in the same block (so they are not "random errors" but consistent.

Possible causes:

  1. look at the power supply and see if it is adequate to power your hardware
  2. change the SD card to one of a different make, some cards are less reliable
  3. put the SD card in a PC and see if the files have been corrupted, fully format the SD card (not quick format) and renew the image files
  4. check if there are any reported issues with the SD library and the ESP32
  5. inserting and removing an SD card when the setup is powered and working sometimes corrupts the card files, file access must be stopped and the SPI bus must not be transferring data (event to the TFT) when you insert and remove the card otherwise the SD Card may see garbage erase commands

from jpegdecoder.

Bodmer avatar Bodmer commented on August 13, 2024

I have done some tests on the FLASH array examples, deliberately corrupting odd bytes in the array to see what happens, the image either decodes correctly with some small image blemishes or the whole of the rest of the image is corrupted. This behaviour is probably expected as each part of the image decoding process if dependent on the decoding history for all other decoded blocks. This suggests that there is a problem elsewhere....

I noticed the pictures you are using are not the right size for the display, so they are being clipped. Have you tried only images that will fit on your display, eg 320x240?

I have run tests on my setup and have not been able to reproduce anything like the fault you are getting. Are you running out of RAM? Maybe the JPEG decoder is demanding RAM but cannot get it for some reason?

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

i changed all hardware : esp32, card reader, card (from 2gb to 8 gb, formatted slow in fat32), display, images. i tried other images, smaller and bigger ....
all new but no lucky : the same problem, and in the old images the same blocks in the same places :-(

so, as you said, i think problems is elsewhere. it raises to see if the reason for the failure is due to the software.
there is enough memory : 19% used for sketch and 5% used for variables.

may i post here my little sketch so you can try it or there is a different way ?(i'm new on github, I would not want to go wrong with the rules).

from jpegdecoder.

Bodmer avatar Bodmer commented on August 13, 2024

You can post zip files to github with the message, so that is the easiest way. I will need the images as well (in the same zip file would make this easier), so that I can be sure the decoder is doing the same maths. Also which gpio pins you are using, so a copy of the setup file, which Arduino IDE version and which ESP32 board support package version you are using.

from jpegdecoder.

Bodmer avatar Bodmer commented on August 13, 2024

I think I know what the problem is...

I cannot see the TFT connections clearly but it looks like your TFT does not use a CS (chip select) signal, this means it cannot share the same SPI bus as the SD card because it will see the data transfers between the SD card and the ESP32 which, depending on the data pattern, will corrupt the current display block. I am surprised it works at all.

All devices that share an SPI bus must have their own chip select.

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

exactly. the model i use has not a CS pin .
these are the pins available : gnd - vcc - clk - mosi - res - dc - blk - miso
but i put CS as 15 in User_Setup.h . pin 5 is reserved for CS on Sd
i found another display, smaller, that has CS. i will try in few minutes and i will say what happen.
i don't know if it is compatible with ili9341 standard

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

no .. it does not work :-(
is there a way to overcome the problem of the missing CS?
And how it is possible that my display card does not have the CS ?

I'm curious to understand why it does not work and in the meantime I have ordered this display that has the CS :
https://www.amazon.it/gp/product/B0749NHRV4/ref=ox_sc_act_title_1?smid=A2F7JN9V2AWTSH&psc=1.
it will be delivered next friday

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

I found the same display of amazon link (see previous post) in a shop in my town.
Without waiting for next Friday, i bought, i connected and ... miracle !!! ---> all works fine !
My compliments to you, dear Bodmer 👍
You discovered that ILI9341 without CS pin cannot work with a SD reader.
I don't know very well the "deep world" of arduino so without your help no way out for me.

I still have doubts about how it is possible to sell a display without such an important connection.
And, again, is there a workaround to be able to simulate CS?

from jpegdecoder.

fotosettore avatar fotosettore commented on August 13, 2024

My ability in electronics is excellent but I agree with you that it is convenient to create an AND gate for this because the cost in terms of time and money should be higher than buying a fair display in China;)

very nice your weather station ... great job for my Christmas holidays :-))

many thanks and many compliments again for your support.

from jpegdecoder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.