Skip to main content
AJT141
Associate III
November 17, 2020
Question

JPEG_Decode_DMA function never ends

  • November 17, 2020
  • 0 replies
  • 1162 views

Hello,

Still developping on my STM32H753VT6 with touchGFX. Instead of loading images with touchGFX designer, I want to decode a JPEG image and then display it on my LCD screen.

For the moment I've just checked the example for the STM32H750B-DK demo board. It is obviously working on the demo board but not on my MCU. Indeed I'm stucked at this point :

/*##-4- Wait till end of JPEG decoding #*/
while(Jpeg_HWDecodingEnd == 0)
{
}

This means that my decoding never finishes.

However I think i've added all the code to make the JPEG decoder working. Here is what i've added :

In main.c file :

#include "decode_dma.h"
#include "image_320_240_jpg.h"
 
JPEG_HandleTypeDef hjpeg;
JPEG_ConfTypeDef JPEG_Info;
uint32_t image_320_240_jpg_decoded[] = {0};
extern const unsigned char image_320_240_jpg[];
extern uint32_t Jpeg_HWDecodingEnd;
 
static void MX_JPEG_Init(void);
 
 hjpeg.Instance = JPEG;
 volatile HAL_StatusTypeDef res = HAL_JPEG_Init(&hjpeg); 
 
 JPEG_Decode_DMA(&hjpeg, (uint32_t) image_320_240_jpg1, IMAGE_320_240_JPG_SIZE, (uint32_t) image_320_240_jpg_decoded);
 
 /*##-4- Wait till end of JPEG decoding #*/
 while(Jpeg_HWDecodingEnd == 0)
 {
 }
 
 /*##-5- Get JPEG Info ###############################################*/
 HAL_JPEG_GetInfo(&hjpeg, &JPEG_Info); 
 
 
/**
 * @brief JPEG Initialization Function
 * @param None
 * @retval None
 */
static void MX_JPEG_Init(void)
{
 
 /* USER CODE BEGIN JPEG_Init 0 */
 
 /* USER CODE END JPEG_Init 0 */
 
 /* USER CODE BEGIN JPEG_Init 1 */
 
 /* USER CODE END JPEG_Init 1 */
 hjpeg.Instance = JPEG;
 if (HAL_JPEG_Init(&hjpeg) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN JPEG_Init 2 */
 
 /* USER CODE END JPEG_Init 2 */
 
}
 

In stm32h7xx_hal_msp.c file :

HAL_JPEG_MspInit and HAL_JPEG_MspDeInit  functions

In stm32h7xx_it.c file :

/**
 * @brief This function handles JPEG interrupt request.
 * @param None
 * @retval None
 */
 
void JPEG_IRQHandler(void)
{
 HAL_JPEG_IRQHandler(&hjpeg);
}
 
/**
 * @brief This function handles MDMA interrupt request.
 * @param None
 * @retval None
 */
 
void MDMA_IRQHandler()
{
 /* Check the interrupt and clear flag */
 HAL_MDMA_IRQHandler(hjpeg.hdmain);
 HAL_MDMA_IRQHandler(hjpeg.hdmaout); 
}

and in it's header file :

void MDMA_IRQHandler(void);
void JPEG_IRQHandler(void);

decode_dma.h and decode_dma.c files have also been added

I've attached the example project.

If someone knows where the problem may come from, it would be a pleasure to see the answer !

Best regards,

AJT141

This topic has been closed for replies.