这两天搞7寸彩屏的驱动。使用新塘NCU130芯片。屏幕驱动芯片用了SSD1963。现在仿真时候,读取写入的初始化命令仍旧是默认值。而且对于多参数的寄存器命令,读取的默认数据也不完全正确。现象是(对于参数值大于3的寄存命令):第一个默认参数正确,然后一直读取到第三个默认参数。现在比较纠结,求大家帮忙分析下。原理图我贴出来了。程序也给出。
这一段是主函数内的测试程序。//system_status_led
GPIOB->DOUT ^=BIT15;
//×¼±¸ÏÔʾµÄ³õʼ»¯´úÂ룬ÏÖÔÚ¿ÉÒÔ²»Óÿ¼ÂÇ
SSD1963_WRITE_BLOCK(0X10,0X10);
//ÃüÁîÅäÖÃÕýÈ·Óë·ñµÄ״̬µÆ
GPIOB->DOUT &=~BIT8;
DELAY();
//оƬID
WRITE_SSD1963(0X00A1,SSD1963_COMMAND);
M=READ_SSD1963();
N=READ_SSD1963();
C=READ_SSD1963();
if((M==0X0001)&&(N==0X0057)&&(C==0X0061))
GPIOB->DOUT |=BIT8;
系统时钟初始化void SystemInit(void)
{
//
UNLOCKREG(1);
SYSCLK->PWRCON.XTL12M_EN = ENABLE;
SYSCLK->PLLCON.FB_DV = 46;
SYSCLK->PLLCON.IN_DV = 2;
SYSCLK->PLLCON.OUT_DV = 3;
//ÉèÖÃPLL±¶Æµµç·µÄʱÖÓԴΪÍⲿ16M¾§Õñ
SYSCLK->PLLCON.PLL_SRC = 0;
//ÉèÖÃPCLKʱÖÓÔ´µÄʱÖÓ³ýƵÊý
SYSCLK->CLKDIV.HCLK_N = 0;
//ʹÄÜPLLµç·
SYSCLK->PLLCON.OE = 0;
while((SYSCLK->CLKSTATUS.PLL_STB==1)&&(SYSCLK->CLKSTATUS.XTL12M_STB==1));
// SELECT PLLOUT AS HCLK_SOURCE 2
SYSCLK->CLKSEL0.HCLK_S = 2;
//SELECT HCLK/2 AS SYSTICK
SYSCLK->CLKSEL0.STCLK_S = 3;
LOCKREG(0);
}
读写函数代码:void WRITE_SSD1963(unsigned short int PARAMETER, unsigned char D_C)
{
while(TE_LOW);
switch(D_C)
{
case SSD1963_DATA : GPIOB->DOUT |= BIT6;//EBI_ALE_MASK
*((volatile unsigned int *)(USER_EBI_BASE)) = PARAMETER ;
break ;
case SSD1963_COMMAND : GPIOB->DOUT &= ~BIT6;//~EBI_ALE_MASK
*((volatile unsigned int *)(USER_EBI_BASE)) = PARAMETER ;
break;
default : ;
}
}
unsigned short int READ_SSD1963(void)
{
return (*((volatile unsigned int *)(USER_EBI_BASE)));
}
新塘外部总线配置也贴出来:void EBI_CONFIG(void)
{
//½âËøÉÏËø¼Ä´æÆ÷
UNLOCKREG(1);
//EBIʱÖÓ¿ªÆô
SYSCLK->AHBCLK.EBI_EN = 1;
//EBI FUNCTION ENABLE
EBI->EBICON.ExtEN = 1;
//EBI DATA_WIDTH = 16
EBI->EBICON.ExtBW16 = 1;
//EBIÊä³öʱÖÓ·ÖƵÆ÷ÉèÖÃ
/*-0 48-1 24-2 12-3 6-4 3-5 1.5-*/
EBI->EBICON.MCLKDIV = 0;
//Ëø´æÐźÅALE±£³Öʱ¼ä
EBI->EBICON.ExttALE = 0;
//INSERT IDLE AFTER READ
EBI->EXTIME.ExtIR2R = 0X05;
//INSERT IDLE AFTER WRITE
EBI->EXTIME.ExtIW2X = 0X05;
//ÉèÖ÷ÃÎʱ£³Öʱ¼ä
EBI->EXTIME.ExttAHD = 0X01;
//ÉèÖ÷ÃÎÊʱ¼ä
EBI->EXTIME.ExttACC = 0X0F;
//¼Ä´æÆ÷ÉÏËø
LOCKREG(0);
}
比较纠结,我想问题还是应该出在EBI与SSD1963之间的通讯,求有过经历的前辈指教。多谢了 |