The DMA interrupt is different between ADC and DAC
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-10-05 8:35 PM
Posted on October 06, 2016 at 05:35
NUCLEO-F746ZG
I'm testing the ADC and DAC work with DMA, but the interrupt is different:the DMA of ADC can enter interrupt when Half and Full transfer.But the DMA of DAC only interrupt when Half transfer.Timer tmr;DigitalOut Dac_Event(PB_1);static int tinterval;void DMA2_Stream0_IRQHandler(void)//ADC DMA{ /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */ tim4cnt++; if(__HAL_DMA_GET_IT_SOURCE(&DMA_ADC_Handle, DMA_IT_HT)) { //Half transfer tinterval = tmr.read_us();//Half DMA HAL_DMA_IRQHandler(&DMA_ADC_Handle); return; } if(__HAL_DMA_GET_IT_SOURCE(&DMA_ADC_Handle, DMA_IT_TC))//Full transfer { tinterval=tmr.read_us() - tinterval; HAL_DMA_IRQHandler(&DMA_ADC_Handle); }}void DMA1_Stream6_IRQHandler(void)////DAC DMA DMA1_Stream6{ /* USER CODE BEGIN DMA2_Stream2_IRQn 0 */ if(__HAL_DMA_GET_IT_SOURCE(&DMA_DAC_Handle, DMA_IT_HT)) { //Half transfer Dac_Event = 1; HAL_DMA_IRQHandler(&DMA_DAC_Handle); return; } if(__HAL_DMA_GET_IT_SOURCE(&DMA_DAC_Handle, DMA_IT_TC)) { //Full transfer not enter Dac_Event = 0; HAL_DMA_IRQHandler(&DMA_DAC_Handle); }}
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-10-05 9:24 PM
Posted on October 06, 2016 at 06:24
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-10-06 5:18 AM
Posted on October 06, 2016 at 14:18
Perhaps you should focus on how you are configuring it rather than the interrupt handlers?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-10-06 7:25 PM
Posted on October 07, 2016 at 04:25
You are right, my ADC DMA work with normal mode, it's means 1 transfer to end, but my DAC DMA work with circula mode.
But the interrupt response is still strange, the DAC DMA produce twice interrupt, and it's Flag always shows half transfer.Whatever, I can initial a global varible to identify if the interrupt is half or full.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-10-07 1:01 AM
Posted on October 07, 2016 at 10:01
Hi qiyong.mu.001,
You would share further details as more code ( how ADC and DAC are configured) to make users able to help you.-Hannibal-