cancel
Showing results for 
Search instead for 
Did you mean: 

Hard fault after first JPG with 746D

LMI2
Lead
Posted on June 06, 2018 at 21:40

I am building code to show all jpeg images in SD card and print their names. I use the STM32F746 Discovery. The jpeg decoder crashes after the first image. The Jpg decoder stays at hard fault loop. If I comment the jpeg_decode(&viili, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction); line, code works but of course no images are shown.

Main.c looks like this

/* Includes ------------------------------------------------------------------*/ #include 'main.h'  FATFS SDFatFs; /* File system object for SD card logical drive */ FIL viili; /* File object */ FRESULT res; DIR dir; static FILINFO fno;  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();   HAL_Init();    /* Configure the system clock to 200 MHz */  SystemClock_Config();    /*##-1- LCD Configuration ##################################################*/   LCD_Config();   /*##-2- Link the micro SD disk I/O driver ##################################*/  if(FATFS_LinkDriver(&SD_Driver, SDPath) == 0)  {  /*##-3- Register the file system object to the FatFs module ##############*/  if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) == FR_OK)  {  res = f_findfirst(&dir, &fno, '', 'ima*.jpg'); /* Start to search for photo files */ res = f_open(&viili,&fno.fname[0] , FA_READ);  while (res == FR_OK && fno.fname[0])  { /* Repeat while an item is found */  /*##-5- Decode the jpg image file ##########################################*/ jpeg_decode(&viili, IMAGE_WIDTH, _aucLine, Jpeg_CallbackFunction);  /*##-4- Close the JPG image ################################################*/  f_close(&viili);  BSP_LCD_DisplayStringAtLine(2, (uint8_t*)fno.fname); HAL_Delay(2000);  res = f_findnext(&dir, &fno); /* Search for next item */ }  f_close(&viili);  }  }  /* Infinite loop */  while (1)  {  } } �?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

Note: this post was migrated and contained many threaded conversations, some content may be missing.
10 REPLIES 10
LMI2
Lead
Posted on June 10, 2018 at 23: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=0680X000006I6vS&d=%2Fa%2F0X0000000by5%2FDWFTwy79_ODAAqH345WJaoW5GFDLk.5dAEh7yc2cqmo&asPdf=false