This is the screen for the VerilogBoy handheld, with MIPI DSI interface.
Basic Information
- Model: AML-B16C15012Q
- Type: RGB IPS TFT-LCD
- Mode: Normal Black
- Resolution: 320x320
- Greyscale: Up to 8bpc interface, 6bpc VRAM, 6bpc output
- Controller: ST7796S
- Size: 1.54"
- Interface: MIPI 1-lane
- Backlight: 1S3P, VF=3.2V
Pinout
- LEDA
- LEDK
- VCC 2.8
- RESET
- NC
- NC
- NC
- VCCIO 1.8
- GND
- DATA0_P
- TE
- DATA0_N
- NC
- GND
- GND
- CLK_P
- NC
- CLK_N
- NC
- GND
Note
- Maximum clock 500MHz, minimum 80MHz
- In DS, LP requires period of each state being 35-75ns, 100ns works in practice
- 0x2C doesn't work under LPDT, 0x3C works (only for long packets)
Initialization
Delay_ms(120); GP_COMMAD_PA(2); SPI_WriteData(0x36); // Memory data access control SPI_WriteData(0x48); // Reverse X, BGR GP_COMMAD_PA(2); SPI_WriteData(0x3A); // Interface pixel format SPI_WriteData(0x77); // 16.7M Color (not defined in DS???) GP_COMMAD_PA(2); SPI_WriteData(0xF0); // Command Set Control SPI_WriteData(0xC3); // Enable Command 2 Part I GP_COMMAD_PA(2); SPI_WriteData(0xF0); // Command Set Control SPI_WriteData(0x96); // Enable Command 2 Part II GP_COMMAD_PA(3); SPI_WriteData(0xB1); // Frame Rate Control SPI_WriteData(0xA0); // FRS = 10 DIVA = 0 RTNA = 32 SPI_WriteData(0x10); // FR = 10^7 / ((168+RTNA+32x(15-FRS))(320+VFP+VBP)) GP_COMMAD_PA(2); SPI_WriteData(0xB4); // Display Inversion Control SPI_WriteData(0x00); // 00: Column INV, 01: 1-Dot INV, 10: 2-Dot INV GP_COMMAD_PA(5); SPI_WriteData(0xB5); // Blacking Porch Control SPI_WriteData(0x40); // VFP = 64 SPI_WriteData(0x40); // VBP = 64 SPI_WriteData(0x00); // Reserved SPI_WriteData(0x04); // HBP = 4 GP_COMMAD_PA(4); SPI_WriteData(0xB6); // Display Function Control SPI_WriteData(0x8A); // Bypass RAM, DE mode SPI_WriteData(0x07); // Non inverting SPI_WriteData(0x27); // 8*(0x27+1) = 320 lines GP_COMMAD_PA(2); SPI_WriteData(0xB9); // There is no B9 in datasheet SPI_WriteData(0x02); GP_COMMAD_PA(2); SPI_WriteData(0xC5); // VCOM Control SPI_WriteData(0x2E); // 1.450V GP_COMMAD_PA(9); SPI_WriteData(0xE8); // Display Output SPI_WriteData(0x40); SPI_WriteData(0x8A); SPI_WriteData(0x00); SPI_WriteData(0x00); SPI_WriteData(0x29); SPI_WriteData(0x19); SPI_WriteData(0xA5); SPI_WriteData(0x93); GP_COMMAD_PA(15); SPI_WriteData(0xe0); // Positive Gamma Control SPI_WriteData(0xf0); SPI_WriteData(0x07); SPI_WriteData(0x0e); SPI_WriteData(0x0a); SPI_WriteData(0x08); SPI_WriteData(0x25); SPI_WriteData(0x38); SPI_WriteData(0x43); SPI_WriteData(0x51); SPI_WriteData(0x38); SPI_WriteData(0x14); SPI_WriteData(0x12); SPI_WriteData(0x32); SPI_WriteData(0x3f); GP_COMMAD_PA(15); SPI_WriteData(0xe1); // Negative Gamma Control SPI_WriteData(0xf0); SPI_WriteData(0x08); SPI_WriteData(0x0d); SPI_WriteData(0x09); SPI_WriteData(0x09); SPI_WriteData(0x26); SPI_WriteData(0x39); SPI_WriteData(0x45); SPI_WriteData(0x52); SPI_WriteData(0x07); SPI_WriteData(0x13); SPI_WriteData(0x16); SPI_WriteData(0x32); SPI_WriteData(0x3f); GP_COMMAD_PA(2); SPI_WriteData(0xF0); // Command Set Control SPI_WriteData(0x3C); // Disable Command 2 Part I GP_COMMAD_PA(2); SPI_WriteData(0xF0); // Command Set Control SPI_WriteData(0x69); // Disable Command 2 Part II GP_COMMAD_PA(1), SPI_WriteData(0x11); // Sleep Out Delay_ms(120); GP_COMMAD_PA(1), SPI_WriteData(0x29); // Display ON Delay_ms(50); GP_COMMAD_PA(1); SPI_WriteData(0x21); // Display Inversion ON GP_COMMAD_PA(5); SPI_WriteData(0x2A); // Column Address Set SPI_WriteData(0x00); SPI_WriteData(0x00); SPI_WriteData(0x01); SPI_WriteData(0x3F); GP_COMMAD_PA(5); SPI_WriteData(0x2B); // Row Address Set SPI_WriteData(0x00); SPI_WriteData(0x00); SPI_WriteData(0x01); SPI_WriteData(0x3F);