完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
使用的是F407ZGT 的FSMC调试B505时使用LCD_CLEAR(WHITE)时显示不正常,表现:1较少几率出现为黑白相间条 2.黑白相间的刷几行就没有了
而是用其他颜色均可正常显示,B505在miniSTM32上正常工作,现象很诡异,也可能很低级,相关代码如下,请帮忙看看 RS接A16 使用NE4 FSMC初始化: LCD_EXT void LCD_GPIOInit(void){ FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMtimingInitTypeDef p; GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIOs clock */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG|RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOB, ENABLE); /* Enable FSMC clock */ RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); /* GPIOD configuration */ GPIO_PinAFConfig(GPIOD, GPIO_PinSource0, GPIO_AF_FSMC);//FSMC_D2 GPIO_PinAFConfig(GPIOD, GPIO_PinSource1, GPIO_AF_FSMC);//FSMC_D3 GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_FSMC);//FSMC_NOE GPIO_PinAFConfig(GPIOD, GPIO_PinSource5, GPIO_AF_FSMC);//FSMC_NWE GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_FSMC);//FSMC_D13 GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_FSMC);//FSMC_D14 GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_FSMC);//FSMC_D15 GPIO_PinAFConfig(GPIOD, GPIO_PinSource11, GPIO_AF_FSMC);//FSMC_A16 GPIO_PinAFConfig(GPIOD, GPIO_PinSource14, GPIO_AF_FSMC);//FSMC_D0 GPIO_PinAFConfig(GPIOD, GPIO_PinSource15, GPIO_AF_FSMC);//FSMC_D1 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 |GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 |GPIO_Pin_14 |GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOD, &GPIO_InitStructure); /* GPIOE configuration */ GPIO_PinAFConfig(GPIOE, GPIO_PinSource7 , GPIO_AF_FSMC);//FSMC_D4 GPIO_PinAFConfig(GPIOE, GPIO_PinSource8 , GPIO_AF_FSMC);//FSMC_D5 GPIO_PinAFConfig(GPIOE, GPIO_PinSource9 , GPIO_AF_FSMC);//FSMC_D6 GPIO_PinAFConfig(GPIOE, GPIO_PinSource10 , GPIO_AF_FSMC);//FSMC_D7 GPIO_PinAFConfig(GPIOE, GPIO_PinSource11 , GPIO_AF_FSMC);//FSMC_D8 GPIO_PinAFConfig(GPIOE, GPIO_PinSource12 , GPIO_AF_FSMC);//FSMC_D9 GPIO_PinAFConfig(GPIOE, GPIO_PinSource13 , GPIO_AF_FSMC);//FSMC_D10 GPIO_PinAFConfig(GPIOE, GPIO_PinSource14 , GPIO_AF_FSMC);//FSMC_D11 GPIO_PinAFConfig(GPIOE, GPIO_PinSource15 , GPIO_AF_FSMC);//FSMC_D12 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_Init(GPIOE, &GPIO_InitStructure); /* LCD_CS Pin config as GPIOG_PIN_12 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_Init(GPIOG, &GPIO_InitStructure);/* LCD_BL Pin config as GPIOA_PIN_0*/GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;GPIO_Init(GPIOA, &GPIO_InitStructure); }/******************************************************************************** Function Name : LCD_FSMCConfig* Description : Configures the Parallel interface (FSMC) for LCD(Parallel mode)* Input : None* Output : None* Return : None*******************************************************************************/ LCD_EXT void LCD_FSMCConfig(void){ FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; FSMC_NORSRAMTimingInitTypeDef p; /*-- FSMC Configuration ------------------------------------------------------*/ /* FSMC_Bank1_NORSRAM4 timing configuration */ p.FSMC_AddressSetupTime =0;//1 p.FSMC_AddressHoldTime = 0; p.FSMC_DataSetupTime =2; p.FSMC_BusTurnAroundDuration = 0;//0 p.FSMC_CLKDivision = 0; p.FSMC_DataLatency = 0; p.FSMC_AccessMode = FSMC_AccessMode_B;//FSMC_AccessMode_B; /* FSMC_Bank1_NORSRAM4 configured as follows: - Data/Address MUX = Disable - Memory Type = SRAM - Data Width = 16bit - Write Operation = Enable - Extended Mode = Disable - Asynchronous Wait = Disable */ FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4; FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;//16bit FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); /* Enable FSMC_Bank1_NORSRAM4 */ FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE); } ================================================= B505驱动 读写 LCD_EXT void LCD_Init(void){ LCD_WriteReg(0x0000,0x0000);LCD_WriteReg(0x0000,0x0000);LCD_WriteReg(0x0000,0x0000);LCD_WriteReg(0x0000,0x0000);LCD_WriteReg(0x00a4,0x0001);delay(20); LCD_WriteReg(0x0060,0x2700);LCD_WriteReg(0x0008,0x0202);LCD_WriteReg(0x0030,0x0214);LCD_WriteReg(0x0031,0x3715);LCD_WriteReg(0x0032,0x0604);LCD_WriteReg(0x0033,0x0e16);LCD_WriteReg(0x0034,0x2211);LCD_WriteReg(0x0035,0x1500);LCD_WriteReg(0x0036,0x8507);LCD_WriteReg(0x0037,0x1407);LCD_WriteReg(0x0038,0x1403);LCD_WriteReg(0x0039,0x0020);LCD_WriteReg(0x0090,0x001a);LCD_WriteReg(0x0010,0x0000);LCD_WriteReg(0x0011,0x0007);LCD_WriteReg(0x0012,0x0000);LCD_WriteReg(0x0013,0x0000);delay(20);LCD_WriteReg(0x0010,0x0730);LCD_WriteReg(0x0011,0x0137);delay(20);LCD_WriteReg(0x0012,0x01b8); delay(20);LCD_WriteReg(0x0013,0x0f00);LCD_WriteReg(0x002a,0x0080);LCD_WriteReg(0x0029,0x0048);delay(20);LCD_WriteReg(0x0001,0x0100);LCD_WriteReg(0x0002,0x0700);LCD_WriteReg(0x0003,0x1230);LCD_WriteReg(0x0008,0x0202);LCD_WriteReg(0x000a,0x0000);LCD_WriteReg(0x000c,0x0000);LCD_WriteReg(0x000d,0x0000);LCD_WriteReg(0x000e,0x0030);LCD_WriteReg(0x0050,0x0000);LCD_WriteReg(0x0051,0x00ef);LCD_WriteReg(0x0052,0x0000);LCD_WriteReg(0x0053,0x013f);LCD_WriteReg(0x0060,0x2700);LCD_WriteReg(0x0061,0x0001);LCD_WriteReg(0x006a,0x0000);//LCD_WriteReg(0x0080,0x0000);//LCD_WriteReg(0x0081,0x0000);LCD_WriteReg(0x0090,0X0011);LCD_WriteReg(0x0092,0x0600);LCD_WriteReg(0x0093,0x0402);LCD_WriteReg(0x0094,0x0002);delay(20);LCD_WriteReg(0x0007,0x0001);delay(20);LCD_WriteReg(0x0007,0x0061);LCD_WriteReg(0x0007,0x0173);LCD_WriteReg(0x0020,0x0000);LCD_WriteReg(0x0021,0x0000); LCD_WriteReg(0x00,0x22); } =========================LCD读写如下 LCD_EXT void LCD_WriteReg(u8 LCD_Reg, u16 LCD_RegValue){*(volatile u16 *) (LCD_CMD)= LCD_Reg; *(volatile u16 *) (LCD_DATA)= LCD_RegValue; } LCD_EXT void LCD_WriteData(u16 data){*(volatile u16 *) (LCD_DATA)= data;} //读寄存器LCD_EXT u16 LCD_ReadReg(u8 LCD_Reg){ *(volatile u16 *) (LCD_CMD)= LCD_Reg;;//写入要读的寄存器序号delay(5); return (*(volatile u16 *) (LCD_DATA));//返回读到的值} //开始写GRAMLCD_EXT void LCD_WriteRAM_Prepare(void){//LCD->LCD_REG = R34;*(volatile u16 *) (LCD_CMD)= R34;} //LCD写GRAMLCD_EXT void LCD_WriteRAM(u16 RGB_Code){ //LCD->LCD_RAM = RGB_Code;//写十六位GRAM*(volatile u16 *) (LCD_DATA)= RGB_Code;} |
|
相关推荐
3个回答
|
|
在MINI上是正常的,又试了下白色的0XFFFF和0XFFFE 就没有写进RAM 读取到点的颜色是上次LCDclear的值
|
|
|
|
|
|
|
|
代码没有变换成4531后白色正常,恩很诡异啊,原子你是用b505验证过了吗?
|
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1877 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1661 浏览 1 评论
1145 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
760 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1720 浏览 2 评论
1963浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
789浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
612浏览 3评论
629浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
590浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-12 03:04 , Processed in 0.644591 second(s), Total 49, Slave 43 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号