Page 1 of 1

Cancelling DMAR in progress

Posted: Wed Mar 10, 2021 10:22 pm
by andypiper
I have a strange problem. I am trying to prematurely end a dshot pulse driven by DMAR because its allowed timeslot has expired. All works well unless I actually try and cancel while the DMAR burst is in progress. If I do this the burst inexplicably just continues - so instead of stopping it goes on forever.

I am cancelling using dmaStreamDisable() - is there a safer way to achieve what I want that might actually stop the pulse?

I would post a picture of the Saleae trace, but difficult with this forum tech.

Re: Cancelling DMAR in progress

Posted: Thu Mar 11, 2021 5:58 am
by Giovanni
I never used that feature, is it the DMA "going on forever" or is the timer stuck?

Check if the DMA stream is actually stopped.

Giovanni

Re: Cancelling DMAR in progress

Posted: Thu Mar 11, 2021 6:25 pm
by andypiper
Giovanni wrote:I never used that feature, is it the DMA "going on forever" or is the timer stuck?

Check if the DMA stream is actually stopped.

Giovanni


Thanks Giovanni, well dmaStreamDisable() doesn't return until the EN bit is 0 - so seems like it must be stopped, maybe its that the timer is stuck - what's the best way to unstick it? Disable the timer?

Re: Cancelling DMAR in progress

Posted: Thu Mar 11, 2021 7:01 pm
by Giovanni
Try disabling, worst case you can reset it using RCC macros.

Giovanni

Re: Cancelling DMAR in progress

Posted: Fri Mar 12, 2021 6:32 pm
by andypiper
Giovanni wrote:Try disabling, worst case you can reset it using RCC macros.

Giovanni


A friend pointed out that DMAR uses a final 0 in the DMA buffer to reset the timer, if it doesn't see this it continues for ever. Simply resetting the CCR registers in the timer fixes this.