S32K DMA传输ADC数据

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K DMA传输ADC数据

5,872 Views
yumi
Contributor II

#S32K ADC DMA :由FTM1每隔1ms触发PDB0,PDB0设置pretrigger 3个ADC0通道,3个ADC0通道采集完一遍通过DMA中断读取。之前用过采集4路ADC并通过DMA读取,但是改成3通道时进入不了中断,不知道是不是DMA传输ADC只支持特定的通道数。

配置程序如下,接收RecordBuf_ADC0[3]是uint32_t类型,ADC通道从2~4, 请大佬们帮忙分析一下问题:

 DMA->TCD[0].CSR &= ~DMA_TCD_CSR_DONE_MASK;   
 DMA->TCD[0].ATTR = DMA_TCD_ATTR_SMOD(4)  |    /*这个设置成0也不行*/    

                                      DMA_TCD_ATTR_SSIZE(2) |      /*Source data transfer size32bit*/            
                                      DMA_TCD_ATTR_DMOD(0)  |              
                                      DMA_TCD_ATTR_DSIZE(2);        /*Destination data transfer size 32 bit*/      
 DMA->TCD[0].NBYTES.MLNO = DMA_TCD_NBYTES_MLNO_NBYTES(3);   
 DMA->TCD[0].CITER.ELINKNO = DMA_TCD_CITER_ELINKNO_CITER(3) |  
                                                        DMA_TCD_CITER_ELINKNO_ELINK(0);   
 DMA->TCD[0].BITER.ELINKNO = DMA_TCD_BITER_ELINKNO_BITER(3) |  
                                                        DMA_TCD_BITER_ELINKNO_ELINK(0);   

 DMA->TCD[0].SADDR = DMA_TCD_SADDR_SADDR(&(ADC0->R[2]));    
 DMA->TCD[0].SOFF  = DMA_TCD_SOFF_SOFF(4);      
 DMA->TCD[0].SLAST = DMA_TCD_SLAST_SLAST(0);       /*Last source address adjustment 改成-12=4byte/channel*3channel 也不行*/

 DMA->TCD[0].DADDR = DMA_TCD_DADDR_DADDR(RecordBuf_ADC0);  
 DMA->TCD[0].DOFF  = DMA_TCD_DOFF_DOFF(4); 
 DMA->TCD[0].DLASTSGA = DMA_TCD_DLASTSGA_DLASTSGA(-12);     
 DMA->TCD[0].CSR = DMA_TCD_CSR_BWC(0)         |           
                                    DMA_TCD_CSR_MAJORELINK(0)  |           
                                    DMA_TCD_CSR_MAJORLINKCH(0) |          
                                    DMA_TCD_CSR_ESG(0)         |                                  

                                    DMA_TCD_CSR_DREQ(0)        |          
                                    DMA_TCD_CSR_INTHALF(0)     |          
                                    DMA_TCD_CSR_INTMAJOR(1)    |          
                                    DMA_TCD_CSR_START(0);                  

Tags (1)
4 Replies

4,630 Views
kerwin_cao
Contributor I

你好,我也遇到类似问题,我pdb的trigger是software trigger 然后勾选了pdb的continuous mode,然后用pdb触发一路adc,之后用dma传输的sram里,但是我给dma使能了中断,但发现只能进一次dma的中断;想请教下您这边的问题是怎么解决的

0 Kudos
Reply

4,630 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

你好,请在产品子论坛中发布问题贴,我的同事会提供技术支持的。

B.R.

Mike

0 Kudos
Reply

4,630 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

抱歉回复晚了。

能提供完整的S32K产品part number吗?


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

4,630 Views
yumi
Contributor II

你好,该问题在NXP技术人员的支持下已解决,非常感谢!

0 Kudos
Reply