pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

For sufficiently large cyw43 PIO SPI transfers, sleep via async_context before entering busy wait.

Open esky-software opened this issue 11 months ago • 2 comments

Fixes #2343

The function cyw43_spi_transfer() busy waits on the transfer DMA channel(s), even for large transfers. This is far from optimal in an RTOS or other asynchronous environment.

We might use DMA interrupts to handle the completion of the transfer, but this would require some restructuring of the driver code.

More simply, we can estimate the duration of the transfer, and if it's larger than a threshold call cyw43_delay_us() to sleep via the async context before starting the busy wait for the end of the transfer.

Define CYW43_PIO_SLEEP_MIN_US as the threshold duration (microseconds) to enable the feature.

esky-software avatar Mar 10 '25 17:03 esky-software

Not sure why this shows as 'esky software dismissed peterharperuk's stale review...' with my update. Did I do something wrongly?

esky-software avatar May 30 '25 10:05 esky-software

It's a mystery - don't worry about it.

peterharperuk avatar May 30 '25 10:05 peterharperuk