STM32 DMA channel two irqs 4 and 5 shared

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
ianmga
Posts: 42
Joined: Fri Jan 28, 2011 1:11 am

STM32 DMA channel two irqs 4 and 5 shared

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

Re: STM32 DMA channel two irqs 4 and 5 shared

Post 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
ianmga
Posts: 42
Joined: Fri Jan 28, 2011 1:11 am

Re: STM32 DMA channel two irqs 4 and 5 shared

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

Re: STM32 DMA channel two irqs 4 and 5 shared

Post by Giovanni »

Just a note, if you need ADC3 you may register it on channel 4, it should work.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32 DMA channel two irqs 4 and 5 shared

Post 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
ianmga
Posts: 42
Joined: Fri Jan 28, 2011 1:11 am

Re: STM32 DMA channel two irqs 4 and 5 shared

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

Re: STM32 DMA channel two irqs 4 and 5 shared

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