I'm using Micro python to try and generate an RGB signal for a TFT screen such as the: Screen
The timings i need the follow are:
CLKIN: 3.33Mhz
Horizontal is 800 clock cycles up and 1 clock cycle down
Vertical is 480 Horizontal Clock cycles up and
Ive already got this code that spits out the clock but i cant chnage the square function or add a second state machine, how would i go about bit bashing the pins at the required times.
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
import time
@asm_pio(set_init=PIO.OUT_LOW)
def square():
wrap_target()
set(pins, 1)
set(pins, 0)
wrap()
sm = rp2.StateMachine(0, square, freq=33300000, set_base=Pin(2))
sm.active(1)
Your frequency is 3.33mHz, but each cycle uses 2 cpu cycles so each rising edge is only at 1.665mHz.