cancel
Showing results for 
Search instead for 
Did you mean: 

Problems showing more than one JPG image with 746D

LMI2
Lead
Posted on June 07, 2018 at 20:40

I modified \STM32Cube\Repository\STM32Cube_FW_F7_V1.0\Projects\STM32746G-Discovery\Applications\LibJPEG example to show several images, see the code below, but images don't show. Only the first one is there whole. It looks like they may be kind on stacked top of each other.

/* Includes ------------------------------------------------------------------*/
#include 'main.h'
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
FATFS SDFatFs; /* File system object for SD card logical drive */
FIL MyFile; /* File object */
char SDPath[4]; /* SD card logical drive path */
RGB_typedef *RGB_matrix; 
uint8_t _aucLine[2048];
uint32_t offset = 0;
uint32_t line_counter = 239;
/* Private function prototypes -----------------------------------------------*/
static void SystemClock_Config(void);
static void LCD_Config(void);
static uint8_t Jpeg_CallbackFunction(uint8_t* Row, uint32_t DataLength);
static void CPU_CACHE_Enable(void);
/* Private functions ---------------------------------------------------------*/
/**
 * @brief Main program
 * @param None
 * @retval None
 */
int main(void)
{
 /* Enable the CPU Cache */
 CPU_CACHE_Enable();
 /* STM32F7xx HAL library initialization:
 - Configure the Flash ART accelerator on ITCM interface
 - Systick timer is configured by default as source of time base, but user 
 can eventually implement his proper time base source (a general purpose 
 timer for example or other time source), keeping in mind that Time base 
 duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and 
 handled in milliseconds basis.
 - Set NVIC Group Priority to 4
 - Low Level Initialization
 */
 HAL_Init();
 
 /* Configure the system clock to 200 MHz */
 SystemClock_Config();
 
 /*##-1- LCD Configuration ##################################################*/ 
 LCD_Config();
 
 if(FATFS_LinkDriver(&SD_Driver, SDPath) == 0)
 {
 if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) == FR_OK)
 {
 
if(f_open(&MyFile, 'ima_jpg', FA_READ) == FR_OK)
 {
 }
 jpeg_decode(&MyFile, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction);
 f_close(&MyFile);
 BSP_LCD_DisplayStringAtLine(2, (uint8_t*)'f_close1');
HAL_Delay(1000);
 if(f_open(&MyFile, 'ima_jpg', FA_READ) == FR_OK)
 {
 }
 jpeg_decode(&MyFile, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction);
 f_close(&MyFile);
 BSP_LCD_DisplayStringAtLine(2, (uint8_t*)'f_close2');
HAL_Delay(1000);
 if(f_open(&MyFile, 'ima_jpg', FA_READ) == FR_OK)
 {
 }
 jpeg_decode(&MyFile, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction);
 f_close(&MyFile);
 BSP_LCD_DisplayStringAtLine(2, (uint8_t*)'f_close3'); 
 HAL_Delay(1000);
 if(f_open(&MyFile, 'ima_jpg', FA_READ) == FR_OK)
 {
 }
 jpeg_decode(&MyFile, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction);
 f_close(&MyFile);
 BSP_LCD_DisplayStringAtLine(2, (uint8_t*)'f_close4');
 
 }
 }

 
 /* Infinite loop */
 while (1)
 {
 }
}
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 11, 2018 at 00:09

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6vX&d=%2Fa%2F0X0000000by6%2F8xM4MvKN83.Q256smSTYbMwxVMXiGAW_0ROU4k2TTGE&asPdf=false

View solution in original post

6 REPLIES 6
Posted on June 09, 2018 at 00:30

Try use MyFile1 & MyFile2

LMI2
Lead
Posted on June 09, 2018 at 01:14

A good idea but unfortunately it did not help. It looks like I have to somehow restart the JPG decoder between images.

Posted on June 11, 2018 at 00:09

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6vX&d=%2Fa%2F0X0000000by6%2F8xM4MvKN83.Q256smSTYbMwxVMXiGAW_0ROU4k2TTGE&asPdf=false
Posted on June 11, 2018 at 02:47

Try use very small jpg file

Posted on June 11, 2018 at 19:10

Thanks. It was the

line_counter = 239; I thought that it was for something else

Posted on June 11, 2018 at 21:59

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6vc&d=%2Fa%2F0X0000000by7%2FVY6yh2qWuq4i_Y3uJckN9zX8Ct4v23qr_5OCRaR8eH8&asPdf=false