DWM1001 SPI0 master interface

I need to use SPI0 master to communicate to external device. I followed the example of dwm-uart and the code is as follow. I complied the code and run it in debug mode. But the program will reset itself after running about 10 sec.
I found there are several posts regarding SPI master in the forum but there is no detail solution about it. Any help/hint is appreciated. Thanks.

#define SPI_SS_PIN 12 //## 29
#define SPI_MISO_PIN 27 //## 26
#define SPI_MOSI_PIN 23 //## 27
#define SPI_SCK_PIN 13 //## 28
static const nrf_drv_spi_t spi_user = NRF_DRV_SPI_INSTANCE(0); /* SPI instance. */
static nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
static volatile bool spi_xfer_done; /*Flag used to indicate that SPI instance completed the transfer. */

dwm_irq_t irqSPI0;
irqSPI0.vector_nr = 3;
irqSPI0.p_hndlr = dwm_irqSPI0_hndlr;
rv = dwm_interrupt_register(&irqSPI0);
if (rv == DWM_OK) {
spi_config.ss_pin = SPI_SS_PIN;
spi_config.miso_pin = SPI_MISO_PIN;
spi_config.mosi_pin = SPI_MOSI_PIN;
spi_config.sck_pin = SPI_SCK_PIN;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi_user, &spi_config, spi_event_handler));