cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5G9ZJ: DMA works for ADC4 but not ADC1

psfahr
Associate II

Hi, 

I've got a STM32U5G9ZJ-DK2 Discovery kit.

I'm trying to setup the ADC to work with GPDMA doing a continuous acquistion of two channels into a large buffer of samples. 

I got it working perfectly fine with ADC4, but I just don't get it work with ADC1.

From what I can tell it looks like the DMA Request from ADC1 is not forwarded to the GPDMA.

ADC1 itself works, too. It works well in interrupt mode (triggering an IRQ after the sequence of two channels).

Is the a special trick to enable the GPDMA request from ADC1, like is there a certain clock or power domain that must be enabled? 

	hdma_adcx.Instance 								= GPDMA1_Channel8;
	hdma_adcx.InitLinkedList.Priority 				= DMA_LOW_PRIORITY_LOW_WEIGHT;
	hdma_adcx.InitLinkedList.LinkStepMode 			= DMA_LSM_FULL_EXECUTION;
	hdma_adcx.InitLinkedList.LinkAllocatedPort 		= DMA_LINK_ALLOCATED_PORT0;
	hdma_adcx.InitLinkedList.TransferEventMode 		= DMA_TCEM_LAST_LL_ITEM_TRANSFER;
	hdma_adcx.InitLinkedList.LinkedListMode 		= DMA_LINKEDLIST_CIRCULAR;
	if (HAL_DMAEx_List_Init(&hdma_adcx) != HAL_OK)
	{
		ErrorHandler();
	}
	if (HAL_DMA_ConfigChannelAttributes(&hdma_adcx, DMA_CHANNEL_NPRIV) != HAL_OK)
	{
		ErrorHandler();
	}
	/* DMA node configuration declaration */
	DMA_NodeConfTypeDef pNodeConfig;
	pNodeConfig.NodeType 							= DMA_GPDMA_LINEAR_NODE;
	pNodeConfig.Init.Request 						= GPDMA1_REQUEST_ADC4;
	pNodeConfig.Init.BlkHWRequest 					= DMA_BREQ_SINGLE_BURST;
	pNodeConfig.Init.Direction 						= DMA_PERIPH_TO_MEMORY;
	pNodeConfig.Init.SrcInc 						= DMA_SINC_FIXED;
	pNodeConfig.Init.DestInc 						= DMA_DINC_INCREMENTED;
	pNodeConfig.Init.SrcDataWidth 					= DMA_SRC_DATAWIDTH_HALFWORD;
	pNodeConfig.Init.DestDataWidth 					= DMA_DEST_DATAWIDTH_HALFWORD;
	pNodeConfig.Init.SrcBurstLength 				= 1;
	pNodeConfig.Init.DestBurstLength 				= 1;
	pNodeConfig.Init.TransferAllocatedPort 			= DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT1;
	pNodeConfig.Init.TransferEventMode 				= DMA_TCEM_BLOCK_TRANSFER;
	pNodeConfig.TriggerConfig.TriggerPolarity 		= DMA_TRIG_POLARITY_MASKED;
	pNodeConfig.DataHandlingConfig.DataExchange 	= DMA_EXCHANGE_NONE;
	pNodeConfig.DataHandlingConfig.DataAlignment 	= DMA_DATA_RIGHTALIGN_ZEROPADDED;
	pNodeConfig.SrcAddress 							= 0;
	pNodeConfig.DstAddress 							= 0;
	pNodeConfig.DataSize 							= 0;
	/* Build adcNode Node */
	if (HAL_DMAEx_List_BuildNode(&pNodeConfig, &adcNode) 	!= HAL_OK) 
	{ 
		ErrorHandler(); 
	}
	/* Insert adcNode to Queue */
	if (HAL_DMAEx_List_InsertNode_Tail(&adcQueue, &adcNode) != HAL_OK)
	{ 
		ErrorHandler(); 
	}
	if (HAL_DMAEx_List_SetCircularMode(&adcQueue) 			!= HAL_OK)
	{ 
		ErrorHandler(); 
	}
	__HAL_LINKDMA(&hadcx, DMA_Handle, hdma_adcx);
	if (HAL_DMAEx_List_LinkQ(&hdma_adcx, &adcQueue) 		!= HAL_OK)
	{ 
		ErrorHandler(); 
	}
    // DMA IRQ
    HAL_NVIC_SetPriority(GPDMA1_Channel8_IRQn, 0, 0);
    HAL_NVIC_EnableIRQ(GPDMA1_Channel8_IRQn);

 

0 REPLIES 0