2015-11-29 05:15 AM
Hi, just a quick note:
HAL library: F2 v1.1.0 (09/Oct/2015) I was trying to use this function and have encountered hardfault when the size is >1. I did not look deep into the problem, but the cause seems to be on the line 16 (code below). Notice that theHAL_SPI_TransmitReceive_DMA()
function is called using repeated ''pData''. Workaround is to useHAL_SPI_TransmitReceive_DMA()
directly in application, using separate buffers. If anyone has some insight or explanation to this issue, please provide here. Thank you :)
HAL_StatusTypeDef HAL_SPI_Receive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
{
......
/* Configure communication direction : 1Line */
if
(hspi->Init.Direction == SPI_DIRECTION_1LINE)
{
SPI_1LINE_RX(hspi);
}
else
if
((hspi->Init.Direction == SPI_DIRECTION_2LINES)&&(hspi->Init.Mode == SPI_MODE_MASTER))
{
/* Process Unlocked */
__HAL_UNLOCK(hspi);
/* Call transmit-receive function to send Dummy data on Tx line and generate clock on CLK line */
return
HAL_SPI_TransmitReceive_DMA(hspi, pData, pData, Size);
}
......
}
#hardfault #spi #dma #hal