I'm trying to use the SPIM driver on nRF52832. The setup is:
Chip: nRF52832
SDK: 15
Softdevice: s132 v6
Toolchain: GCC
For some reason the call to nrfx_spim_xfer never returns.
The code:
This is what I get in the RTT logger:
0> <info> app: Setting vector table to bootloader: 0x00078000
0> <info> app: Setting vector table to main app: 0x00026000
0> <info> SPIM: Function: nrfx_spim_init, error code: NRF_SUCCESS.
0> <info> app: manual xfer
I've tried to where exactly it got stuck with GDB, so I ran it and stopped the program manually after a few seconds (I've tried it multiple times and got the same results):
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0002dd16 in nrf_spim_event_check (p_reg=0x40003000, spim_event=NRF_SPIM_EVENT_END)
at D:/nrf/nRF5_SDK_15.0.0_a53641a/modules/nrfx/hal/nrf_spim.h:525
525 return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_event);
(gdb) list
520 }
521
522 __STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_reg,
523 nrf_spim_event_t spim_event)
524 {
525 return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)spim_event);
526 }
527
528 __STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_reg,
529 nrf_spim_event_t spim_event)
(gdb) bt
#0 0x0002dd16 in nrf_spim_event_check (p_reg=0x40003000, spim_event=NRF_SPIM_EVENT_END)
at D:/nrf/nRF5_SDK_15.0.0_a53641a/modules/nrfx/hal/nrf_spim.h:525
#1 0x0002e464 in spim_xfer (p_spim=0x40003000, p_cb=0x20002dac <m_cb>, p_xfer_desc=0x2000ffb8, flags=0)
at D:/nrf/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_spim.c:509
#2 0x0002e59e in nrfx_spim_xfer (p_instance=0x39c6c <_spi_instance>, p_xfer_desc=0x2000ffb8, flags=0)
at D:/nrf/nRF5_SDK_15.0.0_a53641a/modules/nrfx/drivers/src/nrfx_spim.c:593
#3 0x00036d32 in main () at src/main.c:1036
(gdb)
Looks like the SPIM driver gets stuck waiting for NRF_SPIM_EVENT_END event?
By the way, looking with an oscilloscope on the relevant pins I see no traffic except for the chip select pin.
I ran this test both on our custom PCB (where the SPI slave chip was connected) and on the PCA10040 eval board, both showed the exact same results.