I succeeded in togling the GPIO0 in asm_thumb assembler using the following code in mictopython. It appears that compared to the RP2040, an additionnal step of removing the pad isolation is necessary.
The following code shows the registers I had to set specificaly
The following code shows the registers I had to set specificaly
Code:
GPIO_BASE = const(0x40014000)GPIO0_CTRL = const(0x40028004)GPIO_OE = const(0xd0000030)GPIO_OUT = const(0xd0000010)PADS_BANK0_BASE = const(0x40038000)@micropython.asm_thumbdef gpio0_set_output(): # function to set the GPIO0 pin as an GPIO standard output # Remove pad isolation movwt(r2,PADS_BANK0_BASE+0x3000) # Atomic clear adress for PADS_BANK0 base register (Datasheet 9.11.3) - Put address value in r2 movwt(r1, 1<<8)# Put Value 1<<8 in r1 to clear the isolation bit str(r1,[r2,0x04])# Store value in r2 -> this clears bit 8 of the GPIO0 PADS register (ISO: Pad isolation control) # set function SIO movwt(r2,GPIO0_CTRL)# GPIO0 CTRL REGISTER (Datasheet RP2350 9.11.1. IO - User Bank) - Put address value in r2 mov(r1, 0x05)# Function select 5 -> SIO str(r1,[r2,0])# Store value in r2 -> this sets the GPIO0 function to SIO # Enable GPIO output movwt(r2,GPIO_OE)# GPIO0 Output Enable REGISTER (Datasheet RP2350 9.8. Processor GPIO controls (SIO)) - Put address value in r2 mov(r1, 1)# Put Value 1 in r1 (GPIO0 is bit0) str(r1,[r2,0])# Store value in r2 -> this sets a 1 in the bit0 position of the register -> output @micropython.asm_thumb # function to toggle on and off GPIO0def gpio0_out(r0): # set GPIO to r0 value (1 for on, 0 for off) movwt(r1,GPIO_OUT)# GPIO Output REGISTER (Datasheet RP2350 9.8. Processor GPIO controls (SIO)) - Put address value in r1 str(r0,[r1,0]) # Store in r1 the value passed as argument (0 or 1) to clear or set pinStatistics: Posted by Hughmaingauche — Fri Aug 22, 2025 10:51 pm