SPIS buffer cannot receive more than 64 bytes

Hi all,

I have a SPIS implementation on an nRF52840 running smoothly. Recently I'v had the need to receive large packets (up to 270 bytes) in one single transaction. However, the slave only receives 64 bytes. I am making sure that my internal SPI buffers (defined in the application to use the SPI APIs) are large enough to receive this. Also, the easydma-maxcnt-bits is set to 16. I have tried digging on the kconfig reference to see if there is a config that I am missing but I did not find anything that explicitly sets the SPIS buffer size. I know SPIS is implemented with EasyDMA and the buffers length is defined by the TXD.MAXCNT and RXD.MACNT registers. How can I set the values of these? I am using NCS v2.5.0 and the SPI driver in 

<zephyr/drivers/spi.h>.
Best regards,
Kevin 
Parents
  • Hi Kevin,

    There should not be any limitation of 64 bytes. Can you share more details about what you are doing and what you have found by debugging and testing?

    Br,

    Einar

  • Hi Einar,

    Yes. I based my routine on this example. The routine is basically the same, I only changed the data that has been exchanged. Inside the function spi_slave_check_for_message(), I print the value of "result" to the console and it shows 64. To my understanding, this is the number opf bytes received. I then tested sending smaller messages in one transaction (45 bytes) and the value of the "result" variable changes to 45. But anytime I try to send buffers larger than 64 bytes, "result" stays at 64 bytes and the rest of the bytes are lost. 

    I made sure that the master I am using (an ESP32) has the same SPI config (speed, mode, word size, bit order. etc..). 

    Best,

    Kevin 

  • Hi Kevin,

    I see. I Have still not been able to reproduce, though. I took the sample you refered to and modified it a bit to send 270 bytes and the full 270 byte message is received on the slave side. This is the code I tested with on 2.5.2:

    If you don't make progress, can you share a logic analyzer trace of the SPI lines so that we can see if the master is actually sendign all the data (and if there are other things that stick out)?

Reply
  • Hi Kevin,

    I see. I Have still not been able to reproduce, though. I took the sample you refered to and modified it a bit to send 270 bytes and the full 270 byte message is received on the slave side. This is the code I tested with on 2.5.2:

    If you don't make progress, can you share a logic analyzer trace of the SPI lines so that we can see if the master is actually sendign all the data (and if there are other things that stick out)?

Children
  • Hi Einar,

    thank you so much for your help! All this time I thought maybe the isuue was on the nRF side, but it's actually on the master side (ESP32). It looks like the SPI FIFO on the ESP32 only allows for 64 bytes per transaction. Thanks for making me think about that! I will try to use another master or even use the nRF52840 as both master and slave (like in the example) to test this.

    Best regards,

    Kevin