Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPIM not Calling Specified EVT Handler Upon Completion

Howdy,

I am using NRF5 SDK v15.0.0 on an nRF52810 custom PCB and am having a problem where the specified event handler is not being called upon completion of an SPIM transfer.  Using a scope I can see that the transfer is occuring, but then the code gets caught at line 319 of arm_startup_nrf52810.s.  I may be reading this incorrectly, but it looks like a default IRQ handler...

The relevant portion of my sdk_config.h file (all legacy driver definitions were removed):

// <e> NRFX_SPIM_ENABLED - nrfx_spim - SPIM peripheral driver
//==========================================================
#ifndef NRFX_SPIM_ENABLED
#define NRFX_SPIM_ENABLED 1
#endif
// <q> NRFX_SPIM0_ENABLED  - Enable SPIM0 instance
 

#ifndef NRFX_SPIM0_ENABLED
#define NRFX_SPIM0_ENABLED 1
#endif

Relevant SPI initialization code and SPI EVT handler code:

#define SPI_INSTANCE                        0

volatile uint8_t         spiActive        = SPI_MSG_IDLE;
volatile spi_pending_t   spiPending;
volatile uint8_t         spiTX[SPI_BUFFER_SIZE];
volatile uint8_t         spiRX[SPI_BUFFER_SIZE];

static const nrfx_spim_t spiMaster        = NRFX_SPIM_INSTANCE(SPI_INSTANCE);
static bool volatile     spiXferComplete  = false;


void spi_event_handler(nrfx_spim_evt_t const *event, void *context);

uint8_t _send_spi_message(uint8_t message);

void spi_init(void)
{
  uint32_t error;
  nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG;
                                
  config.sck_pin    = SPI0_CONFIG_SCK_PIN;
  config.miso_pin   = SPI0_CONFIG_MISO_PIN;
  config.mosi_pin   = SPI0_CONFIG_MOSI_PIN;
  
  error             = nrfx_spim_init(&spiMaster, &config, spi_event_handler, NULL);
  APP_ERROR_CHECK(error);
  
  spiPending.all = 0x0000;
}

void spi_event_handler(nrfx_spim_evt_t const *event, void *context)
{
  if(event->type == NRFX_SPIM_EVENT_DONE)
  {
    spiXferComplete = true;
    TASK_SET_SPI_COMPLETE();
  }
}

Location where it hangs (hangs at the "B ." at the end):

Default_Handler PROC

                EXPORT   POWER_CLOCK_IRQHandler [WEAK]
                EXPORT   RADIO_IRQHandler [WEAK]
                EXPORT   UARTE0_IRQHandler [WEAK]
                EXPORT   TWIM0_TWIS0_IRQHandler [WEAK]
                EXPORT   SPIM0_SPIS0_IRQHandler [WEAK]
                EXPORT   GPIOTE_IRQHandler [WEAK]
                EXPORT   SAADC_IRQHandler [WEAK]
                EXPORT   TIMER0_IRQHandler [WEAK]
                EXPORT   TIMER1_IRQHandler [WEAK]
                EXPORT   TIMER2_IRQHandler [WEAK]
                EXPORT   RTC0_IRQHandler [WEAK]
                EXPORT   TEMP_IRQHandler [WEAK]
                EXPORT   RNG_IRQHandler [WEAK]
                EXPORT   ECB_IRQHandler [WEAK]
                EXPORT   CCM_AAR_IRQHandler [WEAK]
                EXPORT   WDT_IRQHandler [WEAK]
                EXPORT   RTC1_IRQHandler [WEAK]
                EXPORT   QDEC_IRQHandler [WEAK]
                EXPORT   COMP_IRQHandler [WEAK]
                EXPORT   SWI0_EGU0_IRQHandler [WEAK]
                EXPORT   SWI1_EGU1_IRQHandler [WEAK]
                EXPORT   SWI2_IRQHandler [WEAK]
                EXPORT   SWI3_IRQHandler [WEAK]
                EXPORT   SWI4_IRQHandler [WEAK]
                EXPORT   SWI5_IRQHandler [WEAK]
                EXPORT   PWM0_IRQHandler [WEAK]
                EXPORT   PDM_IRQHandler [WEAK]
POWER_CLOCK_IRQHandler
RADIO_IRQHandler
UARTE0_IRQHandler
TWIM0_TWIS0_IRQHandler
SPIM0_SPIS0_IRQHandler
GPIOTE_IRQHandler
SAADC_IRQHandler
TIMER0_IRQHandler
TIMER1_IRQHandler
TIMER2_IRQHandler
RTC0_IRQHandler
TEMP_IRQHandler
RNG_IRQHandler
ECB_IRQHandler
CCM_AAR_IRQHandler
WDT_IRQHandler
RTC1_IRQHandler
QDEC_IRQHandler
COMP_IRQHandler
SWI0_EGU0_IRQHandler
SWI1_EGU1_IRQHandler
SWI2_IRQHandler
SWI3_IRQHandler
SWI4_IRQHandler
SWI5_IRQHandler
PWM0_IRQHandler
PDM_IRQHandler
                B .

Everything compiles fine (no warnings), it just doesn't call the spi_event_handler() with the DONE event...  Any help would be appreciated.

Thanks,

-F

Related