Introduction to K210-bare metal development (7) 1.14TFT screen of LCD display

Development board: K210 AIRV R3 version widora

Development environment: kendryte IDE official

Required reference documents: Standalone SDK Programming Guide v0.5.0, and Widora schematic

(1) Create a new folder 07my_code_114tft

Earth+Gift No tft screen or OLED screen is found, try this screen to see if it can be driven

Installation dependencies

Clean + build

Environment ready

(2) Code modification

1.14 TFT display principle diagram

RESETN is connected to the reset button, don’t worry

LCD_DC -> IO38

SPI0_D0 -> SPI0_D0

LCD_WR ->IO39

LCD_CS2-> IO37

If SPI0_D0 -> SPI0_D0 is used, change it to 0 first (this was wrong, and the error was discovered later. I looked for the problem for a long time)

Look at lcd_init();

See what gourd is in tft_hard_init()

init_dcx()

See that the IO port called DCX is configured with a value of 2

See if there is any configuration

LCD_DC -> IO38

Look at which ones

RESETN is connected to the reset button, don’t worry

LCD_DC -> IO38

SPI0_D0 -> SPI0_D0

LCD_WR ->IO39

LCD_CS2-> IO37

LCD_WR corresponds to SCL, LCD_CS2 corresponds to CS

Select on SPI0, save

First compile and download to see if it shows

No wool, continue to change

SYSCTL_POWER_BANK1改为SYSCTL_POWER_BANK6

Try burning again

Still the wool did not respond, continue to change

Change from 8 wires to standard 3 wires

Other things should be changed 

Downloading and burning, there is still no response

 

(6) Keep looking for problems

This is changed to 1, which is wrong before, 0 is disable, 1 is enable, it is necessary to start spi0

Burning finally shows that it is really difficult

 

PS 

By modifying this, adjust the canvas direction

 

I adjusted it normally here, you can directly refer to my code and learn to modify

The camera is exposed, and it is also exposed when shooting with a mobile phone.

1.14 LCD screen finished learning, see you next time

Dog B CSDN has no upload attachment function

Link: https://pan.baidu.com/s/1jyM48Jd1bFQWudVBybI97w 
Extraction code: nynu

 

main.c code

#include <fpioa.h>
#include <lcd.h>
#include <sleep.h>
#include <stdio.h>
#include <sysctl.h>

#include "icon_generate.h"

uint32_t g_lcd_gram[LCD_X_MAX * LCD_Y_MAX / 2] __attribute__((aligned(128)));

static void io_set_power(void) {
  sysctl_set_power_mode(SYSCTL_POWER_BANK6, SYSCTL_POWER_V18);
}

static void io_mux_init(void) { sysctl_set_spi0_dvp_data(1); }

int main(void) {
  printf("lcd test\n");

  io_mux_init();
  io_set_power();

  lcd_init();
  lcd_clear(RED);
  msleep(500);
  lcd_clear(GREEN);
  msleep(500);
  lcd_clear(BLUE);
  msleep(500);
  lcd_clear(WHITE);

  lcd_set_direction(DIR_XY_RLUD);
  lcd_draw_picture(0, 0, 240, 160, g_lcd_gram);
  lcd_draw_string(120, 40, "Canaan", CYAN);
  lcd_draw_picture((240 - IMAGE_HEIGHT) / 2, (320 - IMAGE_WIDTH) / 2,
                   IMAGE_HEIGHT, IMAGE_WIDTH, rgb_image);

  lcd_set_direction(DIR_XY_RLUD);
  lcd_draw_string(60, 240, "Kendryte K210", ORANGE);
  lcd_draw_string(100, 100, "A", ORANGE);
  lcd_draw_string(100, 90, "B", ORANGE);
  lcd_draw_string(90, 100, "C", ORANGE);
  lcd_draw_string(90, 90, "D", ORANGE);

  while (1)
    ;
}

 

Guess you like

Origin blog.csdn.net/jwdeng1995/article/details/108036166
Recommended