cancel
Showing results for 
Search instead for 
Did you mean: 

About ADC_DMA_PROJECT(STM32H7)

forst
Associate III

Hello,

I am working on the ADC_DMA_Transfer project

I have a question about MPU settings.

The following code was executed when the MCU was initialized:

Should I always run this code?

//////

static void MPU_Config(void)

{

 MPU_Region_InitTypeDef MPU_InitStruct;

 /* Disable the MPU */

 HAL_MPU_Disable();

 /* Configure the MPU as Strongly ordered for not defined regions */

 MPU_InitStruct.Enable = MPU_REGION_ENABLE;

 MPU_InitStruct.BaseAddress = 0x00;

 MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;

 MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;

 MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

 MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;

 MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;

 MPU_InitStruct.Number = MPU_REGION_NUMBER0;

 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;

 MPU_InitStruct.SubRegionDisable = 0x87;

 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;

 HAL_MPU_ConfigRegion(&MPU_InitStruct);

 /* Enable the MPU */

 HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

}

5 REPLIES 5
TDK
Guru

You don't need any particular MPU setting to use functions on the chip. At a guess, I would say it's used here to disable caching which makes DMA operations more user friendly, but potentially slower.

On the H7, cache management is necessary in order to use DMA functions correctly. Disabling cache altogether is one way of managing it. Some related information is here:

https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices

If you feel a post has answered your question, please click "Accept as Solution".

By the way that article is also pretty bad. Almost everything related to SCB_***() functions is misleading or suboptimal and the example usage of SCB_InvalidateDCache_by_Addr() is just broken. As is everything from the incompetent HAL/Cube software developers...

PAkRad
Associate III

Hello all.

We have developed in the past some devices using the STM32F4 and F7 families, with no issues using ADC+DMA+Timer Triggering with no effort (mostly tweaking the examples provided by ST and using the ioc Cube files).

However, we are trying to do the same, but we are finding big issues with the H7 family, in specific when we use more than one ADC (to my knowledge this example is not provided by ST yet). There are also problems with the DMA (we have reader and moved the data buffers to RAM D2 area) and we do not see the triggering of the DMA interrupt with the Timer trigger.

Maybe somebody in the forum knows one repository or is able to share a simple example of this structure (if it is based on STM32Cubemx ioc file the better, since for it will be easier to add things).

Thank you in advance.

Hello,

Why did you move the data buffer to RAM D2?

My project works fine with D1.

best regards

Thank you @forst​ 

Actually, we also tried with D1 with no success.

For an Audio application we need to sample with both ADCs at the same time. Did your project work with an ioc file?

FMHO, I think the issue is there.

Best regards