嗯,我帮你问问。貌似今天他们不上班呢,可能明天回复。
谢谢版主!
离线
你买的是哪一款?估计是你搞错了型号,他们给的代码里不同型号的初始化代码是不一样的的。我当时调了好久才点亮
离线
楼主你现在具体是什么问题呢?
我买的就是51pin的,卖家也多次确认过支持RGB888模式。这个屏使用的瑞萨R61529芯片,需要通过spi口下发初始化命令以后RGB口才可以工作。现在我按照卖家提供的参考板设计的底板,然后按照卖家提供的初始化代码下发设置,但是屏幕始终是黑的。
我们的原理图,初始化代码,RGB口时序都已经发给卖家,但是卖家始终不置一词,感觉就像在故意看笑话一样。
离线
楼主你现在具体是什么问题呢?
现在和他们协商,想买一套他们的开发板,带3.5寸屏,要求他们烧好支持RGB888模式的固件。这样我们调试的时候可以对比测试。
还不知道他们能不能做到。
离线
哇酷小二 说:楼主你现在具体是什么问题呢?
现在和他们协商,想买一套他们的开发板,带3.5寸屏,要求他们烧好支持RGB888模式的固件。这样我们调试的时候可以对比测试。
还不知道他们能不能做到。
根据楼主的帖子,我觉得问题还是在时序上面,上逻辑分析仪试一试?再与卖家提供的时序对比。
离线
@memory
我们的初始化代码,RGB时序都是根据卖家提供的一大堆资料连蒙带猜出来的。上逻辑分析仪当然可以,但是最好卖家能确认一下我们当前的设置是不是对的。
感觉卖家的态度就是,一切都由买家自己决定。。。
下面是卖家提供的初始化代码。比如第一条指令0xB4和第二条指令0xB0,按照瑞萨R61529的手册,必须先执行0xB0指令打开寄存器保护,否则任何寄存器访问都是无效的。也就是说第一条指令0xB4是一个无效访问。
void Lcd_Initialize(void) //LCD初始化函数
{
LCD_SPI_CS(1);
LCD_delay(20);
LCD_SPI_CS(0);
LCD_Reset();
SPI_WriteComm(0xB4);
SPI_WriteData(0x00);
SPI_WriteComm(0xB0);
SPI_WriteData(0x04);
SPI_WriteComm(0x20);
SPI_WriteComm(0x36); //Set_address_mode
SPI_WriteData(0x6A); //横屏
SPI_WriteComm(0x3A);
SPI_WriteData(0x77);
SPI_WriteComm(0xB3);
SPI_WriteData(0x02);
SPI_WriteData(0x00);
SPI_WriteData(0x00);
SPI_WriteData(0x20);
SPI_WriteComm(0xc0);
SPI_WriteData(0x03);
SPI_WriteData(0xdf);
SPI_WriteData(0x40);
SPI_WriteData(0x12);
SPI_WriteData(0x00);
SPI_WriteData(0x01);
SPI_WriteData(0x00);
SPI_WriteData(0x55);//
SPI_WriteComm(0xc1);
SPI_WriteData(0x07);
SPI_WriteData(0x28);
SPI_WriteData(0x08);//
SPI_WriteData(0x08);//
SPI_WriteData(0x00);//
SPI_WriteComm(0xc4);
SPI_WriteData(0x70);//
SPI_WriteData(0x00);
SPI_WriteData(0x03);
SPI_WriteData(0x01);
SPI_WriteComm(0xc6);
SPI_WriteData(0x1d);//1d
SPI_WriteComm(0xc8);
SPI_WriteData(0x06);
SPI_WriteData(0x0c);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3d);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0c);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xC9);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xCA);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xD0);
SPI_WriteData(0x95);
SPI_WriteData(0x0A);
SPI_WriteData(0x08);
SPI_WriteData(0x10);
SPI_WriteData(0x39);
SPI_WriteComm(0xD1);
SPI_WriteData(0x02);
SPI_WriteData(0x2c);//
SPI_WriteData(0x2c);//
SPI_WriteData(0x44);//
SPI_WriteData(0x00);//0x08
SPI_WriteComm(0x11);
LCD_delay(100);
SPI_WriteComm(0x29);
LCD_delay(100);
SPI_WriteComm(0x2C);
SPI_WriteComm(0x36);
#if LCD_RGB_ORIENTATION //是否旋转90度
SPI_WriteData(0x09);
#else
SPI_WriteData(0x08);
#endif
}
离线
@wuyu
嗯,你上面买一块能点亮的板子是对的,用逻辑分析仪把录到的时序用单片机回放出来就OK了。
离线
@memory
这是我们的初始化代码,可以看到读device id都是成功的,就是代码中的byte1和byte2。感觉spi口时序已经对了。
{
unsigned char byte1,byte2;
/* Initialize the pins */
if (r61408_enable_gpio(cfg) != 0)
return ;
gpio_set_value(cfg->csx_pin, 1);
mdelay(20);
gpio_set_value(cfg->csx_pin, 0);
gpio_set_value(cfg->reset_pin, 0);
mdelay(200);
gpio_set_value(cfg->reset_pin, 1);
mdelay(200);
#if 1
// Enter read mode
SPI_WriteComm(0xB0);
SPI_WriteData(0x04);
SPI_WriteComm(0xBF);
SPI_ReadData();
printf("DDB0=%x, DDB1=%x\n", SPI_ReadData(), SPI_ReadData());
byte1 = SPI_ReadData();
byte2 = SPI_ReadData();
// Enter read mode
SPI_WriteComm(0xB0);
SPI_WriteData(0x04);
if (byte1==0x15 && byte2==0x29) {
printf("R61259 found!\n");
r61529_Reg_Fill();
}
gpio_set_value(cfg->csx_pin, 1);
#else
#endif
}
static void r61529_Reg_Fill(void)
{
SPI_WriteComm(0xB4);
SPI_WriteData(0x00);
SPI_WriteComm(0xB0);
SPI_WriteData(0x04);
SPI_WriteComm(0x20);
SPI_WriteComm(0x36); //Set_address_mode
SPI_WriteData(0x6A); //
SPI_WriteComm(0x3A);
SPI_WriteData(0x77);
SPI_WriteComm(0xB3);
SPI_WriteData(0x02);
SPI_WriteData(0x00);
SPI_WriteData(0x00);
SPI_WriteData(0x20);
SPI_WriteComm(0xc0);
SPI_WriteData(0x03);
SPI_WriteData(0xdf);
SPI_WriteData(0x40);
SPI_WriteData(0x12);
SPI_WriteData(0x00);
SPI_WriteData(0x01);
SPI_WriteData(0x00);
SPI_WriteData(0x55);//
SPI_WriteComm(0xc1);
SPI_WriteData(0x07);
SPI_WriteData(0x28);
SPI_WriteData(0x08);//
SPI_WriteData(0x08);//
SPI_WriteData(0x00);//
SPI_WriteComm(0xc4);
SPI_WriteData(0x70);//
SPI_WriteData(0x00);
SPI_WriteData(0x03);
SPI_WriteData(0x01);
SPI_WriteComm(0xc6);
SPI_WriteData(0x1d);//1d
SPI_WriteComm(0xc8);
SPI_WriteData(0x06);
SPI_WriteData(0x0c);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3d);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0c);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xC9);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xCA);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteData(0x06);
SPI_WriteData(0x0C);
SPI_WriteData(0x16);
SPI_WriteData(0x24);
SPI_WriteData(0x30);
SPI_WriteData(0x48);
SPI_WriteData(0x3D);
SPI_WriteData(0x28);
SPI_WriteData(0x20);
SPI_WriteData(0x14);
SPI_WriteData(0x0C);
SPI_WriteData(0x04);
SPI_WriteComm(0xD0);
SPI_WriteData(0x95);
SPI_WriteData(0x0A);
SPI_WriteData(0x08);
SPI_WriteData(0x10);
SPI_WriteData(0x39);
SPI_WriteComm(0xD1);
SPI_WriteData(0x02);
SPI_WriteData(0x2c);//
SPI_WriteData(0x2c);//
SPI_WriteData(0x44);//
SPI_WriteData(0x00);//0x08
SPI_WriteComm(0x11);
mdelay(100);
SPI_WriteComm(0x29);
mdelay(100);
SPI_WriteComm(0x2C);
SPI_WriteComm(0x36);
#if LCD_RGB_ORIENTATION //
SPI_WriteData(0x09);
#else
SPI_WriteData(0x08);
#endif
}
最近编辑记录 wuyu (2021-10-11 13:32:14)
离线
离线
@哇酷小二
谢谢回复!
我读device id都成功了,是不是说明spi口的时序肯定ok了?
离线
试一试大佬改的这个驱动:
LCD_WR_REG(0x11);
delay_ms(20);
LCD_WR_REG(0xD0);
LCD_WR_DATA(0x07);
LCD_WR_DATA(0x42);
LCD_WR_DATA(0X18);
LCD_WR_REG(0xD1);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x07);
LCD_WR_DATA(0x10);
LCD_WR_REG(0xD2);
LCD_WR_DATA(0x01);
LCD_WR_DATA(0x02);
LCD_WR_REG(0xC0);
LCD_WR_DATA(0x10);
LCD_WR_DATA(0x3B);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x02);
LCD_WR_DATA(0x11);
LCD_WR_REG(0xC5);
LCD_WR_DATA(0x03);
LCD_WR_REG(0xC8);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x32);
LCD_WR_DATA(0x36);
LCD_WR_DATA(0x45);
LCD_WR_DATA(0x06);
LCD_WR_DATA(0x16);
LCD_WR_DATA(0x37);
LCD_WR_DATA(0x75);
LCD_WR_DATA(0x77);
LCD_WR_DATA(0x54);
LCD_WR_DATA(0x0C);
LCD_WR_DATA(0x00);
LCD_WR_REG(0x36);
LCD_WR_DATA(0x0A);
LCD_WR_REG(0x3A);
LCD_WR_DATA(0x55);
LCD_WR_REG(0x2A);
LCD_WR_DATA(0X00);
LCD_WR_DATA(0X00);
LCD_WR_DATA(0X01);
LCD_WR_DATA(0X3F);
LCD_WR_REG(0x2B);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x01);
LCD_WR_DATA(0xDF);
delay_ms(120);
LCD_WR_REG(0x29); //display on
看屏幕有没有雪花,再不行就CSX接地。
离线
@哇酷小二
试过了大佬的代码,还是黑屏。csx在整个初始化期间都是拉低的。
最近编辑记录 wuyu (2021-10-12 09:37:46)
离线
今天收到了卖家的3.5寸开发套件。
用示波器测量了一下,发现开发套件的时序当中,csx信号每个周期都有拉低/再拉高的操作,貌似这样操作和瑞萨手册不符。参照修改了代码,测试还是黑屏。打算用逻辑分析仪抓一下spi上的所有波形,居然发现这个MCU速度还挺高,手头的逻辑分析仪器16Msps采样率居然无法抓全它的时钟!
大家看看有什么好的建议继续调试下去?
最近编辑记录 wuyu (2021-10-14 18:07:16)
离线
修改代码,把spi 时钟频率降下来,如果屏幕正常,就用逻辑分析仪抓完整的数据。
离线
找2個有讀和寫的Registers做測試,依序做讀寫讀寫動作,可以驗證SPI數據的傳送問題,釐清後,假如還有問題,可以往RGB888方向查看~
我选取了set_address_mode 0x36 寄存器测试,每次写入以后用get_address_mode 0x0B 寄存器读回。
发现写入0x6A,读回是0x68;
写入0x08,读回是0x08。
是不是可以认定写入基本是成功了?
离线
找2個8-bits都可以讀寫的Register,使用迴圈從0~255依序讀寫,資料沒問題的話,SPI介面基本上可以排除~可以往屏初始化問題查找
你方便發一下這個屏驅動的PDF嗎?
我现在不在电脑前,你百度r61529看一下。我没有找到特别合适的寄存器做这个测试。
今天想办法用示波器抓了卖家开发板的spi时序,基本和他提供的初始化代码吻合,他的spi时钟将近50MHz,一般的逻辑分析仪不好抓。
这个问题已经比较吊诡了,感觉没有思路了。
离线
找2個有讀和寫的Registers做測試,依序做讀寫讀寫動作,可以驗證SPI數據的傳送問題,釐清後,假如還有問題,可以往RGB888方向查看~
这个屏还没有调出来。现在在查RGB口,对比时序发现有个问题。卖家开发板HSYNC和VSYNC信号之间似乎有个相位差,大概32个时钟左右。而通常mpu的lcd控制器,HSYNC和VSYNC是完全同步的。请问会是这个问题吗?R61529驱动,是不是哪里可以设置这个相位差?
离线
TKM32F499GT8评估板资料集
https://whycan.com/t_5861.html18、TK499_LCD_TK035F5589_TK80_DMA例程.rar
楼主你用的是这个Demo吗? 是基于这个Demo 修改吗?
你发的这个例程是并口的,我用的是spi串口初始化的。我看了一下寄存器设置也不太一样。
离线
这个屏当时没有点亮,还劳烦论坛的@司徒大佬过来相帮。
后来才发现,问题并不在spi口通讯上。r61529这个芯片,初始化的时候是需要借用到LCD pixel clock的,如果缺失这个clock,初始化就会失败,也就是黑屏。
先打RGB接口的时钟,然后再调用spi初始化,屏就工作了。
离线
把开发板和转接板都买了,然后用逻辑分析仪或者别的东西
离线