going from normal SPI to dma, no call back.
I got my SPI5 running the way I want it but now I want to move to DMA. When I do this the SPI lines remain low after sending its data. So I assume my config is off. Using the IOC to make changes I only see the fowling added.
/* SPI5 DMA Init */
/* SPI5_TX Init */
hdma_spi5_tx.Instance = DMA2_Stream3;
hdma_spi5_tx.Init.Request = DMA_REQUEST_SPI5_TX;
hdma_spi5_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_spi5_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_spi5_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_spi5_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_spi5_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_spi5_tx.Init.Mode = DMA_NORMAL;
hdma_spi5_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_spi5_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
if (HAL_DMA_Init(&hdma_spi5_tx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(hspi,hdmatx,hdma_spi5_tx);
/* SPI5_RX Init */
hdma_spi5_rx.Instance = DMA2_Stream0;
hdma_spi5_rx.Init.Request = DMA_REQUEST_SPI5_RX;
hdma_spi5_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_spi5_rx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_spi5_rx.Init.MemInc = DMA_MINC_ENABLE;
hdma_spi5_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_spi5_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_spi5_rx.Init.Mode = DMA_NORMAL;
hdma_spi5_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_spi5_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
if (HAL_DMA_Init(&hdma_spi5_rx) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(hspi,hdmarx,hdma_spi5_rx);
//added this to dma init
__HAL_RCC_DMA2_CLK_ENABLE();
HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);
HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);and I did change to
HAL_SPI_TransmitReceive_DMA(&hspi5, (uint8_t*)data_to_send, (uint8_t*)&FromTheADC, sizeof(data_to_send));
but HAL_SPI_TxRxCpltCallback is never called.
if I change my rx to DMA_CIRCULAR it just loop over and over.
In debug I see the call back is set, no errors are given and the call back was not hit.
I'm using the nss and have the int set
HAL_NVIC_SetPriority(SPI5_IRQn, 1, 0);
HAL_NVIC_EnableIRQ(SPI5_IRQn);
nss does come back up but the code is stuck waiting in my while loop.
