cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Transfer callback null, and XferHalfCpltCallback never called

Renato Valentim
Associate III

Hello I'm using the STM32F767ZI part.

I have the following DMA initialized this way:

	// TIM1 CC2 event
	dmaCC2.Init.Direction = DMA_MEMORY_TO_PERIPH;
	dmaCC2.Init.PeriphInc = DMA_PINC_DISABLE;
	dmaCC2.Init.MemInc = DMA_MINC_DISABLE;
	dmaCC2.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
	dmaCC2.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
	dmaCC2.Init.Mode = DMA_CIRCULAR;
	dmaCC2.Init.Priority = DMA_PRIORITY_VERY_HIGH;
	dmaCC2.Init.Channel = DMA_CHANNEL_6;
 
	dmaCC2.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
	dmaCC2.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
	dmaCC2.Init.MemBurst = DMA_MBURST_SINGLE;
	dmaCC2.Init.PeriphBurst = DMA_PBURST_SINGLE;
 
	dmaCC2.Instance = DMA2_Stream2;
 
	dmaCC2.XferCpltCallback  = DMA_TransferCompleteHandler;
	dmaCC2.XferHalfCpltCallback = DMA_TransferHalfHandler;
	dmaCC2.XferErrorCallback = DMA_TransferError;
 
	HAL_DMA_DeInit(&dmaCC2);
	HAL_DMA_Init(&dmaCC2);
	HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 2, 0);
	HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
	HAL_DMA_Start_IT(&dmaCC2, (uint32_t)WS2812_IO_Low, (uint32_t)&WS2812B_PORT->BSRR, BUFFER_SIZE);
  1. In the HAL_DMA_IRQHandler (Hal library) it checks if the XferCpltCallback pointer is NULL. It shouldn't be but when I put a breakpoint and hover over the pointer, it is indeed NULL. I do not understand how this can be as in my code I never actually do this.
  2. Also curiously, the check for full complete passes but the half-complete callback check (check for the DMA_IT_HT flag) never passes.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Renato Valentim
Associate III

Nevermind. The Deinit at the end was messing up everything. Thanks

View solution in original post

1 REPLY 1
Renato Valentim
Associate III

Nevermind. The Deinit at the end was messing up everything. Thanks