I’m connect Adafruit TFT lcd touchscreen(HX8357D) in spi mode and my TFT connect with Jetson NX Module (16GB) but display is not working… my display is getting white colour blank screen only…
My tft connection with jetson xavier nx
TFT PIN XAVIER NX PIN
MOSI ---------- MOSI
MISO ---------- MISO
CS ---------- SPI1_CS0
D/C ---------- SPI3_CS0
CLK --------- SPI1_SCK
Program:-
import digitalio
import board
from PIL import Image, ImageDraw
import adafruit_rgb_display.hx8357 as hx8357 # pylint: disable=unused-import
Configuration for CS and DC pins (these are PiTFT defaults):
cs_pin = digitalio.DigitalInOut(board.D24)
dc_pin = digitalio.DigitalInOut(board.D18)
reset_pin = digitalio.DigitalInOut(board.D22)
Config for display baudrate (default max is 24mhz):
BAUDRATE = 24000000
Setup SPI bus using hardware SPI:
spi = board.SPI()
pylint: disable=line-too-long
Create the display:
#disp = hx8357.HX8357(spi, rotation=180, # 3.5" HX8357
cs=cs_pin, dc=dc_pin, rst=reset_pin, baudrate=BAUDRATE)
pylint: enable=line-too-long
Create blank image for drawing.
Make sure to create image with mode ‘RGB’ for full color.
if disp.rotation % 180 == 90:
height = disp.width # we swap height/width to rotate it to landscape!
width = disp.height
else:
width = disp.width # we swap height/width to rotate it to landscape!
height = disp.height
image = Image.new(‘RGB’, (width, height))
Get drawing object to draw on image.
draw = ImageDraw.Draw(image)
Draw a black filled box to clear the image.
draw.rectangle((0, 0, width, height), outline=0, fill=(0, 0, 0))
disp.image(image)
image = Image.open(“shark.jpg”)
Scale the image to the smaller screen dimension
image_ratio = image.width / image.height
screen_ratio = width / height
if screen_ratio < image_ratio:
scaled_width = image.width * height // image.height
scaled_height = height
else:
scaled_width = width
scaled_height = image.height * width // image.width
image = image.resize((scaled_width, scaled_height), Image.BICUBIC)
Crop and center the image
x = scaled_width // 2 - width // 2
y = scaled_height // 2 - height // 2
image = image.crop((x, y, x + width, y + height))
Display image.
disp.image(image)