Altera_Forum
Honored Contributor
9 years agoCyclone V SPI master releases chip select when TX FIFO runs empty. HOW TO PREVENT???
Hi, I have noticed that the Cyclone V SPI master releases chip select when TX FIFO runs empty.
I use Linux kernel 4.1, but the spi-dw driver is pretty much the same as in the latest kernel. The SPI controller pull chip select low and starts transferring immediately after the first byte is written to the TX FIFO. Chip select is released when all data from the TX FIFO is transmitted. Usually this works fine, except when an interrupt occurs before all data is written to the TX FIFO and the TX FIFO runs out of data. Chip select is then released and the message is aborted from the slave device's point of view. The chip select is again pulled down when the writing to the TX FIFO resumes after returning from the interrupt, which can be taken for a valid command by the slave device... I have found a workaround, which is disabling of all interrupts during SPI transmission, but I would definitely prefer something less dramatic. Note, this problem is present both for interrupt and polled mode. Is there any way to stop the SPI controller from releasing the chip select when the TX FIFO runs empty? To me, it looks like an major SPI controller bug, unless this is a desired feature...