Cancelling DMAR in progress

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Cancelling DMAR in progress

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Cancelling DMAR in progress

Post 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
andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Re: Cancelling DMAR in progress

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Cancelling DMAR in progress

Post by Giovanni »

Try disabling, worst case you can reset it using RCC macros.

Giovanni
andypiper
Posts: 65
Joined: Sat Oct 24, 2020 5:21 pm
Has thanked: 5 times
Been thanked: 4 times

Re: Cancelling DMAR in progress

Post 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.
Post Reply