cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture and save high resolution images on STM32H7?

dorawa
Associate

Test Description: Receiving an image of 1280x960 through the image sensor and saving the image to external PSRAM
Test Environment
- MCU : stm32h753ai
- Camera Module : AN0134
- psram : is66wve4m16ebll-70bli

Current situation
- Create image buffer in internal buffer and check image capture using HAL_DCMI_Start_DMA function (declare size smaller than DCMI maximum size of 65535)
- Write a certain incremental value to the internal buffer using FMC and read the value.
- Write some image data stored in the internal buffer to PSRAM and read it.
- If you try to save directly through HAL_DCMI_Start_DMA by putting the address of PSRAM instead of the internal buffer address, an error occurs (Error code: 65).

Question
1. I am wondering if it is possible to directly input the memory address of PSRAM to HAL_DCMI_Start_DMA.
- In the example of AN5020 documentation, it seems that 1280x1024 images can be processed, so please check if it is really possible.

2. If the PSRAM memory address cannot be used directly in HAL_DCMI_Start_DMA, how can it be processed?
- Should I refer to 6.4.9 DMA configuration for higher resolution or 8.3.6 SXGA resolution capture (YCbCr data format) in AN5020 documentation and create HAL_DCMI_Start_DMA function by myself?
- If I have to make it myself, I wonder if I can still modify the HAL_DCMI_Start_DMA function.

3. In my research, it says to use a double buffer to solve this problem, but how exactly should I use it?
- Do I simply create two buffers to set in the DMA_SxM0AR or DMA_SxM1AR registers to alternately read and save the image....
- There are functions for using multibuffers, such as the HAL_DMAEx_MultiBufferStart function, but I was wondering if it is possible to implement a double buffer via this function......

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hello @dorawa ,

 The DCMI is a slave AHB2 peripheral. The DMA1 and DMA2 perform the data transfer from the DCMI to internal
SRAMs or external memories through the FMC as shown in the below figure.

KDJEM1_0-1690881620578.png

Note that, if you want to display images correctly, YCbCr data must be converted into RGB565 data (or RGB888 or ARGB8888, depending on the application needs).  So, on each DCMI frame event callback, the DMA2D is used to copy and convert the frame.

The HAL_DCMI_Start_DMA function checks the resolution, if the resolution higher than 65535 the DCMI double buffer mode is called and start DMA multi buffer transfer HAL_DMAEx_MultiBufferStart_IT function.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
KDJEM.1
ST Employee

Hello @dorawa ,

 The DCMI is a slave AHB2 peripheral. The DMA1 and DMA2 perform the data transfer from the DCMI to internal
SRAMs or external memories through the FMC as shown in the below figure.

KDJEM1_0-1690881620578.png

Note that, if you want to display images correctly, YCbCr data must be converted into RGB565 data (or RGB888 or ARGB8888, depending on the application needs).  So, on each DCMI frame event callback, the DMA2D is used to copy and convert the frame.

The HAL_DCMI_Start_DMA function checks the resolution, if the resolution higher than 65535 the DCMI double buffer mode is called and start DMA multi buffer transfer HAL_DMAEx_MultiBufferStart_IT function.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.