Issues with spiSend()
Posted: Mon Aug 14, 2017 4:38 pm
Hi,
(this is related with ST_STM32F429I_DISCOVERY board)
I'm trying to use the SPI to write a byte array to a SPI device and keep bumping onto a "DMA failure" exception.
This is write only operation.
If I call spiSend(...) the exception is thrown.
If I call spiStartSendI(...) the code executes without issues.
I've read several forum threads about this SPI and DMA and I've tested this either using the byte array pointer received for tx and also by copying in them to static local vars.
Peeking into the code several questions rise:
- in spi_lld_send why is that the dmaStreamSetTransactionSize(spip->dmarx, n); is (apparently) setting an RX operation of N size when there is none, after all this is a TX operation only?
- also in spi_lld_send isn't there an issue with calling dmaStreamEnable(spip->dmarx); before dmaStreamEnable(spip->dmatx); (after all we are trying to perform a TX operation not an RX)?
I could also only find test cases (in testhal\STM32\STM32F4xx\SPI) that are using spiExchange(), none using 'just' spiStartSend() or spiStartReceive().
(this is related with ST_STM32F429I_DISCOVERY board)
I'm trying to use the SPI to write a byte array to a SPI device and keep bumping onto a "DMA failure" exception.
This is write only operation.
If I call spiSend(...) the exception is thrown.
If I call spiStartSendI(...) the code executes without issues.
I've read several forum threads about this SPI and DMA and I've tested this either using the byte array pointer received for tx and also by copying in them to static local vars.
Peeking into the code several questions rise:
- in spi_lld_send why is that the dmaStreamSetTransactionSize(spip->dmarx, n); is (apparently) setting an RX operation of N size when there is none, after all this is a TX operation only?
- also in spi_lld_send isn't there an issue with calling dmaStreamEnable(spip->dmarx); before dmaStreamEnable(spip->dmatx); (after all we are trying to perform a TX operation not an RX)?
I could also only find test cases (in testhal\STM32\STM32F4xx\SPI) that are using spiExchange(), none using 'just' spiStartSend() or spiStartReceive().