5 years, 9 months ago.

Unable to render picture on RA8875 display when picture stored in the flash file system of LPC1768

Hi all,

I am trying to save 2 pictures in the in flash file system of my LPC1768 board, to then display these pictures on my RA8875 screen. In order to save the pictures on the flash memory, I followed the explanation given on https://os.mbed.com/users/AdamGreen/code/FlashFileSystem/:

1. I have downloaded the "fsbld" utility

2. In the folder containing "fsbld.exe", I have created a folder named "flash" where I have copied the two pictures "Test1.jpg" and "Test2.jpg" (these pictures don't exceed the size of my screen so that's ok)

3. I have got back to the folder containing "fsbld.exe", and I have created the system image binary by typing that code on the terminal: fsbld flash flash.bin (this has just created a flash.bin file but no header file ==> not sure if it's normal)

4. I have saved my mbed compiled code "mbedTest.bin" into the folder containing "fsbld.exe" and I have used the following command to join both binaries: copy /b mbedTest.bin + flash.bin mbedTestfl.bin

5. I have saved "mbedTestfl.bin" in my mbed LPC1768 device

My mbed code is in attachment: /media/uploads/Quentin_BXL1000/mbedcode.jpg

The compilation was done with success, but no picture is displayed on my screen. I know that the hardware and wires connection are ok because I have already display these pictures using another code, with the pictures stored in localfilesystem. Could anybody help me and tell me where I made mistakes? I am quite a beginner to work with displays and I have never used the flash file system of my mbed to store things, so I am very sorry if the mistakes I made are obvious.

Thank you in advance for your help,

Quentin

Question relating to:

The speed might be limited by the spi speed to the display. You can change that setting, so long as your SPI interface is very short, or at least very clean in signals.

For the uSD on the display, I haven't used that. I created my own baseboard and put a uSD card on there. It uses the same SPI interface, but that comes to a different header on the RA8875 display, so you have wire it in.

Getting a combination of file system parts that work together has been tricky. I'll look to see if I have a combination that is ready to share.

posted by David Smart 19 Jul 2018

1 Answer

5 years, 9 months ago.

I use Adam's FlashFileSystem often, to host the images for the RA8875 projects. So, exactly why it isn't working is a mystery.

I might suggest -

  • create a simple sample (small image), and see if that is working.
  • check both the (x,y) and the image (width,height). I don't know if the library will handle screen clipping correctly (x or y < 0, or x+width or y+height > screen size).
  • try different image files. When I was creating the BMP support, I handled many of the formats, but possibly not all of them. For the jpeg, I leveraged code from others and didn't have to spend much time untangling it.

Why it would work from local file system, but not from the flash file system, is also a mystery, and would suggest that the RA8875 library is ok, but the interface to the flash file system (or the coding of the jpg files) is the issue.

  • find the point in the code where it is reading the byte-stream from the file system and print it as a hex stream to the debug port - compare that to the bytestream in the flash file.

I hope this is helpful.

Accepted Answer

Hi David,

Thanks for your answer and for this library also :) I have tried your tricks but unfortunately, it doesn't work, and since you didn't make any comment regarding my code, I assume that there is nothing wrong in the code. The only strange thing is that when I generate the final bin file, and when I want to copy it to the mbed device, it is written that that the file is encrypted and that mbed doesn't accept this. The PC asks me to copy the file without the encryption and I accept.

Would it be possible to share with me a C code that works to display one image from the flash, as well as the image file (JPEG or bmp + bin file generated), the compiled bin file of the C code, and the jointed bin file ? I think that could be very useful to see where the problem comes from on my side.

Thanks,

Quentin

posted by Atchoum V 17 Jul 2018

I also forgot to ask you if you would have a C code example to read an image from the SD card connected on the screen board, and display it on the screen ?

posted by Atchoum V 17 Jul 2018

I took one of my demo's and updated it for the FlashFileSystem. Take a look at PUB_RA8875_Bitmap. This was built and tested on an LPC1768, with the 800x480 version of the RA8875 display. It reads a large jpg from the flash file system and if you've put a couple of other images on the local file system it will render them all in sequence.

You will see that I use a different API, but it ends up in the same place. The API I call figures out which rendering methods to use.

And refer to the main.cpp source - not just the sample on the liked page.

Simplified source -

TestImage_T TestImage[] = {
    { 0, 0, "/flash/RomeC.jpg"},
    { 0, 0, "/local/desert.bmp"},
    { 0, 0, "/local/Module.jpg"},
};
 
 
 
int main()
{
    pc.baud(460800);    // I like a snappy terminal, so crank it up!
    pc.printf("\r\nRA8875 Bitmap Test - Build " __DATE__ " " __TIME__ "\r\n");
 
    lcd.init(LCD_W, LCD_H, LCD_C);
    lcd.Backlight(0.5f);
    
    int count = sizeof(TestImage)/sizeof(TestImage[0]);
    while (1) {
        for (int i=0; i<count; i++) {
            lcd.cls();
            printf("RenderBitmapFile(%d, %d, %s) ", TestImage[i].x, TestImage[i].y, TestImage[i].filename);
            wait(2);
            RetCode_t r = lcd.RenderImageFile(TestImage[i].x, TestImage[i].y, TestImage[i].filename);
            printf("returned %d\r\n", r);
            wait(5);
        }
    }
}
posted by David Smart 17 Jul 2018

Hi David,

Thank you very much for the example. Now it works. I didn't use any header file in my previous example, but I chose to combine the binary files (mbed code + .bin image) before loading the bin code on the device. I still don't know why my technic wasn't working but the most important is that I have something that works now. However, I was expecting to render the image coming from the flash file system very fastly compared to the one coming from the local system, but it takes exactly the same time (and the size of the two pictures I am displaying is also the same). Any idea why ?

Would you also mind to provide a C code example to read an image from the SD card connected on the screen board, and display it on the screen ?

Thank you very much for all your help, that's very useful.

Quentin

posted by Atchoum V 19 Jul 2018