2019-05-18 06:15 AM
I try to make two H743 boards communicate each other. The master board sends a chunk (~300Bytes) unregularly and the slave board shall receive it and write it to memory via DMA.
Is it restricted at all? The source code says:
/* Circular mode restriction:
(+) The DMA circular mode cannot be used when the SPI is configured in these modes:
(++) Master 2Lines RxOnly
(++) Master 1Line Rx
*/
So "slave mode" should work. But the HAL_SPI_Receive_DMA() function has following condition:
/* Set the number if data at current transfer */
if (hspi->hdmarx->Init.Mode == DMA_CIRCULAR)
{
MODIFY_REG(hspi->Instance->CR2, SPI_CR2_TSIZE, 0);
}
else
{
MODIFY_REG(hspi->Instance->CR2, SPI_CR2_TSIZE, Size);
}
Removing the condition doesn't help either.
The performance is a very important issue for me. So I don't always want to trigger a HAL_SPI_Receive_IT()
Snippets from my code:
stm32h7xx_hal_msp.c:
hdma_spi3_rx.Instance = DMA1_Stream0;
hdma_spi3_rx.Init.Request = DMA_REQUEST_SPI3_RX;
hdma_spi3_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_spi3_rx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_spi3_rx.Init.MemInc = DMA_MINC_ENABLE;
hdma_spi3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_spi3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_spi3_rx.Init.Mode = DMA_NORMAL; //DMA_CIRCULAR NOT WORKING
hdma_spi3_rx.Init.Priority = DMA_PRIORITY_LOW;
hdma_spi3_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
HAL_DMA_Init(&hdma_spi3_rx);
Can anybody help me?
Thanks for responses
2019-05-18 06:44 AM
Not a H7 user, as for SPI, it might be the latest IP version.
From the 2nd gen SPI (with programmable bit length and FIFO), SPI Slave works with DMA in Cyclic mode if you take care of specifics
Maybe this will help. I was told H7 has xtra memory buses, restrictions etc... which I'm no xpert...