Skip to content

Inverted serial signaling with SerialPIO? #1443

Answered by earlephilhower
myklemykle asked this question in Q&A
Discussion options

You must be logged in to vote

Looking at the datasheet, there doesn't seem to be an invert this pin bit, so I do believe for inverted output you'd need to hack SerialPIO.

That said, if you just need to invert output then I think it's almost trivial. Not tested, but you'd invert the data bits before writing to the FIFO here:

pio_sm_put_blocking(_txPIO, _txSM, val);

becomes

pio_sm_put_blocking(_txPIO, _txSM, ~val);

And then in the PIO program you'd need to set the idle bit to low:

pull side 1 ; Force stop bit

becomes

pull               side 0 ; Force stop bit

You'd n…

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
12 replies
@earlephilhower
Comment options

@myklemykle
Comment options

@earlephilhower
Comment options

@myklemykle
Comment options

@earlephilhower
Comment options

Answer selected by myklemykle
Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants