Skip to main content
Gabriel T
Senior
January 14, 2021
Question

STM32H7 SPI DMA not working

  • January 14, 2021
  • 11 replies
  • 5196 views

Hello,

When I use DMA with SPI it is not working.

0693W000007BGY9QAO.pngWhen I get a falling edge on DRDY this function gets called :

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
	if(GPIO_Pin == DRDY_ADC_Pin)
	{
		HAL_SPI_Receive_DMA(&hspi1, SPI1_RxBuffer, READBACK_LENGTH);
	}
}

SPI1 RX Buffer is located in a DMA accessible memory, RAM D2 (it works I checked the .map) :

uint8_t __attribute__(( section(".ramd2section"))) SPI1_RxBuffer[READBACK_LENGTH]; // SPI Tx

My question is do I need to use a setup function outside of what HAL_SPI_MspInit() already does. For example HAL_MDMA_Start_IT() ?

I've red few posts with the same problem but the solution is never explicated or done not using only HAL function.

What I use :

SPI1 Master full-duplex

DMA1 Stream 2 SPI1_Rx to SPI1_RxBuffer

MDMA Stream 0 SPI1_RxBuffer to ads_buf located in DTCMRAM

This topic has been closed for replies.

11 replies

Gabriel T
Gabriel TAuthor
Senior
January 19, 2021

I will write my own driver and switch to half duplex