Cancelling DMAR in progress

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

Moderators: RoccoMarco, barthess

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

Cancelling DMAR in progress

Postby andypiper » Wed Mar 10, 2021 10:22 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Cancelling DMAR in progress

Postby Giovanni » Thu Mar 11, 2021 5:58 am

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

Postby andypiper » Thu Mar 11, 2021 6:25 pm

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Cancelling DMAR in progress

Postby Giovanni » Thu Mar 11, 2021 7:01 pm

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

Postby andypiper » Fri Mar 12, 2021 6:32 pm

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.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 16 guests