SAMV71 XDMAC How to initialize.

Discussions around product based on ARM Cortex M7 core.
This forum will be discontinued soon.

Moderator: nferre

Vasiliy_Ekra
Posts: 4
Joined: Fri Aug 28, 2015 2:44 pm

SAMV71 XDMAC How to initialize.

Mon Sep 28, 2015 12:32 pm

I am using XDMA controller with USART module. There are some examples of using DMA on Atmel's web site. I tried examples and it works. I have initialised DMA for receiving simple microblock, or block with multiple microblocks. But I need to init DMA tor receiving multiple block. Two different data packets from USART one after another. For example I want to receive 10 chars from USART. XDMA should place first 3 chars to buf1[] and next 7 to buf2[] in RAM. And I need interrupt handler between buffers.

So I try to use Linked List descriptors. But there is no explanations of initialisation in datasheet. There are 4 view structures of descriptor, but what view I should use? Where I can read about it?
Maybe someone have example of initialization?
Vasiliy_Ekra
Posts: 4
Joined: Fri Aug 28, 2015 2:44 pm

Re: SAMV71 XDMAC How to initialize.

Mon Sep 28, 2015 1:59 pm

I have initialized receiving data to 3 different buffers. But have not got interrupt between buffers.

Code: Select all

	
USART_AcknowledgeRxTimeOut(USART, 0);
	 USART->US_CR = US_CR_RSTSTA;
	//USART_EnableIt(USART, US_IER_TIMEOUT|US_IER_PARE);

	descr[0].mbr_nda = (uint32_t) &(descr[1].mbr_nda);
	descr[0].mbr_ubc = XDMA_UBC_NVIEW_NDV1 | XDMA_UBC_NSEN_UPDATED | XDMA_UBC_NDEN_UPDATED | XDMA_UBC_NDE_FETCH_EN | 1;
	descr[0].mbr_da = (uint32_t)&buf1[0];
	descr[0].mbr_sa = (uint32_t)&USART0->US_RHR;
	
	descr[1].mbr_nda = (uint32_t) &(descr[2].mbr_nda);
	descr[1].mbr_ubc = XDMA_UBC_NVIEW_NDV1 | XDMA_UBC_NSEN_UPDATED | XDMA_UBC_NDEN_UPDATED | XDMA_UBC_NDE_FETCH_EN | 2;
	descr[1].mbr_da = (uint32_t)&buf2[0];
	descr[1].mbr_sa = (uint32_t)&USART0->US_RHR;
	
	descr[2].mbr_nda = 0;
	descr[2].mbr_ubc = XDMA_UBC_NVIEW_NDV1 | XDMA_UBC_NSEN_UPDATED | XDMA_UBC_NDEN_UPDATED | XDMA_UBC_NDE_FETCH_DIS | 3;
	descr[2].mbr_da = (uint32_t)&buf3[0];
	descr[2].mbr_sa = (uint32_t)&USART0->US_RHR;

	XDMAC_GetChannelIsr( XDMAC, 1);	
	XDMAC_SetChannelConfig(XDMAC, 1,	XDMAC_CC_TYPE_PER_TRAN |
										XDMAC_CC_MBSIZE_SINGLE |
										XDMAC_CC_DSYNC_PER2MEM |
										XDMAC_CC_CSIZE_CHK_1 |
										XDMAC_CC_DWIDTH_BYTE |
										XDMAC_CC_SIF_AHB_IF1 |
										XDMAC_CC_DIF_AHB_IF0 |
										XDMAC_CC_SAM_FIXED_AM |
										XDMAC_CC_DAM_INCREMENTED_AM |
										XDMAC_CC_PERID(XDMAIF_Get_ChannelNumber(ID_USART0, XDMAD_TRANSFER_RX )));
	
	XDMAC_SetDescriptorAddr(XDMAC, 1, (uint32_t) &descr[0].mbr_nda, 0);
	uint32_t xdmaCndc = XDMAC_CNDC_NDVIEW_NDV1 | XDMAC_CNDC_NDE_DSCR_FETCH_EN | XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED | XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED ;
	XDMAC_SetDescriptorControl(XDMAC, 1, xdmaCndc);
	XDMAC_DisableChannelIt (XDMAC, 1, 0xFF);
	XDMAC_EnableChannelIt (XDMAC,1, XDMAC_CIE_LIE | XDMAC_CIE_BIE );
	XDMAC_EnableChannel(XDMAC, 1);
	XDMAC_EnableGIt( XDMAC, 1);		
I think I have 1 block that consist of 3 microblocks. So interrupt flag End of block and End of linked list at the same time.
How to init 3 blocks?
ecisw
Posts: 2
Joined: Fri Dec 04, 2015 10:23 am

Re: SAMV71 XDMAC How to initialize.

Fri Dec 04, 2015 11:13 am

I remember I saw the simiple function in the softpack1.5 from atmel official website. The example name is ssc_dma_audio. Maybe helpful.

Return to “SAM Cortex-M7 MCU”

Who is online

Users browsing this forum: No registered users and 2 guests