2016-09-17 07:54 AM
hello dear forum,
I try to DMA-ADC with my STM32F4I want that at the end of DMA transferit stops conversion and gives an interrupt and so I can check the ADC resultI couldnot see an example at the STD libraryplease a tip how to adjust DMA for interrupt thank you #stm32f4-dma-adc2016-09-17 01:37 PM
The DMA can generate a TC interrupt when it completes a set of transfers. ie an EOC for all channels.
You can configure the DMA in circular mode so you only need to initialize it once. If you config the ADC in non-continuous mode it will do the list of enumerated channel once every time you trigger it (via software, or timer). For more continuous operation you might want to double the DMA buffer size and use the HT and TC interrupts to manage alternating halves of the buffer.2016-09-18 03:26 AM
Hello Clive , thank you
is this code OK with Interrupt handler how do I adjust this code to handle DMA1 channel 1 interrupt ?void
DMA_STREAM_IRQHANDLER(
void
)
{
/* Test on DMA Stream Transfer Complete interrupt */
if
(DMA_GetITStatus(DMA_STREAM, DMA_IT_TCIF))
{
/* Clear DMA Stream Transfer Complete interrupt pending bit */
DMA_ClearITPendingBit(DMA_STREAM, DMA_IT_TCIF);
is this code OK for initializing ?
how do I adjust this code to init DMA1 channel 1 interrupt ?
DMA_ITConfig(DMA_STREAM, DMA_IT_TC, ENABLE);
-------------------
NVIC_InitStructure.NVIC_IRQChannel = DMA_STREAM_IRQ;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
2016-09-18 05:40 AM
The STM32F4 needs attention to the Stream used, and that impacts how it is cleared. The Channel is more of a configuration issue, associating what the DMA request source is.
void DMA2_Stream0_IRQHandler(void)
{
/* Test on DMA Stream Transfer Complete interrupt */
if(DMA_GetITStatus(DMA2_Stream0, DMA_IT_TCIF0))
{
/* Clear DMA Stream Transfer Complete interrupt pending bit */
DMA_ClearITPendingBit(DMA2_Stream0, DMA_IT_TCIF0);
// Add code here to process buffer
}
...
}