gustavonihei opened a new pull request #3130: URL: https://github.com/apache/incubator-nuttx/pull/3130
## Summary This PR intends to address a regression caused by PR #3117 when SPI is configured to work in Mixed mode, i.e. transfers via both polling and interrupts (with DMA). There are two issues being addressed: 1) Failure to set the length in bits of polling operations when DMA was also enabled due to a wrong checking. Now `esp32_spi_setbits` will always modify the register SPI_MOSI_DLEN and SPI_MISO_DLEN registers, regardless of the transfer mode. In case of a DMA transfer, both fields will be overridden anyway in `esp32_spi_dma_exchange` based on the configured length. 2) Previously SPI interrupts were enabled on DMA initialization. But since the addition of SPI Mixed mode it created a side-effect, breaking polling transfers. So now interrupts are enabled before the DMA transactions and disabled once they are finished. Furthermore, the transaction done flag is also cleared before a new transaction starts. ## Impact In case a peripheral using SPI interface only relied on Polling, it wouldn't suffer any effect. This fix is related for SPI with DMA. ## Testing Custom configuration based on `esp32-wrover-kit`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
