NHD-5.0-800480FT-CTXL-T representing...
Hello, I am trying to setup the screen. I have followed the startup sequence. I am able to read the 0x7C and I pass the correct parameters to the screen. I know the screen recives info because when I update the REG_PWM_DUTY to a different values I can see how the brightness changes.
The proble is that the screen shows a pattern of lines, doesn´t matter what is writted in RAM_DL. I have look with the osciloscope that writting write_spi(RAM_DL+0, CLEAR_COLOR_RGB(255, 255, 255), 4); sends 0xB0 00 00 FF FF FF 02.
I send a read command to read RAM_DL and I can see in osciloscope 0x30 00 00 FF FF FF 02, which is coherent with the spected information.
I attach the code I am using:
//Powerdown
port_pin_set_output_level(PIN_PA20, false);
waitx(2000);
port_pin_set_output_level(PIN_PA20, true);
waitx(2000);
//inicializar_pantalla();
write_spi_pantalla_host_command(0x440000,3);waitx(100);
write_spi_pantalla_host_command(0x620000,3);waitx(100);
write_spi_pantalla_host_command(0x680000,3);waitx(100);
write_spi_pantalla_host_command(0,3);waitx(100);//Host command ACTIVE
waitx(2000);
while(dato!=0x7C){
waitx(100);
dato = read_spi_pantalla(REG_ID,1);
uart_printf("dato = %x ", dato);
}
while(dato!=0){
waitx(100);
dato = read_spi_pantalla(REG_CPURESET,1);
uart_printf("CPU = %x ", dato);
}
waitx(2000);
write_spi_pantalla(REG_HCYCLE, 928, 2);waitx(100);
write_spi_pantalla(REG_HOFFSET, 88, 2);waitx(100);
write_spi_pantalla(REG_HSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_HSYNC1, 48, 2);waitx(100);
write_spi_pantalla(REG_VCYCLE, 525, 2);waitx(100);
write_spi_pantalla(REG_VOFFSET, 32, 2);waitx(100);
write_spi_pantalla(REG_VSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_VSYNC1, 3, 2);waitx(100);
write_spi_pantalla(REG_SWIZZLE, 0, 1);waitx(100);
write_spi_pantalla(REG_PCLK_POL, 0, 1);waitx(100);
write_spi_pantalla(REG_CSPREAD, 0, 1);waitx(100);
write_spi_pantalla(REG_HSIZE, 800, 1);waitx(100);
write_spi_pantalla(REG_VSIZE, 480, 1);waitx(100);
write_spi_pantalla(REG_DITHER, 1, 1); waitx(100);
write_spi_pantalla(REG_PWM_HZ, 1000, 2);waitx(100);
write_spi_pantalla(REG_PWM_DUTY, 40, 1);waitx(100);
//primer display list
write_spi_pantalla(RAM_DL+0, CLEAR_COLOR_RGB(0, 0, 252), 4);waitx(100);
write_spi_pantalla(RAM_DL+4, CLEAR(1, 1, 1), 4);waitx(100);
write_spi_pantalla(RAM_DL+8, DISPLAY(), 4);waitx(100);
write_spi_pantalla(REG_DLSWAP, DLSWAP_FRAME, 1);waitx(100);
write_spi_pantalla(REG_GPIO_DIR, 0x80 , 1); waitx(100);
write_spi_pantalla(REG_GPIO, 0x80 | 0x3, 1); waitx(100);
write_spi_pantalla(REG_PCLK, 2, 1);
Please help, I can´t imagine what is the thing I am not doing correctly.
Following an image of what shows the screen:
-
Hi Rafael,
Are you able to share the function "write_spi_pantalla"?
Could you try also set your registers first and then end the display list?
After this, add CLEAR_COLOR_RGB and CLEAR followed by a swap.
0 -
Thanks for your response.
Here the code of write_spi_pantalla (the SPI is configured MSB first)
void write_spi_pantalla(long registro, long dato, unsigned char num_bytes){
registro = registro | (1<<23); //bit 23 at 1 for write operation
port_pin_set_output_level(PIN_PA08, false);//pin nCS at 0V
for(int i=3;i>0;i--){//MSB
while(!SERCOM1->SPI.INTFLAG.bit.DRE);//wait until data register is empty
SERCOM1->SPI.DATA.reg = (char)(registro>>((i-1)*8));//send (registro>>((i-1)*8)) through SPI
while(!SERCOM1->SPI.INTFLAG.bit.TXC);//wait until data is transmitted
}
for(int i=0;i<num_bytes;i++){
while(!SERCOM1->SPI.INTFLAG.bit.DRE);//wait until data register is empty
SERCOM1->SPI.DATA.reg = (char)(dato>>(i*8));//send (dato>>(i*8) through SPI
while(!SERCOM1->SPI.INTFLAG.bit.TXC);//wait until data is transmitted
}
port_pin_set_output_level(PIN_PA08, true);//pin nCS at 3.3V
}Excuse me, I am not sure if I have well understood your suggestion, the following lines is that I have understood and tested without success:
write_spi_pantalla(REG_HCYCLE, 928, 2);waitx(100);
write_spi_pantalla(REG_HOFFSET, 88, 2);waitx(100);
write_spi_pantalla(REG_HSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_HSYNC1, 48, 2);waitx(100);
write_spi_pantalla(REG_VCYCLE, 525, 2);waitx(100);
write_spi_pantalla(REG_VOFFSET, 32, 2);waitx(100);
write_spi_pantalla(REG_VSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_VSYNC1, 3, 2);waitx(100);
write_spi_pantalla(REG_SWIZZLE, 0, 1);waitx(100);
write_spi_pantalla(REG_PCLK_POL, 0, 1);waitx(100);
write_spi_pantalla(REG_CSPREAD, 0, 1);waitx(100);
write_spi_pantalla(REG_HSIZE, 800, 1);waitx(100);
write_spi_pantalla(REG_VSIZE, 480, 1);waitx(100);
write_spi_pantalla(REG_DITHER, 1, 1); waitx(100);
write_spi_pantalla(REG_PWM_HZ, 1000, 2);waitx(100);
write_spi_pantalla(REG_PWM_DUTY, 40, 1);waitx(100);
//primer display list
write_spi_pantalla(RAM_DL+0, END(), 4);waitx(100);
write_spi_pantalla(RAM_DL+4, CLEAR_COLOR_RGB(0, 0, 252), 4);waitx(100);
write_spi_pantalla(RAM_DL+8, CLEAR(1, 1, 1), 4);waitx(100);
write_spi_pantalla(REG_DLSWAP, DLSWAP_FRAME, 1);waitx(100);
write_spi_pantalla(REG_GPIO_DIR, 0x80 , 1); waitx(100);
write_spi_pantalla(REG_GPIO, 0x80 | 0x3, 1); waitx(100);
write_spi_pantalla(REG_PCLK, 2, 1);Have a nice day! :)
0 -
Hi Rafael,
Sorry for the confusion, could you please refer to page 16 and 17 on the BT81X Series Programming Guide? The section is Initialization Sequence during Boot Up.
Please let us know if it works.
0 -
Hello :)
I had followed the guide you recomend me
write_spi_pantalla_host_command(0x440000,3);waitx(100);//CLKEXT
write_spi_pantalla_host_command(0x611400,3);waitx(100);//CLKSEL
write_spi_pantalla_host_command(0,3);waitx(100);//Host command ACTIVE
waitx(2000);
while(dato!=0x7C){
waitx(100);
dato = read_spi_pantalla(REG_ID,1);
uart_printf("dato = %x ", dato);}
while(dato!=0){
waitx(100);
dato = read_spi_pantalla(REG_CPURESET,1);
uart_printf("CPU = %x ", dato);}
waitx(2000);
write_spi_pantalla(REG_FREQUENCY, 0x03938700, 4);waitx(100);//60MHz
write_spi_pantalla(REG_HCYCLE, 928, 2);waitx(100);
write_spi_pantalla(REG_HOFFSET, 88, 2);waitx(100);
write_spi_pantalla(REG_HSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_HSYNC1, 48, 2);waitx(100);
write_spi_pantalla(REG_VCYCLE, 525, 2);waitx(100);
write_spi_pantalla(REG_VOFFSET, 32, 2);waitx(100);
write_spi_pantalla(REG_VSYNC0, 0, 2);waitx(100);
write_spi_pantalla(REG_VSYNC1, 3, 2);waitx(100);
write_spi_pantalla(REG_SWIZZLE, 0, 1);waitx(100);
write_spi_pantalla(REG_PCLK_POL, 0, 1);waitx(100);
write_spi_pantalla(REG_CSPREAD, 0, 1);waitx(100);
write_spi_pantalla(REG_HSIZE, 800, 1);waitx(100);
write_spi_pantalla(REG_VSIZE, 480, 1);waitx(100);
write_spi_pantalla(RAM_DL+0, CLEAR_COLOR_RGB(0, 0, 0), 4);waitx(100);
write_spi_pantalla(RAM_DL+4, CLEAR(1, 1, 1), 4);waitx(100);
write_spi_pantalla(RAM_DL+8, DISPLAY(), 4);waitx(100);
write_spi_pantalla(REG_DLSWAP, DLSWAP_FRAME, 1);waitx(100);
write_spi_pantalla(REG_GPIO_DIR, 0xFFFF , 2); waitx(100);
write_spi_pantalla(REG_GPIO,0xFFFF, 2); waitx(100);
write_spi_pantalla(REG_PCLK, 2, 1);In host comand CLKSEL I have choosed the value 0x61 14 00, the first byte 0x61 is for CLKSEL, the second byte, according to the datasheet, is for selecting the clock frequency. 0x14 corresponds a 60MHz with an external oscilator of 12MHz, is that correct? In the other hand, in the datasheet for CLKSEL the first byte can be 0x61 or 0x62... I have tested both with the same result... is that correct?
I can observe that changing the value of CLEAR_COLOR_RGB(0, 0, 0) to another color, there are a change in the color... but the screen apears like in the first photo I had sent.
Also, it is posible to observe in the screen an horizontal line, wich scrolls from top to bottom like a refresh line. This effect appears from the beginin. I specify this because it is not possible to apreciate it in the photo and may be it can reveal something...
Thank you, hava a nice day
0 -
Hi Rafael,
As you mentioned the first byte should be 0x61, the second byte is for selecting the clock frequency. Setting to 0x14 with an oscillator of 12MHz will result in a 12MHz x 4 = 48MHz. If you wanted 60MHz, it would be 0x15 (12MHz x 5 = 60MHz). You should be able to comment the following section to default to 60MHz.
write_spi_pantalla_host_command(0x611400,3);waitx(100);//CLKSEL
The scrolling horizontal line is due to the display not being properly programed. There might be another issue within the software. Please take a look at the Gameduino Library we have in our GitHub page. You should be able to see the code to help you develop your program.
0 -
Ok, thank you. I will take a look at the recomended library.
Hava a nice day :)
0
Please sign in to leave a comment.
Comments
6 comments