You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I successfully created this project and wanted to use this Pico - VGA hardware configuration (because the VGA cable is soldered to my Pico W) for another project (Pong game). I tried to code this in MicroPython but could't get a VGA output. So I started to create a test file at first which looks like this - but still no signal on the screen. This code compiles without problems in Thonny and was saved to the Pico W as main.py so that it should run on boot. Could you please tell me what I'm doing wrong?
No idea! But it looks like you're doing timing-sensitive stuff in Python -- I'd be impressed if it was anywhere near fast/predictable enough to do that. Even though C, it would be less frustrating to try this experiment in C I think... Good luck.
Hello,
I successfully created this project and wanted to use this Pico - VGA hardware configuration (because the VGA cable is soldered to my Pico W) for another project (Pong game). I tried to code this in MicroPython but could't get a VGA output. So I started to create a test file at first which looks like this - but still no signal on the screen. This code compiles without problems in Thonny and was saved to the Pico W as main.py so that it should run on boot. Could you please tell me what I'm doing wrong?
`from machine import Pin
import rp2
import time
VGA timing constants for 640x480@60Hz
H_ACTIVE = 640
H_FRONT_PORCH = 16
H_SYNC = 96
H_BACK_PORCH = 48
V_ACTIVE = 480
V_FRONT_PORCH = 10
V_SYNC = 2
V_BACK_PORCH = 33
@rp2.asm_pio(
out_init=rp2.PIO.OUT_LOW,
sideset_init=(rp2.PIO.OUT_HIGH,) * 2,
autopull=True,
pull_thresh=32,
fifo_join=rp2.PIO.JOIN_TX
)
def vga_program():
# Active video area
pull(block) .side(0b11)
out(x, 32) .side(0b11)
pull(block) .side(0b11)
Create a simple test pattern (white screen)
line_words = H_ACTIVE // 32
test_line = [0xFFFFFFFF] * line_words
Initialize pins
video_pin = Pin(18, Pin.OUT) # GPIO18 -> Physical Pin 24
vsync_pin = Pin(19, Pin.OUT) # GPIO19 -> Physical Pin 25
hsync_pin = Pin(21, Pin.OUT) # GPIO21 -> Physical Pin 27
Initialize state machine
sm = rp2.StateMachine(
0,
vga_program,
freq=125_000_000, # Run at maximum frequency
sideset_base=Pin(19),
out_base=Pin(18),
set_base=Pin(21)
)
print("Starting VGA output...")
sm.active(1)
Main loop with VSYNC handling
vsync_counter = 0
try:
while True:
# Output one complete frame
for line in range(V_ACTIVE):
# Send line data
for word in test_line:
sm.put(word)
except KeyboardInterrupt:
sm.active(0)
print("Stopped")`
The text was updated successfully, but these errors were encountered: