2016-10-05 08:35 PM
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); }}2016-10-05 09:24 PM
Change the output signal self revert, see the waveform attached. 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 = !Dac_Event; 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); } } /*************************************************/ Yellow channel is the DAC output a SAW UP waveform, Green channel is the DMA interrupt test output waveform. ________________ Attachments : graphs.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzaZ&d=%2Fa%2F0X0000000bO6%2Fi.UBgKDkbNuHTcF0bE0HX1zeOXy_su.DA4_Ag5Qvj5M&asPdf=false
2016-10-06 05:18 AM
Perhaps you should focus on how you are configuring it rather than the interrupt handlers?
2016-10-06 07:25 PM
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.2016-10-07 01:01 AM
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-