-
Notifications
You must be signed in to change notification settings - Fork 244
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
DMA Descriptors Lists are reused with dma_descriptors_impl!
#2993
Comments
I don't know if we should count this as a bug in the code, but maybe in the documentation. You are not really supposed to call that macro in a loop - it's a convenience solution for less special use cases. You should probably create one big list of descriptors and manually sort them out into chunks with the size you need, in your loop. |
Fair enough, I don't think there is any documentation/examples on using DMA buffer/descriptors without hitting this macro; so multiple calls to For now I'll try creating them manually to resolve my current roadblock. |
You should be able to use the macro multiple times, but the way let (rx_descriptors, tx_descriptors) = esp_hal::dma_descriptors!(RX_SIZE, TX_SIZE);
let (other_rx_desc, other_tx_desc) = esp_hal::dma_descriptors!(RX_SIZE, TX_SIZE);
// These are not the same set of descriptors
core::assert_ne!(other_rx_desc.as_ptr(), rx_descriptors.as_ptr());
core::assert_ne!(other_tx_desc.as_ptr(), tx_descriptors.as_ptr()); |
As the macro is doing |
Ah I see, yeah I was confused with how the macros resolve, that does make sense then. It would be nice if it's more natural to use. const-generics + 'mkstatic' do seem like a potential solution, haven't gotten to fixing my example so maybe I'll do a proposal to add to examples. |
Bug description
It seems like
dma_descriptors_impl!
re-uses the sameDESCRIPTORS
reference (esp-hal/esp-hal/src/dma/mod.rs
Line 703 in 2105ba0
It could be that this is intended but I don't see an obvious way to get to multiple descriptor lists.
To Reproduce
Initialize an array of descriptors like so
And observe that the log shows the same pointer for each descriptor:
Expected behavior
Each call to
dma_descriptors_chunk_size
makes a new descriptor list.Environment
The text was updated successfully, but these errors were encountered: