目录
在ART-Pi H750上移植TouchGFX(一)——使用STM32CUBMX生成TouchGFX工程
在ART-Pi H750上移植TouchGFX(二)——制作MDK的外部QSPI-FLASH烧录算法
在ART-Pi H750上移植TouchGFX(三)——移植TouchGFX到RT-Thread系统
在ART-Pi H750上移植TouchGFX(四)——使用RT-Thread Studio移植TouchGFX
在ART-Pi H750上移植TouchGFX(五)——制作ST-LINK的外部QSPI-FLASH烧录算法
实验平台:
硬件: RT-Thread官方ART-PI H750开发版,正点原子4.3寸RGBLCD屏(800*480)
软件: 最新版本的STM32CubeH7固件库,TouchGFXDesigner v4.14和 STM32CubeMX V6.0.1,开发环境MDK v5.29
联系作者:
关注公众号,免费查看,回复“加群”,加入技术交流群
从零开始创建TouchGFX UI项目
选择MCU型号(STM32H750XBH6)
选择和配置组件(系统、外设、中间件)
系统需要
RCC
SYS
GUI功能需要
I2C
FMC
在主程序中添加SDRAM的初始化代码:
#define REFRESH_COUNT 677
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
void MX_SDRAM_InitEx(void)
{
__IO uint32_t tmpmrd = 0;
/* Step 1: Configure a clock configuration enable command */
Command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);
/* Step 2: Insert 100 us minimum delay */
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
HAL_Delay(1);
/* Step 3: Configure a PALL (precharge all) command */
Command.CommandMode = FMC_SDRAM_CMD_PALL;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);
/* Step 4: Configure an Auto Refresh command */
Command.CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command.AutoRefreshNumber = 4;
Command.ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);
/* Step 5: Program the external memory mode register */
tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_4 |\
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |\
SDRAM_MODEREG_CAS_LATENCY_2 |\
SDRAM_MODEREG_OPERATING_MODE_STANDARD |\
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
Command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command.AutoRefreshNumber = 1;
Command.ModeRegisterDefinition = tmpmrd;
/* Send the command */
HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);
/* Step 6: Set the refresh rate counter */
/* Set the device refresh rate */
HAL_SDRAM_ProgramRefreshRate(&hsdram1, REFRESH_COUNT);
}
QUADSPI
DMA2D
LCDC
LTDC基本参数设置
Layer参数设置
CRC
NVIC
中间件需要
基本参数配置
任务和队列
TouchGFX软件包
应用层需要
UART
UART4
配置时钟树
设置工程并生成工程
执行TouchGFX Designer
测试TouchGFX显示基本UI
来源:oschina
链接:https://my.oschina.net/u/4330404/blog/4587941