Ok, I finally got it to work st least sometimes. More often then not, even with the same code (I just powercycle the board) I don't get a signal on the PIO outputs. And the one I get sometimes looks like this:
![Image]()
The code for the PIOs btw, looks like this:The split between the nops was to test, if a line of code gets jumped over and results in the spike in the signal and not the square wave. At least I got it to work, maybe I will figure out how to create a squared wave at one point. But currently I'm out of ideas what I do wrong. Maybe I should turn off any other clock in the RP2350 so the pll gets only used by sys_clk and the PIOs?
For completion, this is the code I use to configure the clock in the beginning of my code:and in the main loop, the code looks like this:

The code for the PIOs btw, looks like this:
Code:
.program blink.wrap_target set pins, 1 ; Turn LED on nop[4] nop[15] set pins, 0 ; Turn LED off nop[19].wrap ; Blink forever!For completion, this is the code I use to configure the clock in the beginning of my code:
Code:
void configure_clock() { // Configure PLL system to 900 MHz vco and 75MHz clk_sys pll_hw_t *pll = pll_sys; uint refdiv = 1; uint vco_freq = 900; uint fbdiv = 75; uint postdiv1 = 6; uint postdiv2 = 2; printf("configure_clock_1\n"); // This reconfigure clk_sys to run from the PLL_USB // I do this, since I had problem using pll_init() later on if clk_sys is connected to pll_sys clock_configure(clk_sys, CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB, 48 * MHZ, 48 * MHZ ); printf("configure_clock_2\n"); // This was added while I was following the example from the sdk, // how to change the pll for the clk_sys. // It is just in here to be on the save side and have working connection to the chip clock_configure(clk_peri, 0, CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLK_SYS, 48 * MHZ, 48 * MHZ ); printf("2.5\n"); stdio_init_all(); // Deinits the pll_sys before turning it on again with the wanted config pll_deinit(pll_sys); printf("configure_clock_3\n"); // The * MHZ is needed! I tried it without it in different configuration and couldn't get it to work. // Even with the correct number calculated and used directly. // Anyway, this works at least for me and I guess I overlooked something in my other attempts. pll_init( pll_sys, // PLL to configure refdiv, // REFDIV 900 * MHZ, // FBDIV postdiv1, // PD1 postdiv2 // PD2 ); printf("configure_clock_4\n"); // Switch clk_sys back to use pll_sys clock_configure( clk_sys, CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, 75 * MHZ, // source freq (crystal) 75 * MHZ // target freq ); printf("configure_clock_5\n");}Code:
int main(){ stdio_init_all(); // For the connection to reestablish and setup sleep_ms(2000); // This is the setup for the GPIO LED int rc = pico_led_init(); hard_assert(rc == PICO_OK); // To visually check if the programm ist stared pico_set_led(true); // This starts the PIO code PIO pio = pio0; uint offset = pio_add_program(pio, &blink_program); printf("Loaded program at %d\n", offset); blink_pin_forever(pio, 0, offset, CLOCK_OUTPUT_PIN); sleep_ms(1000); // Setting the voltage to a range, where it should have no trouble running fast vreg_set_voltage(VREG_VOLTAGE_2_35); printf("Done setting voltage to %i\n", VREG_VOLTAGE_2_35); sleep_ms(1000); printf("pre_configure_clock\n"); // This calls the function posted above configure_clock(); // This is a blinking countdown, which increases in frequency once it gets closer to the divider change. // Just for a visual confirmation where the program is for(int i = 0; i < 240; i++){ pico_set_led(true); sleep_ms(1000); pico_set_led(false); sleep_ms(1000); } for(int i = 0; i < 600; i++){ pico_set_led(true); sleep_ms(100); pico_set_led(false); sleep_ms(100); } // This configures the dividers directly and forces clk_sys to the frequency of the pll_sys VCO set_sys_pll_deviders( 1, 1 ); while (true) { pico_set_led(true); sleep_ms(1000); printf("ping\n"); pico_set_led(false); sleep_ms(1000); }}Statistics: Posted by nithor — Thu Nov 27, 2025 11:07 am