1809|2

410

帖子

3

TA的资源

纯净的硅(高级)

楼主
 

【 HC32F4A0开发板】外部SRAM存储器读写测试 [复制链接]

 

    测试下开发板上外部SRAM存储器,将读取写入外部SRAM的数据在显示屏上刷新显示。

一、硬件部分

1.1、外部SRAM存储器部分电路图

1.2、手册中外部存储器空间地址分配

SMC地址范围:0x60000000~0x7FFFFFFF

地址空间的大小可自定设置,通过片选控制寄存器设定

 

二、程序部分

2.1、SRAM驱动部分

SRAM驱动程序在官方的SDK中已经有了,包含了SMC的端口初始化和芯片时序的配置。

ev_hc32f4a0_lqfp176_is62wv51216.c

/**
 *******************************************************************************
 * [url=home.php?mod=space&uid=1307177]@File[/url]  ev_hc32f4a0_lqfp176_is62wv51216.c
 * [url=home.php?mod=space&uid=159083]@brief[/url]  This file provides configure functions for is62wv51216 of the board
 *        EV_HC32F4A0_LQFP176.
 @verbatim
   Change Logs:
   Date             Author          Notes
   2022-03-31       CDT             First version
   2022-10-31       CDT             Add timing comments.
 @endverbatim
 *******************************************************************************
 * Copyright (C) 2022-2023, Xiaohua Semiconductor Co., Ltd. All rights reserved.
 *
 * This software component is licensed by XHSC under BSD 3-Clause license
 * (the "License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                    opensource.org/licenses/BSD-3-Clause
 *
 *******************************************************************************
 */

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include <string.h>

#include "hc32_ll_fcg.h"
#include "ev_hc32f4a0_lqfp176_is62wv51216.h"

/**
 * @addtogroup BSP
 * @{
 */

/**
 * @addtogroup EV_HC32F4A0_LQFP176
 * @{
 */

/**
 * @defgroup EV_HC32F4A0_LQFP176_IS62WV51216 EV_HC32F4A0_LQFP176 IS62WV51216
 * @{
 */

#if ((DDL_ON == BSP_IS62WV51216_ENABLE) && (BSP_EV_HC32F4A0_LQFP176 == BSP_EV_HC32F4XX))

/*******************************************************************************
 * Local type definitions ('typedef')
 ******************************************************************************/

/*******************************************************************************
 * Local pre-processor symbols/macros ('#define')
 ******************************************************************************/
/**
 * @defgroup EV_HC32F4A0_LQFP176_IS62WV51216_Local_Macros  EV_HC32F4A0_LQFP176 IS62WV51216 Local Macros
 * @{
 */

/**
 * @defgroup SMC_Max_Timeout SMC Max Timeout
 * @{
 */
#define SMC_MAX_TIMEOUT                 (0x100000UL)
/**
 * @}
 */

/**
 * @}
 */

/*******************************************************************************
 * Global variable definitions (declared in header file with 'extern')
 ******************************************************************************/

/*******************************************************************************
 * Local function prototypes ('static')
 ******************************************************************************/

/*******************************************************************************
 * Local variable definitions ('static')
 ******************************************************************************/
/**
 * @addtogroup EV_HC32F4A0_LQFP176_IS62WV51216_Local_Functions
 * @{
 */
static void BSP_SMC_PortInit(void);
/**
 * @}
 */

/*******************************************************************************
 * Function implementation - global ('extern') and local ('static')
 ******************************************************************************/
/**
 * @defgroup EV_HC32F4A0_LQFP176_IS62WV51216_Global_Functions EV_HC32F4A0_LQFP176 IS62WV51216 Global Functions
 * @{
 */

/**
 * @brief  Initialize SMC for IS62WV51216.
 * @param  None
 * @retval int32_t:
 *           - LL_OK:                   Initialize successfully.
 *           - LL_ERR:                  Initialize unsuccessfully.
 */
int32_t BSP_IS62WV51216_Init(void)
{
    __IO uint32_t u32To = 0UL;
    int32_t i32Ret = LL_OK;
    stc_exmc_smc_init_t stcSmcInit;
    stc_exmc_smc_chip_config_t stcChipConfig;
    stc_exmc_smc_timing_config_t stcTimingConfig;
    en_flag_status_t enChipStatus = RESET;
    en_flag_status_t enTimingStatus = RESET;

    /* Initialize SMC port. */
    BSP_SMC_PortInit();

    /* Enable SMC clock */
    FCG_Fcg3PeriphClockCmd(FCG3_PERIPH_SMC, ENABLE);

    /* Enable SMC. */
    EXMC_SMC_Cmd(ENABLE);

    EXMC_SMC_ExitLowPower();

    while (EXMC_SMC_READY != EXMC_SMC_GetStatus()) {
        if (u32To > SMC_MAX_TIMEOUT) {
            i32Ret = LL_ERR;
            break;
        }
        u32To++;
    }

    if (LL_OK == i32Ret) {
        /* Configure SMC width && CS &chip & timing. */
        (void)EXMC_SMC_StructInit(&stcSmcInit);
        stcSmcInit.stcChipConfig.u32ReadMode = EXMC_SMC_READ_ASYNC;
        stcSmcInit.stcChipConfig.u32ReadBurstLen = EXMC_SMC_READ_BURST_1BEAT;
        stcSmcInit.stcChipConfig.u32WriteMode = EXMC_SMC_WRITE_ASYNC;
        stcSmcInit.stcChipConfig.u32WriteBurstLen = EXMC_SMC_WRITE_BURST_1BEAT;
        stcSmcInit.stcChipConfig.u32MemoryWidth = EXMC_SMC_MEMORY_WIDTH_16BIT;
        stcSmcInit.stcChipConfig.u32BAA = EXMC_SMC_BAA_PORT_DISABLE;
        stcSmcInit.stcChipConfig.u32ADV = EXMC_SMC_ADV_PORT_DISABLE;
        stcSmcInit.stcChipConfig.u32BLS = EXMC_SMC_BLS_SYNC_CS;
        stcSmcInit.stcChipConfig.u32AddrMatch = BSP_IS62WV51216_MATCH_ADDR;
        stcSmcInit.stcChipConfig.u32AddrMask = BSP_IS62WV51216_MASK_ADDR;

        /* EXCLK bus frequency@60MHz: 3.3V */
        stcSmcInit.stcTimingConfig.u8RC = 4U;   /* tRC: min=55ns */
        stcSmcInit.stcTimingConfig.u8WC = 4U;   /* tWC: min=55ns */
        stcSmcInit.stcTimingConfig.u8CEOE = 1U;
        stcSmcInit.stcTimingConfig.u8WP = 3U;   /* tWP: min=40ns */
        stcSmcInit.stcTimingConfig.u8PC = 1U;
        stcSmcInit.stcTimingConfig.u8TR = 1U;
        (void)EXMC_SMC_Init(BSP_IS62WV51216_CHIP, &stcSmcInit);

        /* Set command: updateregs */
        EXMC_SMC_SetCommand(BSP_IS62WV51216_CHIP, EXMC_SMC_CMD_UPDATEREGS, 0UL, 0UL);

        /* Check timing status */
        u32To = 0UL;
        while ((enChipStatus != SET) || (enTimingStatus != SET)) {
            (void)EXMC_SMC_GetTimingConfig(BSP_IS62WV51216_CHIP, &stcTimingConfig);
            if (0 == memcmp(&stcTimingConfig, &stcSmcInit.stcTimingConfig, sizeof(stcTimingConfig))) {
                enTimingStatus = SET;
            }

            (void)EXMC_SMC_GetChipConfig(BSP_IS62WV51216_CHIP, &stcChipConfig);
            if (0 == memcmp(&stcChipConfig, &stcSmcInit.stcChipConfig, sizeof(stcChipConfig))) {
                enChipStatus = SET;
            }

            if (u32To > SMC_MAX_TIMEOUT) {
                i32Ret = LL_ERR;
                break;
            }
            u32To++;
        }
    }

    return i32Ret;
}

/**
 * @brief  Get memory information.
 * @param  [out] pu32MemoryStartAddr    Pointer to memory start address
 * @param  [out] pu32MemoryByteSize     Pointer to memory size(unit: Byte)
 * @retval None
 */
void BSP_IS62WV51216_GetMemInfo(uint32_t *pu32MemoryStartAddr, uint32_t *pu32MemoryByteSize)
{
    if (NULL != pu32MemoryStartAddr) {
        *pu32MemoryStartAddr = BSP_IS62WV51216_START_ADDR;
    }

    if (NULL != pu32MemoryByteSize) {
        *pu32MemoryByteSize = BSP_IS62WV51216_SIZE;
    }
}

/**
 * @}
 */

/**
 * @defgroup EV_HC32F4A0_LQFP176_IS62WV51216_Local_Functions EV_HC32F4A0_LQFP176 IS62WV51216 Local Functions
 * @{
 */

/**
 * @brief  Initialize SMC port.
 * @param  None
 * @retval None
 */
static void BSP_SMC_PortInit(void)
{
    stc_gpio_init_t stcGpioInit;

    /************************* Set pin drive capacity *************************/
    (void)GPIO_StructInit(&stcGpioInit);
    stcGpioInit.u16PinDrv = PIN_HIGH_DRV;

    /* SMC_CS */
    (void)GPIO_Init(BSP_IS62WV51216_CS_PORT, BSP_IS62WV51216_CS_PIN, &stcGpioInit);

    /* SMC_WE */
    (void)GPIO_Init(BSP_IS62WV51216_WE_PORT, BSP_IS62WV51216_WE_PIN, &stcGpioInit);

    /* SMC_BLS[0:1] */
    (void)GPIO_Init(BSP_IS62WV51216_BLS0_PORT, BSP_IS62WV51216_BLS0_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_BLS1_PORT, BSP_IS62WV51216_BLS1_PIN, &stcGpioInit);

    /* SMC_OE */
    (void)GPIO_Init(BSP_IS62WV51216_OE_PORT, BSP_IS62WV51216_OE_PIN, &stcGpioInit);

    /* SMC_DATA[0:15] */
    (void)GPIO_Init(BSP_IS62WV51216_DATA0_PORT, BSP_IS62WV51216_DATA0_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA1_PORT, BSP_IS62WV51216_DATA1_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA2_PORT, BSP_IS62WV51216_DATA2_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA3_PORT, BSP_IS62WV51216_DATA3_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA4_PORT, BSP_IS62WV51216_DATA4_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA5_PORT, BSP_IS62WV51216_DATA5_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA6_PORT, BSP_IS62WV51216_DATA6_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA7_PORT, BSP_IS62WV51216_DATA7_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA8_PORT, BSP_IS62WV51216_DATA8_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA9_PORT, BSP_IS62WV51216_DATA9_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA10_PORT, BSP_IS62WV51216_DATA10_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA11_PORT, BSP_IS62WV51216_DATA11_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA12_PORT, BSP_IS62WV51216_DATA12_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA13_PORT, BSP_IS62WV51216_DATA13_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA14_PORT, BSP_IS62WV51216_DATA14_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_DATA15_PORT, BSP_IS62WV51216_DATA15_PIN, &stcGpioInit);

    /* SMC_ADD[0:18]*/
    (void)GPIO_Init(BSP_IS62WV51216_ADD0_PORT, BSP_IS62WV51216_ADD0_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD1_PORT, BSP_IS62WV51216_ADD1_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD2_PORT, BSP_IS62WV51216_ADD2_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD3_PORT, BSP_IS62WV51216_ADD3_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD4_PORT, BSP_IS62WV51216_ADD4_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD5_PORT, BSP_IS62WV51216_ADD5_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD6_PORT, BSP_IS62WV51216_ADD6_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD7_PORT, BSP_IS62WV51216_ADD7_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD8_PORT, BSP_IS62WV51216_ADD8_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD9_PORT, BSP_IS62WV51216_ADD9_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD10_PORT, BSP_IS62WV51216_ADD10_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD11_PORT, BSP_IS62WV51216_ADD11_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD12_PORT, BSP_IS62WV51216_ADD12_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD13_PORT, BSP_IS62WV51216_ADD13_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD14_PORT, BSP_IS62WV51216_ADD14_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD15_PORT, BSP_IS62WV51216_ADD15_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD16_PORT, BSP_IS62WV51216_ADD16_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD17_PORT, BSP_IS62WV51216_ADD17_PIN, &stcGpioInit);
    (void)GPIO_Init(BSP_IS62WV51216_ADD18_PORT, BSP_IS62WV51216_ADD18_PIN, &stcGpioInit);

    /************************** Set EXMC pin function *************************/
    /* SMC_CS */
    GPIO_SetFunc(BSP_IS62WV51216_CS_PORT, BSP_IS62WV51216_CS_PIN, GPIO_FUNC_12);

    /* SMC_WE */
    GPIO_SetFunc(BSP_IS62WV51216_WE_PORT, BSP_IS62WV51216_WE_PIN, GPIO_FUNC_12);

    /* SMC_BLS[0:1] */
    GPIO_SetFunc(BSP_IS62WV51216_BLS0_PORT, BSP_IS62WV51216_BLS0_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_BLS1_PORT, BSP_IS62WV51216_BLS1_PIN, GPIO_FUNC_12);

    /* SMC_OE */
    GPIO_SetFunc(BSP_IS62WV51216_OE_PORT, BSP_IS62WV51216_OE_PIN, GPIO_FUNC_12);

    /* SMC_DATA[0:15] */
    GPIO_SetFunc(BSP_IS62WV51216_DATA0_PORT, BSP_IS62WV51216_DATA0_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA1_PORT, BSP_IS62WV51216_DATA1_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA2_PORT, BSP_IS62WV51216_DATA2_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA3_PORT, BSP_IS62WV51216_DATA3_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA4_PORT, BSP_IS62WV51216_DATA4_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA5_PORT, BSP_IS62WV51216_DATA5_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA6_PORT, BSP_IS62WV51216_DATA6_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA7_PORT, BSP_IS62WV51216_DATA7_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA8_PORT, BSP_IS62WV51216_DATA8_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA9_PORT, BSP_IS62WV51216_DATA9_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA10_PORT, BSP_IS62WV51216_DATA10_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA11_PORT, BSP_IS62WV51216_DATA11_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA12_PORT, BSP_IS62WV51216_DATA12_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA13_PORT, BSP_IS62WV51216_DATA13_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA14_PORT, BSP_IS62WV51216_DATA14_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_DATA15_PORT, BSP_IS62WV51216_DATA15_PIN, GPIO_FUNC_12);

    /* SMC_ADD[0:18]*/
    GPIO_SetFunc(BSP_IS62WV51216_ADD0_PORT, BSP_IS62WV51216_ADD0_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD1_PORT, BSP_IS62WV51216_ADD1_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD2_PORT, BSP_IS62WV51216_ADD2_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD3_PORT, BSP_IS62WV51216_ADD3_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD4_PORT, BSP_IS62WV51216_ADD4_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD5_PORT, BSP_IS62WV51216_ADD5_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD6_PORT, BSP_IS62WV51216_ADD6_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD7_PORT, BSP_IS62WV51216_ADD7_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD8_PORT, BSP_IS62WV51216_ADD8_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD9_PORT, BSP_IS62WV51216_ADD9_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD10_PORT, BSP_IS62WV51216_ADD10_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD11_PORT, BSP_IS62WV51216_ADD11_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD12_PORT, BSP_IS62WV51216_ADD12_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD13_PORT, BSP_IS62WV51216_ADD13_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD14_PORT, BSP_IS62WV51216_ADD14_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD15_PORT, BSP_IS62WV51216_ADD15_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD16_PORT, BSP_IS62WV51216_ADD16_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD17_PORT, BSP_IS62WV51216_ADD17_PIN, GPIO_FUNC_12);
    GPIO_SetFunc(BSP_IS62WV51216_ADD18_PORT, BSP_IS62WV51216_ADD18_PIN, GPIO_FUNC_12);
}

/**
 * @}
 */

#endif /* BSP_IS62WV51216_ENABLE && BSP_EV_HC32F4A0_LQFP176 */

/**
 * @}
 */

/**
 * @}
 */

/**
* @}
*/

/******************************************************************************
 * EOF (not truncated)
 *****************************************************************************/

 

2.2、sram.c

在驱动程序的基础上,参考之前的学习修改了下内存的读写程序

#include "main.h"
#include "hc32_ll.h"
#include "ev_hc32f4a0_lqfp176_bsp.h"
#include "ev_hc32f4a0_lqfp176_is62wv51216.h"
#include "lcd.h"

#define SMC_SRAM3_ADDR    ((uint32_t)(0x70000000))	
uint32_t testsram[250000] __attribute__((at(0X70000000)));

typedef __IO uint8_t  vu8;

void SMC_SRAM_WriteBuffer(uint8_t* pBuffer,uint32_t WriteAddr,uint32_t n)
{
	for(;n!=0;n--)  
	{										    
		*(vu8*)(SMC_SRAM3_ADDR+WriteAddr)=*pBuffer;	  
		WriteAddr++;
		pBuffer++;
	}   
}	

void SMC_SRAM_ReadBuffer(uint8_t* pBuffer,uint32_t ReadAddr,uint32_t n)
{
	for(;n!=0;n--)  
	{											    
		*pBuffer++=*(vu8*)(SMC_SRAM3_ADDR+ReadAddr);    
		ReadAddr++;
	}  
}

void init_sram(void)
{
	BSP_IS62WV51216_Init();
}

void smc_sram_test(uint16_t x,uint16_t y)
{  
	uint32_t i=0;  	  
	uint8_t temp=0;	   
	uint8_t sval=0;	 				   
  LCD_ShowString(x,y,400,y+24,24,"SRAM Test:     KB"); 
	
	for(i=0;i<1024*1024;i+=4096)
	{
		SMC_SRAM_WriteBuffer(&temp,i,1);
		temp++;
	} 
 	for(i=0;i<1024*1024;i+=4096) 
	{
  	SMC_SRAM_ReadBuffer(&temp,i,1);
		if(i==0)
		{
			sval=temp;
		}
 		else if(temp<=sval)
		{
			break;
		}			
		LCD_ShowxNum(x+16*8,y,(u16)(temp-sval+1)*4,4,24,0); 
 	}					 
}

void sram_test(void)
{
	uint32_t ts=0;
	for(ts=0;ts<250000;ts++)
	{
		testsram[ts]=ts;
	}
	smc_sram_test(0,0);
	DDL_DelayMS(500UL);
	for(ts=0;ts<250000;ts++)
	{
		LCD_ShowxNum(0,48,testsram[ts],6,24,0);//显示测试数据
	}
	
	LCD_ShowString(0,72,400,24,24,"test finish!"); 
	
}

 

2.3、main.c

int32_t main(void)
{
	uint16_t u=0;
	uint16_t cord[6]={WHITE, BLUE, BRED, GBLUE, RED, YELLOW};
    /* Register write enable for some required peripherals. */
    LL_PERIPH_WE(LL_PERIPH_GPIO | LL_PERIPH_FCG | LL_PERIPH_PWC_CLK_RMU | LL_PERIPH_EFM | LL_PERIPH_SRAM);
	
	BSP_CLK_Init();
	/* EXCLK 60MHz */
    CLK_SetClockDiv(CLK_BUS_EXCLK, CLK_EXCLK_DIV4);
	DDL_PrintfInit(BSP_PRINTF_DEVICE, BSP_PRINTF_BAUDRATE, BSP_PRINTF_Preinit);
	BSP_IO_Init();
    BSP_LCD_IO_Init();
	BSP_GT9XX_Init();
	
	init_lcd();
	init_sram();
	
	LL_PERIPH_WP(LL_PERIPH_GPIO | LL_PERIPH_FCG | LL_PERIPH_PWC_CLK_RMU | LL_PERIPH_EFM | LL_PERIPH_SRAM);
	POINT_COLOR=RED;       
	LCD_Clear(WHITE);
	sram_test();
    while(1);

}

 

三、程序运行

 

屏幕刷新读取外部SRAM存储器的数据,测试时间较长,截取一段视频。

20230220000217

 

最新回复

您的LCD屏是什么屏呀,我用原子屏,好象驱动不起来。  详情 回复 发表于 2023-2-20 12:59
点赞 关注
 
 

回复
举报

6841

帖子

11

TA的资源

版主

沙发
 
您的LCD屏是什么屏呀,我用原子屏,好象驱动不起来。

点评

4.3寸的电容屏  详情 回复 发表于 2023-2-20 13:51
 
 
 

回复

410

帖子

3

TA的资源

纯净的硅(高级)

板凳
 
lugl4313820 发表于 2023-2-20 12:59 您的LCD屏是什么屏呀,我用原子屏,好象驱动不起来。

4.3寸的电容屏

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表