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

SPIM transfer crashing on nRF5340

Hi,

I'm developing a program using SPIM instance 1 on nRF5340 PDK, with nRF Connect SDK 1.4.0. 

The problem I met is exactly the same as this post. If I want to use a handler, the SPI transfer will crash.

However, it seems I can not solve this problem on nRF5340 like the post above, as there is no nrfx_irqs header file for nRF5340 in the nrfx library. 

So, is there any workaround to solve this?

  • Hi,

    Sorry for not getting back to you sooner on this issue.

    You can find a working nrfx SPIM example with handler in this post. I tested the example by building it for nrf5340dk_nrf5340_cpuapp target, but I had to modify one function in main.c to the following:

    static void manual_isr_setup()
    {
    #if defined(NRF9160_XXAA)
    	IRQ_DIRECT_CONNECT(UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn, 0,
    			   nrfx_spim_1_irq_handler, 0);
    	irq_enable(UARTE1_SPIM1_SPIS1_TWIM1_TWIS1_IRQn);
    
    #elif defined(NRF5340_XXAA)
    	IRQ_DIRECT_CONNECT(SPIM1_SPIS1_TWIM1_TWIS1_UARTE1_IRQn, 0,
    			   nrfx_spim_1_irq_handler, 0);
    	irq_enable(SPIM1_SPIS1_TWIM1_TWIS1_UARTE1_IRQn);
    #else
    	IRQ_DIRECT_CONNECT(SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, 0,
    			   nrfx_spim_1_irq_handler, 0);
    	irq_enable(SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn);
    #endif
    }

    Can you check if you are able to use this example?

    Best regards,
    Jørgen

  • Thanks, Jørgen. With your code above, now I can get into a SPI handler successfully. 

Related