Skip to content

Looking for help with PIO (no output on pins) #843

Answered by XFer012
XFer012 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, solved.

First of all, working example for future reference.

squarewave1.pio

; square wave

.program squarewave1

set pindirs, 1


.wrap_target
	set pins, 1
	set pins, 0
.wrap	

% c-sdk {
static inline void squarewave1_program_init(PIO pio, uint sm, uint offset, uint pin) 
{
    pio_sm_config c = squarewave1_program_get_default_config(offset);

    // Map the state machine's SET pin group to one pin, namely the `pin`
    // parameter to this function.
    sm_config_set_set_pins(&c, pin, 1);
	// Set the SM clock, by dividing the cpu clock
    sm_config_set_clkdiv(&c, SM_CLOCK_DIVISOR);
    // Set this pin's GPIO function (connect PIO to the pad)
    pio_gpio_init(pio, pin);
    // Set t…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@XFer012
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by XFer012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants