Question
HAL_SPI_TransmitReceive_DMA not written correctly by CubeMX
I am using SPI with DMA as shown in the screenshot. DMA is using Data Handling to truncate data from SPI's 16bit buffer into 8 bit values.

The following part of the code errors out. Commenting this code out makes my application work, but every time I change things in CubeMX it is rewriten. Why does this check even exist?
/* Packing mode management is enabled by the DMA settings */
if (((hspi->Init.DataSize > SPI_DATASIZE_16BIT) && (hspi->hdmarx->Init.DestDataWidth != DMA_DEST_DATAWIDTH_WORD) && \
(IS_SPI_FULL_INSTANCE(hspi->Instance))) || \
((hspi->Init.DataSize > SPI_DATASIZE_8BIT) && (hspi->hdmarx->Init.DestDataWidth == DMA_DEST_DATAWIDTH_BYTE)))
{
/* Restriction the DMA data received is not allowed in this mode */
errorcode = HAL_ERROR;
/* Unlock the process */
__HAL_UNLOCK(hspi);
return errorcode;
}
