-
Hello, I am taking my first steps in PIO territory. Using the online pioasm tool at https://wokwi.com/tools/pioasm , I tried to write a simple square wave generator, by setting GP15 on and off. My PIO source:
Assembled header, "squarewave_pio.h". I added the clock setting with pio_sm_set_clkdiv():
My .ino main program:
Unfortunately, I get nothing at pin 15. Am I missing something obvious? Thanks for looking! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'm going from memory, but I think you're setting a register value, not the actual outputs with You want something like
as your PIO program. Check the datasheet and SDK docs, they have good details on this. Also, FWIW, the Tone generator here should be perfectly capable of generating this frequency accurate to 1/133MHz.... |
Beta Was this translation helpful? Give feedback.
-
Ok, solved. First of all, working example for future reference. squarewave1.pio
Assembled header squarewave_pio.h:
Main .ino file:
Which mistakes I made:
Now everything works! Thanks @earlephilhower , great work on arduino-pico and very helpful in general. |
Beta Was this translation helpful? Give feedback.
Ok, solved.
First of all, working example for future reference.
squarewave1.pio