Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example of using using DMA with PIO #468

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

peterharperuk
Copy link
Contributor

Fixes #467

README.md Outdated Show resolved Hide resolved

// Allocates a pio and statemachine and loads the pio program into memory
// Return true on success
static bool pio_init(const pio_program_t *program, PIO *pio_hw, uint *sm, uint *offset) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See discussion on naming

}
}
// Find a state machine
*sm = (int8_t)pio_claim_unused_sm(*pio_hw, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be possible to add a program but there are no sm's free?

// write to the pio fifo
int count_pio_tx = 0;
while(count_pio_tx < sizeof(buffer_tx) - 1) {
uart_tx_program_putc(pio_hw_tx, pio_sm_tx, buffer_tx[count_pio_tx++]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the following uart_puts will overflow the fifo if dma is not enabled, need to read and write one character at a time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants