cancel
Showing results for 
Search instead for 
Did you mean: 

LCD Scroll Slow with SDRAM as System Ram

ruggero
Associate
Posted on July 20, 2016 at 10:32

I'using

  • STM32746G-Discovery board
  • keil 5.20
  • STM32F7xx_DFP/2.7.0

I do some test with LwIP_HTTP_Server_Netconn_RTOS examples.

This example use:

-    LwIp Library

-    LCD interface with the framebuffer mappend on the SDRAM 0xC0000000

All works fine I can do my Log on the LCD and the scroll is fast.

For my project I need to use the SDRAM 0xC0000000 as system ram.

So I look at the FMC_SDRAM_DataMemory example.

I did necessary modification into the LwIP_HTTP_Server_Netconn_RTOS example.

I fix the LwIP RX/Tx buffer address.

Note: I need to change also the MPU_Config to make the LwIp working. (to avoid memory exception)

Below the new MPU_Config() function:

//&sharpdefine USE_INTERNAL_RAM (disco config)

static void MPU_Config(void)

{

  MPU_Region_InitTypeDef MPU_InitStruct;

 

  /* Disable the MPU */

  HAL_MPU_Disable();

  /* Configure the MPU attributes as WT for SRAM */

  MPU_InitStruct.Enable = MPU_REGION_ENABLE;

&sharpifdef USE_INTERNAL_RAM

  MPU_InitStruct.BaseAddress = 0x20010000;

  MPU_InitStruct.Size = MPU_REGION_SIZE_256KB;

&sharpelse

    MPU_InitStruct.BaseAddress = 0xC0000000;

  MPU_InitStruct.Size = MPU_REGION_SIZE_8MB

&sharpendif

    

    

  MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;

  MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

&sharpifdef USE_INTERNAL_RAM

  MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;

&sharpelse    

  MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;

&sharpendif

    MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;

  MPU_InitStruct.Number = MPU_REGION_NUMBER0;

    

&sharpifdef USE_INTERNAL_RAM

  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;                                        

//Strongly ordered

  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;

&sharpelse

  MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;                                        //Shared

device

  MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;

&sharpendif

  MPU_InitStruct.SubRegionDisable = 0x00;

  HAL_MPU_ConfigRegion(&MPU_InitStruct);

  /* Enable the MPU */

  HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

    

}

After this modification all works fine but the LCD scroll is very slow.

I have a thread that blink a led each 250ms and when the system scrolls the led remain fixed about 1 second

I make some test an look into the code and the part of the code that slower the scroll is:

Into lcd_log.c:

LCD_LOG_PUTCHAR

{

    ...

&sharpifdef SKIP_THIS    

      for(idx = LCD_CacheBuffer_xptr ; idx < XptrNUM; idx++)

      {

        LCD_CacheBuffer[LCD_CacheBuffer_yptr_bottom].line[LCD_CacheBuffer_xptr++] = ' ';

      }   

&sharpendif

    ...

}

and

void LCD_LOG_UpdateDisplay (void)

{

    ...

    for  (cnt = 0 ; cnt < YWINDOW_SIZE ; cnt ++)

    {

      

      index = (cnt + ptr )% LCD_CACHE_DEPTH ;

      

      BSP_LCD_SetTextColor(LCD_CacheBuffer[index].color);

      BSP_LCD_DisplayStringAtLine ((cnt + YWINDOW_MIN),

                             (uint8_t *)(LCD_CacheBuffer[index].line));

      

    }

    ...

}

If I enable the define SKIP_THIS the scroll time is twice faster but always slow

respect the LwIP_HTTP_Server_Netconn_RTOS

without modifications.

 

#!stm32-!heap-!sdram-!malloc
0 REPLIES 0