spi_transceive blocks indefinitely at spi_context_wait_for_completion

I've created a new sandbox project for a nRF9160DK that requires a SPI Master for testing a Flash part. Since I already have "working" SPIM code in a different Segger project, I just copied that code to the new project. Unfortunately, when I run the new project, it just hangs at the spi_context_wait_for_completion() call at line 241 in the spi_nrfx_spim.c source file (see attached screenshot). I copied over the same C-source file, prj.conf file and nrf9160dk_nrf9160_ns.overlay file that I use in my other project. And that project is working perfectly. So I'm surprised that one project works and the other doesn't with almost identical code. I have read several topics of developers reporting the same blocking condition, but I'm not seeing any solutions. 

I have attached the prj.conf and overlay file and a screenshot. Please let me know what else I can check. I'm sure it must be a config issue as my SPIM code is identical in both projects.

7215.prj.conf8875.nrf9160dk_nrf9160_ns.overlay

  • Hi

    What exactly are the differences between the two projects? As there must be some for one project to work, and for the other to halt in this wait for completion. This generally means that the device is not able to either transmit or receive data from the SPI device. Are you sure the SPI device is connected correctly to the nRF9160 DK and that those pins are configured correctly in your project?

    Best regards,

    Simon

  • From a source code standpoint, there is no difference between the 2 projects. And while I agree it doesn't make sense, it is happening. Out of desperation, I went back to a SPI ticket you and I worked on a couple of months ago. I downloaded that code. Copied it into a blinky example using SDK v1.9.1 and ended up with the same result, spi_transceive just hangs. I have attached my sample code and a screenshot from my LA. Line 0 is CS, Line 1 is SCLK, 2 and 3 are MOSI and MISO. The LA trace looks very strange, the clock is really irregular, there is no activity on MOSI/MISO and the delays to assert/deassert CS are so long my cheap scope won't capture it. 

    BTW, I am using Windows 11 for this development. Have you heard of any issues with J-Link and Windows 11? 

    As always I appreciate your help and insight.22600.sample.zip

  • Hello,

    Can you send the whole project for which you are getting right data on LA and the current one which is proving you the error?  We would like to compare and check (with LA) the projects from our side. I assume there may be something wrong with the pin number which leads to this non accurate behavior on logic analyzer. 

    Best Regards,

    Kazi Afroza Sultana

Related