jagath
February 22, 2022, 11:44am
1
Hello,
We are using Decawave DWM3020 module V1.2 with Nordic NRF52840 and source code version API_rev9p3. While running example read ID control is getting hang in
while(!spi_xfer_done); inside the readfromspi() function
SPI event handler is not getting called.
The same Decawave DWM3020 module is working properly with STM32F429 nucleo.
Is there any hardware or software changes is need to done to work with DWM3020 module with Nordic NRF52840?
Thanks
Jagath
Hi Jagath,
Not sure if you resolved the issue. I wasted half a day and then made some changes that worked for me.
Here is what I changed:
from main.c, go into the definition of this function
/* Initialise the SPI for nRF52840-DK */
nrf52840_dk_spi_init();
Change the function definition to use SPI0. I have left the origional values as comments so you can see what I changed.
void nrf52840_dk_spi_init(void)
{
nrf_drv_spi_t *spi_inst;
nrf_drv_spi_config_t *spi_config;
pgSpiHandler.frequency_slow = NRF_SPIM_FREQ_4M;
pgSpiHandler.frequency_fast = NRF_SPIM_FREQ_32M;
pgSpiHandler.csPin = DW3000_CS_Pin;
pgSpiHandler.lock = DW_HAL_NODE_UNLOCKED;
spi_inst = &pgSpiHandler.spi_inst;
spi_config = &pgSpiHandler.spi_config;
spi_inst->inst_idx = SPI0_INSTANCE_INDEX; //SPI3_INSTANCE_INDEX;
spi_inst->use_easy_dma = SPI0_USE_EASY_DMA; //SPI3_USE_EASY_DMA;
spi_inst->u.spim.p_reg = NRF_SPIM0; //NRF_SPIM3;
spi_inst->u.spim.drv_inst_idx = NRFX_SPIM0_INST_IDX; //NRFX_SPIM3_INST_IDX;
spi_config->sck_pin = DW3000_CLK_Pin;
spi_config->mosi_pin = DW3000_MOSI_Pin;
spi_config->miso_pin = DW3000_MISO_Pin;
spi_config->ss_pin = DW3000_CS_Pin;
spi_config->irq_priority = (APP_IRQ_PRIORITY_MID - 2);
spi_config->orc = 0xFF;
spi_config->frequency = pgSpiHandler.frequency_slow;
spi_config->mode = NRF_DRV_SPI_MODE_0;
spi_config->bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;
port_set_dw_ic_spi_slowrate();
}
After this the code executes fine.
Hope this helps
Noaman