2013-08-13 02:41 AM
Hi,
I am using DMA1 on an STM32F103 to collect data continuously from ADC1 as it cycles thru a regular conversion group. Every time the DMA transfer complete interrupt fires I post an event to look at the data and do stuff with it. This is my DMA interrupt handler, it doesn't need to do anything to the DMA because it running in circular mode:void DMA1_Channel1_IRQHandler(void)
{ static char strBuffer[50]; if( SET == DMA_GetITStatus( DMA1_IT_TC1 )) { DMA_ClearITPendingBit(DMA1_IT_TC1); bAddEventToQueue( false, false, false, 0, vEH_PSU_ADC1_ReadComplete, NULL, 0UL ); } else if( SET == DMA_GetITStatus( DMA1_IT_TE1 )) { vSD_LogViaEventQueue( ''DMA1_CH1 Transfer error'' ); } else { // For some reason this gets hit occasionally - not really happy about using sprintf in an interrupt handler, but it gets hit pretty rarely sprintf( strBuffer, ''Unexpected DMA1_CH1 G=%X, C=%X, H=%X, E=%X'', DMA_GetITStatus( DMA1_IT_GL1 ), DMA_GetITStatus( DMA1_IT_TC1 ), DMA_GetITStatus( DMA1_IT_HT1 ), DMA_GetITStatus( DMA1_IT_TE1 )); vSD_LogViaEventQueue( strBuffer ); } } As the comment says, occasionally the handler gets hit but none of the interrupt flags are set (the logged message is Unexpected DMA1_CH1 G=0, C=0, H=0, E=0 ). What could be going on? Cheers, Mark #irq #dma #stm32f1