cancel
Showing results for 
Search instead for 
Did you mean: 

MCU stall after a number of continuous writes to FMC

LeonidP
Associate II

Hello all,

 

I faced with a big stall issue when write a number of data via FMC. I guess it is related somehow with a cashe controller, but I can be wrong.

The details in brief:

I use an STM32H757 std dev board with all needed corrections to apply FMC interface. The interface works fine, but a disappointing stall issue is observed.

If I perform intensive writing to the FMC, I see that roughly first 20 .. 24 transactions are executed with appropriate speed, but all the following are stalled dramatically.

It seems, that a delay occurs not necessarily right during/after the writing, but rather randomly in a vicinity of the operation.

E.g., the normal FMC writing throughput in my case lasts, say, 50 MCU clock cycles (which is observed during the first couple of dozens of operations), then it abruptly increases to, say, 2500 cycles. 

Sometimes, one operation is as quick as it should be (~50 cycles), but an adjacent one is double-stalled (~5000 cycles).

Extra operations, not related with FMC (e.g. lots of NOP's or a memmove) don't affect on the throughput, when the stall-effect is observed. I.e. 2500 cycles between adjacent writings are both with or without additional NOP's (or any other MCU work). Of course, the NOP's extend the intervals between writings when no stall-effect occurs. 

In other words: duration of FMC writing only becomes the same as duration of FMC writing + an extra function (NOP's, memmove, etc). As if NOP's or memmove or whatever lasted zero clock cycles.

 

My guess is that it's related somehow with cashe write-through effects or so.

Btw, the address space for FMC is configured as follows:

/* Configure the MPU attributes as WT for SDRAM */
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x60000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_16MB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

HAL_MPU_ConfigRegion(&MPU_InitStruct);

 

I also tried to invalidate cashe after each FMC-writing: SCB_InvalidateDCache_by_Addr((long *) 0x60000000, 4096);

In some cases it slightly reduces the stall-effect, but increases transaction time when the stall-effect is not observed yet.

 

Any comments?

 

1 ACCEPTED SOLUTION

Accepted Solutions
LeonidP
Associate II

Sorry. Seems, I found the reason. 

Too long data setup time in FMC

View solution in original post

1 REPLY 1
LeonidP
Associate II

Sorry. Seems, I found the reason. 

Too long data setup time in FMC