Show image with jpg library

Description

I am about to show images using JPG Library

What MCU/Processor/Board and compiler are you using?

Custom board with STM32f429 on

What do you want to achieve?

Show images using JPG Library

What have you tried so far?

So far I have been able to use LVGL on my board, use the touchpad input device and show some examples.
Now I want to set the picture of the image widget with data saved on an SDcard. So I have been able to use Fatfs and Freertos simultaneously and this part is ok. So I read the total data from SDcard and push it into external ram. Data is verified for some bits by hand and it was ok on the external ram.
Then I had set the read data on the external ram to be the image data but it was not shown.

Code to reproduce

In the main function, I have
lv_split_jpeg_init();

In the Main task, I have

  uint bw;
  FRESULT res;
  double size;

  lv_obj_t * img1;

  res = f_open(&SDFile, "n.jpg", FA_READ);
  size = f_size(&SDFile);
  res = f_read(&SDFile, (uint8_t *)0xC1000000, size, &bw);
  res = f_close(&SDFile);

  lv_img_dsc_t myImage;
  myImage.header.always_zero = 0;
  myImage.header.w = 200;
  myImage.header.h = 120;
  myImage.data_size = size;
  myImage.data  = (uint8_t *)0xC1000000;

  img1 = lv_img_create(lv_scr_act(), NULL);
  lv_obj_set_size(img1, 200, 120);
  lv_obj_set_pos(img1, 100, 100);
  lv_img_set_src(img1,  &myImage);
  /* Infinite loop */
  for(;;)
  {
	lv_tick_inc(30);
	lv_task_handler();
    osDelay(30);
  }

No other widget is on the screen. Any other working decoder is acceptable. Where am I wrong?

Hi,

Some questions and notes:

  • Which LVGL version do you use?
  • What problem do you see?
  • I suggest trying to display a small JPEG image that fits into the flash to reduce the number of possible issues

Dear @kisvegabor

  1. I use LVGL V7.4
  2. The problem I see is that after loading the picture nothing is shown as the loaded image, the screen is still clear and the touchscreen routine is working since I can see the change of pointer position with respect to the touched point.
  3. I will follow what you said and report the result here.
1 Like