-
Notifications
You must be signed in to change notification settings - Fork 846
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
base: develop
Are you sure you want to change the base?
Conversation
988bccc
to
47053b4
Compare
47053b4
to
9232a3a
Compare
9232a3a
to
3fd5556
Compare
3fd5556
to
77461c7
Compare
pio/uart_pio_dma/uart_pio_dma.c
Outdated
|
||
// 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion on naming
pio/uart_pio_dma/uart_pio_dma.c
Outdated
} | ||
} | ||
// Find a state machine | ||
*sm = (int8_t)pio_claim_unused_sm(*pio_hw, false); |
There was a problem hiding this comment.
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++]); |
There was a problem hiding this comment.
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?
77461c7
to
67e3171
Compare
|
||
// Allocates a pio and statemachine and loads the pio program into memory | ||
// Return true on success | ||
static bool pio_claim_free_sm_add_program(const pio_program_t *program, PIO *pio_hw, uint *sm, uint *offset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this can use the new PIO functions
Fixes #467