Skip to content

Conversation

@jflyper
Copy link
Contributor

@jflyper jflyper commented Jan 15, 2020

Fixes #9344

EDIT
This bug probably needs some explanation.
As H7's DMA buffer coherency management is done with MPU regions, it is necessary to attribute DMA buffer as appropriate. When I've done this, I somehow came to believe that drivers/adc.c should be free from DMA details and decided NOT to attribute adcValues as DMA buffers, and transposing be done in H7 specific code (hence the current implementation of adcGetChannelValues() that transpose elements). The actual transposing is done in adcGetChannel() in drivers/adc.c, which resulted in extra transposing. This PR removes the extra transposing in adcGetChannelValues() and just do a active element transfer, but a better solution may be to attribute adcValues as DMA buffer and remove adcGetChannelValues() woes (which actually is inefficient as it is called for each separate value is requested by adcGetChannel()).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this if final then the conditional should be removed.

Copy link
Contributor Author

@jflyper jflyper Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh! It's a test config. Will remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mikeller mikeller modified the milestones: 4.2, 4.1.3 Jan 15, 2020
@jflyper jflyper force-pushed the bfdev-h7-fix-adc-dma-buffer-transposing-bug branch from 15cf52d to 456f5a9 Compare January 16, 2020 04:48
@mikeller mikeller merged commit 0dafd2f into betaflight:master Jan 16, 2020
mikeller added a commit that referenced this pull request Jan 16, 2020
[H7] Fix ADC DMA buffer transposing bug
@hydra
Copy link
Contributor

hydra commented Jan 16, 2020

Great, thanks @jflyper and @mikeller for confirmation, PR, review and merge.

@jflyper jflyper deleted the bfdev-h7-fix-adc-dma-buffer-transposing-bug branch January 17, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADC transposed values bug.

3 participants