PiTFT and Pico2040

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nevyn
 
Posts: 7
Joined: Sat Mar 27, 2021 1:28 pm

PiTFT and Pico2040

Post by nevyn »

Has anyone managed to get the PiTFT (HX8357) working with the Pico 2040 ?

I'm pretty sure I have the wiring correct as my logic analyser is showing data on the MOSI lines. I get what looks like good data when DC is low and what appears to be errors when DC is high.

I am confident that the display is working as it works fins on a Raspberry Pi Zero but I'm having issues with the Pico.

I would appreciate any guidance or pointer to working examples.

Thanks in advance,
Mark

Code is :

Code: Select all

import busio
import board
import digitalio
from adafruit_rgb_display import color565
import adafruit_rgb_display.hx8357 as hx8357

backlight = digitalio.DigitalInOut(board.GP13)
cs_pin = digitalio.DigitalInOut(board.GP17)
dc_pin = digitalio.DigitalInOut(board.GP12)
reset_pin = digitalio.DigitalInOut(board.GP11)

backlight.switch_to_output()
backlight.value = True

spi = busio.SPI(clock = board.GP18, MOSI = board.GP19, MISO = board.GP16)

display = hx8357.HX8357(spi, rotation=180, width=480, height=320, cs=cs_pin, dc=dc_pin)

display.fill(color565(0, 0, 0))

x_scale = 4096 // 480
y_scale = 4096 // 320
display.fill_rectangle(40, 70, 100, 80, color565(255, 0, 0))
display.fill_rectangle(300, 200, 80, 120, color565(0, 255, 0))
#
#   The line below stops the rectangles drawn being slowly overwritten.
#
display.fill_rectangle(0,0,1,1,color565(0,0,0))
while True:
    pass

User avatar
nevyn
 
Posts: 7
Joined: Sat Mar 27, 2021 1:28 pm

Re: PiTFT and Pico2040

Post by nevyn »

Updated the code to:

Code: Select all

import busio
import board
import digitalio
from adafruit_rgb_display import color565
import adafruit_rgb_display.hx8357 as hx8357

# Pi GPIO
# backlight = digitalio.DigitalInOut(board.D18)
# cs_pin = digitalio.DigitalInOut(board.CE0)
# dc_pin = digitalio.DigitalInOut(board.D25)
# reset_pin = digitalio.DigitalInOut(board.D23)
# spi = board.SPI()

# Pico GPIO
backlight = digitalio.DigitalInOut(board.GP13)
cs_pin = digitalio.DigitalInOut(board.GP17)
dc_pin = digitalio.DigitalInOut(board.GP12)
reset_pin = digitalio.DigitalInOut(board.GP11)
spi = busio.SPI(clock = board.GP18, MOSI = board.GP19, MISO = board.GP16)

backlight.switch_to_output()
backlight.value = True

# Config for display baudrate (default max is 24mhz):
BAUDRATE = 24000000

display = hx8357.HX8357(spi, rotation=180, width=480, height=320, cs=cs_pin, dc=dc_pin)

# Fill with black!
display.fill(color565(0, 0, 0))

display.fill_rectangle(40, 70, 100, 80, color565(255, 0, 0))
display.fill_rectangle(300, 200, 80, 120, color565(0, 255, 0))

while True:
    pass
This displays two rectangles on the Pi and nothing on the Pico.

Regards,
Mark

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”