#LetsDriveLCD [25] – AML-B16C15012Q

2018-11-22

/uploads/blog/2018/1543943583616-photo_2018-12-04_12-13-56.jpg

This is the screen for the VerilogBoy handheld, with MIPI DSI interface.

Basic Information

Pinout

  1. LEDA
  2. LEDK
  3. VCC 2.8
  4. RESET
  5. NC
  6. NC
  7. NC
  8. VCCIO 1.8
  9. GND
  10. DATA0_P
  11. TE
  12. DATA0_N
  13. NC
  14. GND
  15. GND
  16. CLK_P
  17. NC
  18. CLK_N
  19. NC
  20. GND

Note

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);