显示文字都挺正常的,但是显示图片就无法显示或者显示一会就花屏,图片是转换成数组的那种。是不是驱动不对,用过这个屏的大神请指教下小弟。
以下是接线图,背光是跟串口1共用的引脚PA10,串口1也用来下载程序,初始化这个引脚的时候屏就亮了,而且这个引脚拉低无效(不知道为什么),也就是不能关掉背光。
以下是SSD1963的时序图,读写时序差不多。
我的驱动代码是这样的
typedef struct
{
vu16 LCD_REG;
vu16 LCD_RAM;
}LCD_TypeDef;
/* LCD is connected to the FSMC_Bank1_NOR/SRAM2 and NE2 is used as ship select signal */
#define LCD_BASE ((u32)(0x64000000 | 0x0000007E))//fsmc_A6作为RS
#define LCD ((LCD_TypeDef *) LCD_BASE)
void LCD_Init(void)
{
其他引脚都是复用推挽输出,当开启PA10的复用功能后,屏就会亮,不开启复用功能,屏不会亮
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1); //pwm复用配置,LCD背光
Timing_Read.FSMC_AddressSetupTime = 10; //一开始为,f103这里是3
Timing_Read.FSMC_AddressHoldTime = 0;
Timing_Read.FSMC_DataSetupTime = 8; //一开始为12,f103这里是4
Timing_Read.FSMC_CLKDivision = 0;
Timing_Read.FSMC_BusTurnAroundDuration = 0;
Timing_Read.FSMC_DataLatency = 0;
Timing_Read.FSMC_AccessMode = FSMC_AccessMode_A;
FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM2;
FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
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_WriteBurst = FSMC_WriteBurst_Disable;
FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &Timing_Read;
FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &Timing_Read;
FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM2, ENABLE);
然后依次写E2,E0,01,E6,B0,B4,B6寄存器,写完之后这是接下来的寄存器的配置
LCD_WR_REG(0x00BA); //字是正着的
LCD_WR_DATA(0x0005); //GPIO[3:0] out 1
LCD_WR_REG(0x00B8);
LCD_WR_DATA(0x0007);
// LCD_WR_DATA(0x000f); //GPIO3=input, GPIO[2:0]=output
LCD_WR_DATA(0x0001); //GPIO0 normal
LCD_WR_REG(0x0036); //rotation of color
LCD_WR_DATA(0x0008); //显示为从上到下,从左到右,帧缓存里为RGB,显示为BGR
LCD_WR_REG(0x00F0); //pixel data interface
LCD_WR_DATA(0x0003); //设置像素为16位(565)模式
delay_ms(100);
LCD_WR_REG(0x0029); //display on
LCD_WR_REG(0x00BE); //set PWM for B/L
LCD_WR_DATA(0x0006);
LCD_WR_DATA(0x0080);
LCD_WR_DATA(0x0001);
LCD_WR_DATA(0x00f0);
LCD_WR_DATA(0x0000);
LCD_WR_DATA(0x0000);
LCD_WR_REG(0x00d0);//设置动态背光控制配置
LCD_WR_DATA(0x000d);
LCD_Clear(BLACK);
}有没有大神弄过这个屏的,帮忙看看哪里出错了。
一周热门 更多>