AnsweredAssumed Answered

Update from F4 to F7 -> Performance Problems

Question asked by frank.matthias on Sep 15, 2017
Latest reply on Sep 18, 2017 by frank.matthias

Hallo everybody,

 

i have a circuit board whitch is fitted with a STM32F429BIT.

The Software use STemWin and LWIP (without RTOS) and works good.

 

Now i has order the same circuit board with the pin compatible STM32F767BIT.

It is my first projekt with a F7.

Now i tested the LWIP with a terminal programm.

Then i tested STemWin. Also this worked perfectly.

 

But when I use both of them at the same time in the same code the LAN is very slow.

I have realised a tcp echo.

It sometimes takes up to 2 seconds until I get an answer.

 

I dont´t understand the Problem.

 

The AN4839 and AN4861 says that there is maybe a Problem with the DMA und the L1 Cache.

Maybe thats my problem. The solution is the use of the "Managing memory protection unit (MPU)".

 

I have init it as follows: 

 

void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct;

/* Disables the MPU */
HAL_MPU_Disable();
/**Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = 0xC0000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_8MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

/**Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
MPU_InitStruct.BaseAddress = 0xC0000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_2MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

/**Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER2;
MPU_InitStruct.BaseAddress = 0x20020000;
MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

/* Enables the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

}

 

I have testet following possibilities:

 

I&DCache | MPU                            | Resultat -------------------------------------------------------------------          |                                | Lan very slow. -------------------------------------------------------------------- x        |                                | lan not available .          |                                | LTDC has sometimes flickering. --------------------------------------------------------------------- x        | x                              | lan slightly faster          |                                | LTDC has sometimes flickering. ---------------------------------------------------------------------          | x                              | lan slightly faster ---------------------------------------------------------------------

 

Is the configuration of the MPU ok or is something entirely different to my problem?

Outcomes