cancel
Showing results for 
Search instead for 
Did you mean: 

Can not find the needed dcmi HAL functions using STM32CubeMX.

CJans.1
Associate III

Hi,

I use STM32CubeMX to configure a STM32H743 device. I enabled global DCMI interrupts.

But I see no HAL functions to start the DCMI and enable specific interrupts.

I hoped to find suitable functions in stm32h7xx_hal_dcmi.c. But there aren't.

There is a HAL_DCMI_Stop() but not a start equivalent.

There is a HAL_DCMI_Start_DMA() which is strange because I did not enable DMA in STM32CubeMX. (Well, I did first, but then I disabled it)

I see the interrupt functions like HAL_DCMI_VsyncEventCallback() which I can overload, but I see no functions to enable each specific interrupt.

What am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hello @CJans.1​,

Besides to the proposal from @Pavel A.​, I recommend you to take a look at the AN5020.

The DCMI is connected to the AHB bus matrix through the AHB2 peripheral bus. It is accessed by the DMA to transfer the received image data. The destination of the received data depends on the application. For that, the HAL_DCMI_Start_DMA() function is used to enable the capture.

To be able to use the DCMI interrupts, the user must enable the DCMI global interrupts on the NVIC side. Each interrupt is then enabled separately by enabling its corresponding enable bit in the DCMI_IER register.

The DCMI examples based on STM32CubeMX shared in the AN5020 may help you in your configuration.

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

9 REPLIES 9
Pavel A.
Evangelist III

> What am I doing wrong?

Relying on the HAL library too much. Not looking for code examples (these may explain intended use of the library)

KDJEM.1
ST Employee

Hello @CJans.1​,

Besides to the proposal from @Pavel A.​, I recommend you to take a look at the AN5020.

The DCMI is connected to the AHB bus matrix through the AHB2 peripheral bus. It is accessed by the DMA to transfer the received image data. The destination of the received data depends on the application. For that, the HAL_DCMI_Start_DMA() function is used to enable the capture.

To be able to use the DCMI interrupts, the user must enable the DCMI global interrupts on the NVIC side. Each interrupt is then enabled separately by enabling its corresponding enable bit in the DCMI_IER register.

The DCMI examples based on STM32CubeMX shared in the AN5020 may help you in your configuration.

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.

CJans.1
Associate III

Thx for pointing me to doc AN5020. Very usefull.

I imported some DMCI examples. But they all seem quite complex. Using DMA2D and LCD etc.

I only want to know how to write DCMI information into RAM using DMA.

I used the HAL_DCMI_Start_DMA() to start a DCMI and DMA. The DCMI seems to be starting. It generates interrups. But DMA still does not operate.

I probably missing some little step.

KDJEM.1
ST Employee

Hello @CJans.1​,

Maybe the problem is related to memory layout and internal data cache (D-Cache) of the Cortex-M7 core. So, Try disable D-Cache and I advise you to follow this FAQ DMA is not working on STM32H7 devices.

Please let me know if the problem is solved.

Thank you.

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.

CJans.1
Associate III

I did not enable caching at all (want to have it working first).

I found out that the DCMI_DMAError() function is called and the DMA error code is HAL_DMA_ERROR_TE (transfer error).

According the documentation this is because of a bus error.

things I did:

  • use STM32CubeMX to set up DCMI and enable DMA
  • created a buffer in SRAM1 using
    • __attribute__ ((section(".buffer"), used)) uint32_t bigbuf[30000];
    • checked that it is present in SRAM1
  • called status = HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t)bigbuf, ((752*480)/4)/4);
    • sensor is 752*480, I use 8 bit DCMI (thus 4 in a word) and I use half the number of pixels and half the number of lines
  • checked with oscilloscope that DCMI is working (clock, sync and data signals present)
  • After starting, DCMI_DMAError() will be called.

Any idea why I can get this bus error?

CJans.1
Associate III

And the CFSR register stays 0. So I do not know what the bus error is.

CJans.1
Associate III

PS: should I post a new question for this? Because it is kind of different problem now?

KDJEM.1
ST Employee

Hello @CJans.1​,

If your first question has been answered, please close this topic by choosing Select as Best. This will help other users find that answer faster. 

It is recommended to post a new question because it is kind of different problem.

Thank you for your contribution in the ST Community :).

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.

Hello @CJans.1​,

This issue is already reported in this post.

The MX_DMA_Init() order is not set correctly in H7 devices.

Sorry for this inconvenience.

Thank you.

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.