cancel
Showing results for 
Search instead for 
Did you mean: 

JPEG Codec Decoding does not end/complete

AWent
Associate III

Hey,

I transfered the JPEG_DecodingFromFLASH_DMA example code into program, where I try to decode and display a JPEG image which I receive via SPI (thus, the image data is storred in the Flash as well).

Board: STM32F769I-DISCO

The code is unchanged except of the parameters pointing to the data to be decoded and respectively its length in the JPEG_Decode_DMA function:

JPEG_Decode_DMA(&JPEG_Handle, (uint32_t)frame_buffer, frame_size, JPEG_OUTPUT_DATA_BUFFER);

However, when I wait for the JpegProcessingEnd, the JPEG_OutputHandler never returns a ProcessDoneFlag ('1').

do 
 {
      JpegProcessing_End = JPEG_OutputHandler(&JPEG_Handle);
  }while(JpegProcessing_End == 0);

From Debugging, I know this is because the state

Jpeg_OUT_BufferTab[JPEG_OUT_Read_BufferIndex].State == JPEG_BUFFER_FULL

will never be reaced.

Respectively, the HAL_JPEG_DataReadyCallback will bever be called wich should set the JPEG_BUFFER_FULL state.

And the JPEG_Process will not be executed which would call the Callback, if I got that correctly.

Any idea where and what I need to check to find out why the Decoding won't work?

(I wasn't able to test the original example code, because its too large for my uVision Licence)

1 ACCEPTED SOLUTION

Accepted Solutions

Check that you copy HAL_JPEG_MspInit function to your project (from file stm32h7xx_hal_msp.c in JPEG Example project)

View solution in original post

18 REPLIES 18

Hi. Did you transfer example code to your own project? Did you also transfer MDMA configuration?

AWent
Associate III

Hi. Thanks for your hint.

I inserted the JPEG code into my project, yes.

My project is modified SPI_Full_Duplex_Com example. And I took the JPEG_Decoding code from the main, inserted the hal_jpeg driver, the decode_dma module and jpeg_utils plus all header files. Till I got no error messeges anymore.

But I am not quite sure about a MDMA? What is that? I couldn't find anything named MDMA in the JPEG_DecodingFromFLASH_DMA project?

Check that you copy HAL_JPEG_MspInit function to your project (from file stm32h7xx_hal_msp.c in JPEG Example project)

AWent
Associate III

You are right, that is probably the solution! I missed the HAL_JPEG_MspInit function in the stm32f7xx_hal_msp.c, and the Compiler hasn't claimed it, beause its alredy defined as a __WEAK function in the hal_jpeg driver.

Unfortunately, I couldn't test right now, because the project just got to large for the 32K licence, but I will check soon and I am optimistic, that this was the missing point.

Good luck)

AWent
Associate III

Thanks a lot again.

Besdies the HAL_JPEG_MspInit function, I also missed to copy some JPEG and DMA IRQHandler in stm32f7xx_it.c.

AWent
Associate III

However, the JPEG_Decode process still does not succeed. It will be aorted by a JPEG_DMAErrorCallback and I cannot figure out why.

To the JPEG_DMAErrorCallback it will be referred as "hjpeg->hdmain->XferErrorCallback" and "hjpeg->hdmaout->XferErrorCallback", but I cannot find the condition for their calls.

Does anyone have a idea or hint?

Hi. What is MDMA Error Code Index?

AWent
Associate III

The hjpeg->ErrorCode is 4 (HAL_JPEG_ERROR_DMA, DMA transfer error)

Or is there something more detailed available?