cancel
Showing results for 
Search instead for 
Did you mean: 

Conflict with DMA Interrupt and USB Virtual Com Port STM32F4

Martiska.Greg
Associate III
Posted on August 06, 2013 at 15:30

I am having trouble using the DMA transfer complete interrupt with the USB Virtual COM Port. The USB port stops functioning when the interrupt is called. The interrupt command is:

DMA_ITConfig(DMA1_Stream7, DMA_IT_TC,

ENABLE

);

I removed all code from the interrupt to make sure their was no conflict in the interrupt call itself and this had no effect. The DMA itself is functioning as I am using it to ramp speed for a motor and the motor speed is ramping as programmed. If do not call the interrupt the system stays connected. If I call the interrupt the USB stops communicating. I also changed streams and channels with same effect. FYI this code has been working for years using the STM32F1.

I am also trying to use a DMA interrupt with the ADC and the interrupt is not being called. The ADC and DMA are working as I can access the data without an interrupt. Same command as above but for DMA2 Stream 0. Not sure if these problems are related. I have not tested the ADC part enough to know if it is only the interrupt.

Thanks for any suggestions. I have examined the USB Virtual COM Port code and have not found any obvious conflicts with the DMA interrupt.

#virtual-com-port-usb-dma
3 REPLIES 3
Posted on August 06, 2013 at 16:20

If the service routine does not clear the interrupt properly, then you'll be trapped in an interrupt storm forever. ie it will continually tail-chain rather than run other foreground code, or interrupts of lower priority.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Martiska.Greg
Associate III
Posted on August 06, 2013 at 17:22

Clive1:

Thanks for the response. You hit the nail on the head. I was clearing the interrupt pending bit but for the wrong channel. I was using DMA_IT_TCIF1 instead of DMA_IT_TCIF7 in the line:

DMA_ClearITPendingBit(DMA1_Stream7, DMA_IT_TCIF7);

I have been having many problems like this in migrating from the STM32F1 to STM32F4. ST makes a big point of saying that the pins are compatible between microprocessors in the STM32 product line. This lulls one into thinking the code is also compatible. It generally is but there are many small changes required. The DMA for example is much more complex on the F4 part than the F1 part with many more streams and channels. It requires a detailed look at the code when migrating.

Thanks again for your help.

manoj
Associate II
Posted on March 14, 2015 at 06:21

play mp3 with USB via DMA , then UART interrupt Handler miss some data

sir,

i am working on a project in which we use stm32f407 discovery board, in which we play audio song with USB using DMA (DMA1 stream7) , and use interrupt handler of UART3 (PB10 and PB11) .

First we receive audio data and send start DMA ,DMA send the data to CS43l22( audio driver IC connected in stm32f407 discovery board). simultaneously we send large data to controller through UART3 (PB10 and PB11). Interrupt handler of UART miss some packet of data.

________________

Attachments :

data_received_from_buffer_when_audio_is_not_playing__2_.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Ju&d=%2Fa%2F0X0000000blD%2F8EdaGSjCDQUExAGgHiVpD6jrk2DE3igk2lx5Ll0.0t4&asPdf=false

data_received_from_buffer_when_audio_is_playing__2_.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I1Jp&d=%2Fa%2F0X0000000blE%2FXcvjHqKQG.KTWn.wlY5BR0rLzgdAShyhyvnzX7ERkME&asPdf=false