cancel
Showing results for 
Search instead for 
Did you mean: 

Ethernet STM32H7 DMA

Dat Tran
Senior II

Hi everybody,

Currently we have a weird thing with Ethernet on STM32H7.

Everything work fine if disable cache globally.

When enable cache, work fine. We can send/receive few hundreds MB or keep ping /t from PC few days, no error. So we believe we config RAM, MPU correctly.

Problem only happen when, we add / remove some code. Those code aren't related to network, or anything. Those code just make flash bigger or smaller, when look at map file, memory are same, no changed.

Example, when doesn't work, we added a garbage code as below:

MPU_InitStruct.Enable = MPU_REGION_ENABLE;

   MPU_InitStruct.BaseAddress = 0xA0000000;

   MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;

   MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;

   MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

   MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;

   MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;

   MPU_InitStruct.Number = MPU_REGION_NUMBER2;

   MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;

   MPU_InitStruct.SubRegionDisable = 0x00;

   MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

   HAL_MPU_ConfigRegion(&MPU_InitStruct);

Work fine back, although the address 0xA0000000 is not used anywhere. We tried 0xB0000000 or 0xA12344.... still work. Basically, add/remove code will effect to our ethernet, although those code don't do anything.

When look at map file, some are moved down 0x080..... which is flash. Nothing change in memory.

does flash effect to cache issue, or we are missing something?

Any one has experience about this?

Thanks

 Edit:

actually , just do something like

volatile int I = 0;

if (I = 0) I++;

any add/remove code may effect to ethernet, if flash 0x08..... has changed.

3 REPLIES 3
Pavel A.
Evangelist III

> Example, when doesn't work

Define "doesn't work" ?

-- pa

TDK
Guru

If adding useless/dummy code is causing your program to misbehave, it's typically a symptom that there is a bug in the code. Use the symptoms you see to try to track it down.

The particular 1s and 0s in flash should have no effect on how the cache behaves.

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

>Those code just make flash bigger or smaller, when look at map file, memory are same, no changed.

You're looking at the correct map file?

>Example, when doesn't work, we added a garbage code as below:

You're configuring the MPU correctly, e.g. the base addresses are aligned to size, regions have different numbers?

>any add/remove code may effect to ethernet

You've coded the ethernet driver 100% yourself? You realize the HAL ETH driver has bugs, the fails you've observed have nothing or little to do with the code changes, they're just coincidence? For its bugs see https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet. BTW if you use the fixes posted there, please post a comment there confirming you're using it and it's worked for you.

>Everything work fine if disable cache globally.... Problem only happen

Without any other details, can only guess it's errors in your MPU config or you're using the HAL ETH driver.