Skip to main content
KKuma.4
Associate
August 13, 2020
Question

External Interrupt IRQ Handler with ADC DMA IRQ Handler

Hello everyone,

I'm trying to build a sensorless 6 step BDLC motor control. I'm using 3 external interrupts to detect rising and falling BEMF signals and 6 step commutation sequence and the motor works fine for different PWM values. Now I'm trying to add a potentiometer and use DMA IRQ handlerto control the PWM value and speed of the motor. Can anyone let me know if I can use DMA IRQ handler along with external interrupt handler. I have tried giving preemt priority 0 for exxternal interrupts and 1 for DMA IRQ. But it doesnt work as expected

This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
August 13, 2020

What STM32 specifically, there are hundreds of different ones

I would avoid doing anything blocking or (other) interrupt related programming within callback/interrupt context, almost certainly going to cause a headache. Watch specifically delays and timeouts. The callback/interrupts should leave promptly, don't be waiting/dwelling for things to happen.

Have you set the NVIC grouping to allow for preemption? It won't reenter at the current level.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
KKuma.4
KKuma.4Author
Associate
August 14, 2020

Hi clive,

I'm using STM32F103C8.

I'm using void EXTI3_IRQHandler(void), void EXTI1_IRQHandler(void), void EXTI2_IRQHandler(void) 3 IRQ handlers to identify A, B , C BEMF signals as interrupts and perform commutation sequence.

For the above 3 preemption is given highest priority. HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0). The motor works fine

Now I want to add ADC and enabled ADC global interrupt. I want to read the potentiometer value from ADC and map the same to Duty of the PWM.

Laurent Ca...
Senior III
October 6, 2020

Dear @KKuma.4​ 

Thanks for your answers to @Community member​  questions.

I hope it will help him to help you.

Best regards

Laurent Ca...

Laurent Ca...
Senior III
October 20, 2020

Dear @KKuma.4​ , dear @Community member​ 

Any news?

Best regards

Laurent Ca...

PBo
Visitor II
October 22, 2020

​@KKuma.4​ 

Hello,

FYI, we provide 6-step example using potentiometer through the STSPIN32xx board usage. Did you inspire from these examples ?

Best Regards,

Patrice

Laurent Ca...
Senior III
November 2, 2020

Dear @KKuma.4​ 

As you do not answer, I guess you don't have to solve this problem anymore, therefore I consider this thread closed.

If not, feel free to reopen it by posting a new answer.

Best regards

Laurent Ca...