Page 1 of 1

STM32 DMA channel two irqs 4 and 5 shared

Posted: Tue May 10, 2011 6:26 pm
by ianmga
Hi Giovanni,

I'm upgrading Chibios to the latest and I found what I think it's a bug. STM32F103 shared the DMA2 channel 4 and channel 5 irqs, but on the DMA code they're different (I think that's fine for F105 and F107). As a result the irqs are never called (this is for ADC3 DMA).

Ian

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Tue May 10, 2011 7:01 pm
by Giovanni
Hi Ian,

Thanks, it will be fixed in 2.3.3, luckily now the DMA ISRs are centralized in the DMA driver so sharing is not an issue.

Giovanni

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Tue May 10, 2011 7:03 pm
by ianmga
I also discovered another small detail. In dmaAllocate for DMA2_ID it was checking against dmamsk1 instead of dmamsk2, so if I had dma1 going it was not enabling the RCC for DMA2.

Ian

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Tue May 10, 2011 7:06 pm
by Giovanni
Just a note, if you need ADC3 you may register it on channel 4, it should work.

Giovanni

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Tue May 10, 2011 7:38 pm
by Giovanni
ianmga wrote:I also discovered another small detail. In dmaAllocate for DMA2_ID it was checking against dmamsk1 instead of dmamsk2, so if I had dma1 going it was not enabling the RCC for DMA2.

Ian


I fixed this in the repository, the shared channel will have to wait tomorrow.

Giovanni

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Thu May 12, 2011 6:37 pm
by ianmga
Giovanni wrote:Just a note, if you need ADC3 you may register it on channel 4, it should work.

Giovanni


I got it working on channel 5, but I still had to rename the IRQ handler... I think... It didn't occur to me to try it on channel 4.

Re: STM32 DMA channel two irqs 4 and 5 shared

Posted: Thu May 12, 2011 6:49 pm
by Giovanni
Hi Ian,

I am going to fix this in 2.3.2 (this weekend I hope) by not supporting the IRQ for channel 4 which is only used by the SDIO. The SDIO peripheral is done in such a way to not require an IRQ from the DMA channel so it is perfectly acceptable.

The IRQ can be used by ADC3 alone.

Giovanni