CubieBoard Forum

Cubieboard itself => Beginners => Topic started by: frd1995 on July 24, 2019, 02:19:06 am

Title: sun7i spi does not work for >= 64 bytes
Post by: frd1995 on July 24, 2019, 02:19:06 am
Hi.
My Cubieboard2 spi work for arrays less that 64  bytes but for greater than it, I get these errors:
Operation not permitted
dmesg output:

[spi-err] sun7i_spi_handler: spi0 ERR comes, irq status = 0x00003f01
[spi-err] sun7i_spi_handler: spi0 master mode error: txFIFO overflow/rxFIFO underrun or overflow
[spi-err] sun7i_spi_xfer: spi0 cpu transfer data time out
[spi-err] sun7i_spi_xfer: spi0 xfer failed


My guess is that some thing is wrong with DMA on SPI. I did nothing to Device Tree, arch/arm/boot/dts/ directory does not exist. I also checked irq status and I figured out that 13th bit of irq status is 1.
from arch/arm/mach-sun7i/include/mach/spi.h:

#define SPI_STAT_RO         (0x1 << 5)  /* rxFIFO overflow, 0: rxfifo is available;1:rxfifo has overflowed! */
#define SPI_STAT_RU         (0x1 << 6)  /* rxFIFO underrun,fectch data with no data available in FIFO */
#define SPI_STAT_TO         (0x1 << 13) /* txFIFO overflow 0:not overflow;1:overflow */
#define SPI_STAT_ERR        (SPI_STAT_TO|SPI_STAT_RU|SPI_STAT_RO) //Slave mode,no SPI_STAT_TU

please help me how to fix this problem. I'm stuck on this for two weeks.
Title: Re: sun7i spi does not work for >= 64 bytes
Post by: frd1995 on August 04, 2019, 03:19:35 pm
My bad. In the previous Kbuild file there was SPI_SUNXI_NDMA and I have been repalced SUNXI with SUN7I while I should write SUN7I_SPI_NDMA, not SPI_SUN7I_NDMA