This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EDU BOOSTERPACK MKII - LCD DISPLAY ST7735

Other Parts Discussed in Thread: TM4C123GH6PM

Hello,

Im trying to use LCD display from edu boosterpack MKII. I have problem with display because i cant write even pixel. I analyze several different codes and then I make my code. MCU is tm4c123gh6pm, chip which control display is ST7735S and here is code, signals on oscilloscope are fine :

  void ST7735_Select(){
      GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, ~GPIO_PIN_5);
  }

void ST7735_UnSelect(){
    GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, GPIO_PIN_5);
}

void Write_Command(uint8_t c){
    while(SSIBusy(SSI2_BASE)){}
    SSIDataPut(SSI2_BASE, c);
    while(SSIBusy(SSI2_BASE)){}
}
void Write_Data(uint8_t c){
    while(SSIBusy(SSI2_BASE)){}
    SSIDataPut(SSI2_BASE, c | 0x100);
}

void static setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1){
    Write_Command(ST7735_CASET); // Column addr set
    Write_Data(0x00);
    Write_Data(x0);     // XSTART
    Write_Data(0x00);
    Write_Data(x1);     // XEND

    Write_Command(ST7735_RASET); // Row addr set
    Write_Data(0x00);
    Write_Data(y0);     // YSTART
    Write_Data(0x00);
    Write_Data(y1);     // YEND

    Write_Command(ST7735_RAMWR); // write to RAM
}

void static pushColor(uint16_t color) {
    Write_Data((uint8_t)(color >> 8));
    Write_Data((uint8_t)color);
}

void Init_ST7735S(void){
    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTF_BASE + GPIO_O_CR) = 0x1F;

    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
    GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_5);  // Chip select

    GPIOPinConfigure(GPIO_PB4_SSI2CLK);
    //GPIOPinConfigure(GPIO_PB5_SSI2FSS);
    GPIOPinConfigure(GPIO_PB6_SSI2RX);
    GPIOPinConfigure(GPIO_PB7_SSI2TX);

    GPIOPinTypeSSI(GPIO_PORTB_BASE, GPIO_PIN_4 | GPIO_PIN_6 | GPIO_PIN_7);

    SSIDisable(SSI2_BASE);
    SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 9);
    SSIEnable(SSI2_BASE);

    ST7735_UnSelect();
}

void main(void){
    SysCtlClockSet(SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ | SYSCTL_SYSDIV_4); // clock set 50MHz
    Init_ST7735S();
    while(1){

        ST7735_Select();
        Write_Command(ST7735_SWRESET); // software reset
        ST7735_UnSelect();
        SysCtlDelay(2000000); // 120mS
        ST7735_Select();
        Write_Command(ST7735_SLPOUT); // turn off sleep mode
        ST7735_UnSelect();
        SysCtlDelay(2000000); // 120mS
        ST7735_Select();
        Write_Command(ST7735_COLMOD); // color mode 16-bit/pixel
        Write_Data(0x05);
        Write_Command(ST7735_FRMCTR1); // 32.25kHz
        Write_Data(0x00);
        Write_Data(0x06);
        Write_Data(0x03);
        Write_Command(ST7735_MADCTL);  // BGR color fileter panel
        Write_Data(0x08);
        Write_Command(ST7735_INVCTR);  // no inversion
        Write_Data(0x00);

        setAddrWindow(5, 5, 50, 50);
        
        pushColor(0x4F31);
    
        Write_Command(ST7735_NORON);
        Write_Command(ST7735_DISPON);
        ST7735_UnSelect();
        SysCtlDelay(16666667);
}