2017-01-12 03:15 PM
I've run out of DMA channels so I can't run SPI2 with DMA both ways. Since I'm talking to an external NOR flash chip where reading data is of much higher priority than writing I'd be happy with RX only DMA.
Setting up via CubeMX and assigning just RX DMA completes without error but when using HAL_SPI_Receive_DMA() the HAL code uses HAL_SPI_TransmitReceive_DMA() which hardfaults when trying to fill in the TX DMA data fields (not surprising as they haven't been allocated).
How do I set up via CubeMX to do
HAL_SPI_Receive_DMA() for RX but HAL_SPI_Transmit() for TX?
I'm currently setting Direction=SPI_DIRECTION_2LINES which causes the call to HAL_SPI_TransmitReceive_DMA().
Direction=SPI_DIRECTION_1LINE looks like a non-starter as my hardware isn't set up like that.
If I use Direction=SPI_DIRECTION_2LINES_RXONLY, will I be able to poll the TX?
Cheers
2017-01-23 08:29 AM
Hello,
Yes, with your hardware configuration you can use '
Direction=SPI_DIRECTION_2LINES_RXONLY' parameter.
You will be able to poll Tx but after RX transfer completion. (by using HAL_SPI_Transmit function).
BRs,
Julien.