Fix incorrect mapping of DMA channel to DMAMUX channel #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying to use the DMA2 peripheral on an STM32G474 I noticed that my buffer did not seem to get written to by the DMA. After some investigation I think I found the issue. From what I can this dma driver does not use the correct mapping from DMA channel to DMAMUX channel for DMA2.
According to RM0440 under "DMAMUX mapping":
For category 3 and category 4 devices:
For category 2 devices:
The fix in this PR is quite an ugly hack but it does try to keep the API as unchanged as possible.
It only fixes the problem on cat 3 and 4 devices for now(all but G431 and G441).I get the feeling that the driver as written today works on the (wrong) assumption that every DMA has its own DMAMUX, hence the
fn mux_ptr()
inInstance
. However when implementing theInstance
for DMA1 and DMA2 they both use the same one and only DMAMUX.Therefore i suppose it would make sense to completely remove the
fn mux_ptr()
from the trait and find some better way than to use myconst IS_DMA1: bool
.I am open to suggestions :)