This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI handler getting triggered when spi is not running?

Hi,

I've built a project out of the USBD_ACM_CDC example in which I have added a SPI master driver. This project has a timer interrupt that will shoot off every ~500us and trigger a 520 bit SPI transfer. The received packets undergo *very* minor processing and are spit out over USB to my host computer.

So it seems like I'm getting all the packets I expect, only I'm also getting 6 extra invalid packets with every valid packet. Here's a screenshot of my terminal from when I'm just transferring a hex counter:

The counter is incrementing so those bits are all fine. As you can see there are consistently 6 extra invalid packets (the FFs). If I slow down how often I shoot off SPI transfers, these invalid packets will disappear, but that doesn't make too much sense. Right now it seems like the SPI handler is being called erroneously. Does anyone have insight into where these are coming from? I looked at the SPI wires with an oscope and couldn't see any issues.

  • Sorry, I should have mentioned that! I have indeed disconnected the FPGA and am just working with two NRF52 dev kits. One is operating as a slave and is logging data over UART. The other dev kit has a SPI_master + USB driver running on it.

    I'll tie the MISO line to GND as a sanity check.

    Could it be that that leaving logging enabled on the SPI is slowing down the slave's response? The SPI should be controlled via hardware so maybe that doesn't make sense.  

    Edit: It was indeed related to logging. Setting the slave's NRF_LOG_ENABLED to 0 fixed everything!

Related