-
Notifications
You must be signed in to change notification settings - Fork 72
Description
All I want to do is stream data without gaps but it doesn't seem possible on RP1 pio.
I set a large buffer:
#define BUF_SIZE 32768
uint8_t databuf[BUF_SIZE];
pio_sm_config_xfer(pio, sm, PIO_DIR_TO_SM, BUF_SIZE, 1);
while (1) {
pio_sm_xfer_data(pio, sm, PIO_DIR_TO_SM, sizeof(databuf), databuf);
sleep_ms(1); //simulate some calculation here
}
This works fine but the sleep_ms(1) inserts 1ms delay even though packet is 42ms long.
Doing:
while (1) {
pio_sm_xfer_data(pio, sm, PIO_DIR_TO_SM, sizeof(databuf), databuf);
}
In attempts to do continous data out, adds random blips of 100us and up to 5ms spacing.
Is there anyway around this eg automatic ring buffer or ping pong buffer? I don't understand what the last argument in pio_sm_config_xfer(pio, sm, PIO_DIR_TO_SM, BUF_SIZE, 1); does: different values doesn't seem to do anything -> any clues?