2026-03-11 2:23 AM - last edited on 2026-03-11 2:52 AM by Andrew Neil
Hi,
HAL_ADC_Start_DMA() returns HAL_OK, TIM2 starts, ADC begins converting (confirmed via ADC_ISR in debugger), but HPDMA1 Channel 0 immediately raises a DTE (Data Transfer Error), triggering the error callback.
This is a minimal reproduction project containing only:
No ETH, no LwIP, no NPU — deliberately stripped down to isolate the DMA issue.
ROM (XIP) : 0x70100400, 511K — code in external flashRAM (FLEXRAM) : 0x34000000, 400K — data/bss/heap/stackAXISRAM2_NC : 0x34100000, 64K — DMA node/list/buffer (non-cacheable, NOLOAD)AXISRAM2_C : 0x34110000, 960K — (unused in this project)
/* 1. Build node */ NodeConfig.NodeType = DMA_HPDMA_LINEAR_NODE; NodeConfig.Init.Request = HPDMA1_REQUEST_ADC1; NodeConfig.Init.Direction = DMA_PERIPH_TO_MEMORY; NodeConfig.Init.SrcInc = DMA_SINC_FIXED; NodeConfig.Init.DestInc = DMA_DINC_INCREMENTED; NodeConfig.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_HALFWORD; NodeConfig.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD; NodeConfig.Init.SrcBurstLength = 1; NodeConfig.Init.DestBurstLength = 1; NodeConfig.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0 | DMA_DEST_ALLOCATED_PORT1; NodeConfig.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER; NodeConfig.Init.Mode = DMA_NORMAL; NodeConfig.TriggerConfig.TriggerPolarity = DMA_TRIG_POLARITY_MASKED; NodeConfig.SrcSecure = DMA_CHANNEL_SRC_SEC; NodeConfig.DestSecure = DMA_CHANNEL_DEST_SEC; HAL_DMAEx_List_BuildNode(&NodeConfig, &Node_HPDMA1_Channel0); HAL_DMAEx_List_InsertNode(&List_HPDMA1_Channel0, NULL, &Node_HPDMA1_Channel0); HAL_DMAEx_List_SetCircularMode(&List_HPDMA1_Channel0); /* 2. Init handle */ handle_HPDMA1_Channel0.Instance = HPDMA1_Channel0; handle_HPDMA1_Channel0.InitLinkedList.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT; handle_HPDMA1_Channel0.InitLinkedList.LinkStepMode = DMA_LSM_FULL_EXECUTION; handle_HPDMA1_Channel0.InitLinkedList.LinkAllocatedPort = DMA_LINK_ALLOCATED_PORT1; handle_HPDMA1_Channel0.InitLinkedList.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER; handle_HPDMA1_Channel0.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR; HAL_DMAEx_List_Init(&handle_HPDMA1_Channel0); HAL_DMAEx_List_LinkQ(&handle_HPDMA1_Channel0, &List_HPDMA1_Channel0); __HAL_LINKDMA(&hadc1, DMA_Handle, handle_HPDMA1_Channel0); /* 3. CID isolation — set after Init */ IsolationConfiginput.CidFiltering = DMA_ISOLATION_ON; IsolationConfiginput.StaticCid = DMA_CHANNEL_STATIC_CID_1; HAL_DMA_SetIsolationAttributes(&handle_HPDMA1_Channel0, &IsolationConfiginput);
__HAL_RCC_RIFSC_CLK_ENABLE(); /* RIMC — ETH1 (not used in this project, kept for completeness) */ RIMC_master.MasterCID = RIF_CID_1; RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_NPRIV; HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_ETH1, &RIMC_master); /* RIFSC — ADC12 */ HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_ADC12, RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_NPRIV); /* HPDMA1 channel security */ HAL_DMA_ConfigChannelAttributes(&handle_HPDMA1_Channel0, DMA_CHANNEL_SEC | DMA_CHANNEL_PRIV | DMA_CHANNEL_SRC_SEC | DMA_CHANNEL_DEST_SEC); /* No RISAF configuration — see problem description */
/* Attribute 0: Write-Back Non-Transient RW-Allocate (cacheable) */ /* Attribute 1: Non-Cacheable */ /* Region 0: FLEXRAM 0x34000000–0x3404FFFF Attr0 RW XN */ /* Region 1: AXISRAM2_NC 0x34100000–0x3410FFFF Attr1 RW XN Outer-Shareable */ /* Region 2: DTCM 0x20000000–0x2001FFFF Attr0 RW XN */ /* Region 3: External Flash 0x70000000–0x73FFFFFF Attr0 RO X */ HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
2026-03-23 2:50 AM
Hello @BitkinBitki
The DMA DTE error is caused by the attempt to perform a transfer with HPDMA from ADC1 to AXISRAM2 using port 1.
For this configuration, only port 0 is authorized