cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt IRQ Handler with ADC DMA IRQ Handler

KKuma.4
Associate

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

6 REPLIES 6

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
Up vote any posts that you find helpful, it shows what's working..
KKuma.4
Associate

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...
Lead II

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...
Lead II

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

Any news?

Best regards

Laurent Ca...

PBo
Associate III

​@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...
Lead II

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