4 years, 7 months ago.

stuck at nrf_spim_task_trigger

Hi,

When I try spi commnucation with a sensor on nrf52840 (using Mbed OS with SDK14.2), it stuck to nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_START); while spim_xfer is called.

I mean uart debug log stopped right before nrf_spim_task_trigger().

Any clue about this problem? or was there any similar issue to this? I actually resolved this issue with using M-bed api instead of nordic api but I am still very curious about why it happens.

Here is the code I am using.

SPIM enabled

  1. define SPI_INSTANCE 0 /< SPI instance index. */ static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /< SPI instance. */ nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; spi_config.frequency = SENSOR_DEFAULT_SPI_FREQUENCY;

spi_config.ss_pin = A111_SPI_CS_N_Pin; spi_config.miso_pin = A111_SPI_MISO_Pin; spi_config.mosi_pin = A111_SPI_MOSI_Pin; spi_config.sck_pin = A111_SPI_CLK_Pin; APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spim_event_handler, NULL));

nrf_gpio_cfg(spi_config.sck_pin, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_CONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_H0H1, NRF_GPIO_PIN_NOSENSE); nrf_drv_spi_transfer(&spi, tx_buffer, buffer_size, buffer, buffer_size);

Thank you.

Be the first to answer this question.