emWin使用外部SRAM的方法

emWin使用外部SRAM的方法

标签: emWinSRAM内存STM32
  3422人阅读  评论(3)  收藏  举报
  分类:

     转载请注明地址:http://blog.csdn.net/zsy2020314/article/details/9313093

     我用的是stm32,加了1MB的外部SRAM,在使用emWin的时候,将一部分内存分配给emWin使用。其实方法很简单,传入SRAM数据总线地址即可,数据位宽我采用16bit,因为使用的SRAM是16bit的,这样做比较合适。如果是在ARM9及以上的平台上使用,依葫芦画瓢的把DDRAM的物理地址传入emWin即可,不过地址位宽一般是32位的,大小由自己决定。

[cpp]  view plain  copy
  1. /********************************************************************* 
  2. *                SEGGER Microcontroller GmbH & Co. KG                * 
  3. *        Solutions for real time microcontroller applications        * 
  4. ********************************************************************** 
  5. *                                                                    * 
  6. *        (c) 1996 - 2013  SEGGER Microcontroller GmbH & Co. KG       * 
  7. *                                                                    * 
  8. *        Internet: www.segger.com    Support:  support@segger.com    * 
  9. *                                                                    * 
  10. ********************************************************************** 
  11.  
  12.  
  13. ** emWin V5.18 - Graphical user interface for embedded applications ** 
  14. All  Intellectual Property rights  in the Software belongs to  SEGGER. 
  15. emWin is protected by  international copyright laws.  Knowledge of the 
  16. source code may not be used to write a similar product.  This file may 
  17. only be used in accordance with the following terms: 
  18.  
  19.  
  20. The software has been licensed to  NXP Semiconductors USA, Inc.  whose 
  21. registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose, 
  22. CA 95134, USA  solely for  the  purposes  of  creating  libraries  for 
  23. NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and 
  24. distributed under the terms and conditions of the NXP End User License 
  25. Agreement. 
  26. Full source code is available at: www.segger.com 
  27.  
  28.  
  29. We appreciate your understanding and fairness. 
  30. ---------------------------------------------------------------------- 
  31. File        : GUIConf.c 
  32. Purpose     : Display controller initialization 
  33. ---------------------------END-OF-HEADER------------------------------ 
  34. */  
  35.   
  36.   
  37. #include "GUI.h"  
  38. #include "SRAM_Driver.h"  
  39. /********************************************************************* 
  40. * 
  41. *       Defines 
  42. * 
  43. ********************************************************************** 
  44. */  
  45. //  
  46. // Define the available number of bytes available for the GUI  
  47. //  
[cpp]  view plain  copy
  1. #define Bank1_SRAM3_ADDR    ((u32)0x68000000)  
[cpp]  view plain  copy
  1. #define GUI_NUMBYTES  (1024*700)  
  2. //  
  3. // Define the average block size  
  4. //  
  5. #define GUI_BLOCKSIZE 0x80  
  6.   
  7.   
  8. /********************************************************************* 
  9. * 
  10. *       Public code 
  11. * 
  12. ********************************************************************** 
  13. */  
  14. /********************************************************************* 
  15. * 
  16. *       GUI_X_Config 
  17. * 
  18. * Purpose: 
  19. *   Called during the initialization process in order to set up the 
  20. *   available memory for the GUI. 
  21. */  
  22. void GUI_X_Config(void) {  
  23.   //  
  24.   // 16 bit aligned memory area  
  25.   //  
  26.    volatile U16* aMemory = (volatile U16*)(Bank1_SRAM3_ADDR);  
  27.   //  
  28.   // Assign memory to emWin  
  29.   //  
  30.   GUI_ALLOC_AssignMemory((void*)aMemory, GUI_NUMBYTES);  
  31.   GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE);  
  32.   //  
  33.   // Set default font  
  34.   //  
  35.   GUI_SetDefaultFont(GUI_FONT_6X8);  
  36. }  
  37.   
  38.   
  39. /*************************** End of file ****************************/  
  40. 特别注意:SRAM的时序问题,调试时发现用内部RAM就不会进入HardFault,配置使用SRAM在调用GUI_X_Config函数后,就死机或者进入HardFault,把 SRAM_Timing.AddressSetupTime       = 5;
    SRAM_Timing.AddressHoldTime        = 5;
    SRAM_Timing.DataSetupTime          = 50;//值增大
    SRAM_Timing.BusTurnAroundDuration  = 1;
    SRAM_Timing.CLKDivision            = 0;
    SRAM_Timing.DataLatency            = 0;
  41. 这个值也会影响到LCD显示驱动里读取设备ID号,值过小可以把值设置进显示屏的控制器,但是读不回来数据。
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值