This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPIM crashing at NRF_Breakpoint_Cond right after APP_ERROR_CHECK(nrfx_spim_init(...))

Hello Nordic, 

I am having an issue with the SPIM, i wanted to eliminate all unnecessary files so I started a project from Zero (Segger: new project: A cc++ solution for  nordic ...  ) I added the stuff i needed and was required by the compiler, and other than not being able to connect the log to termite, everything was ok. 

Now comes the SPIM part, as i did not want to use the deprecated SPI version...

#include "nrfx_spim.h"
#include "boards.h"
#include "sdk_config.h"
#include "app_error.h"
#include "app_error_weak.h"
#include "spi_driver.h"

#include "nrf_delay.h"

#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"

...
...
...

int main( void){
 
  APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
  NRF_LOG_DEFAULT_BACKENDS_INIT();

  nrfx_spim_xfer_desc_t xfer_descriptor = NRFX_SPIM_XFER_TRX(m_tx_buf, m_length, m_rx_buf, m_length);

  nrfx_spim_config_t spi_0_config = NRFX_SPIM_DEFAULT_CONFIG;
  spi_0_config.frequency      = NRF_SPIM_FREQ_1M;
  spi_0_config.ss_pin         = SPI_0_SS_PIN;
  spi_0_config.miso_pin       = SPI_0_MISO_PIN;
  spi_0_config.mosi_pin       = SPI_0_MOSI_PIN;
  spi_0_config.sck_pin        = SPI_0_SCK_PIN;
  //spi_0_config.use_hw_ss      = true;
  spi_0_config.ss_active_high = false;
  APP_ERROR_CHECK(nrfx_spim_init(&spi, &spi_0_config, spim_event_handler, NULL));

Problem is, it runs until 

 p_cb->transfer_in_progress = false;
    p_cb->state = NRFX_DRV_STATE_INITIALIZED;

I can see that p_cb->state changes to initialized, debug returns to main, as if it wanted to now check the app_error_check ... and dies.

error reports]: 

<error> app: ERROR 195887104 [Unknown error code] at ...\workspace_NORDIC\Nordic_Devs_Feb\main.c:69
PC at: 0x00000559


<error> app: End of error report

Any clue what could it be? 

is there a view option where i can see if the SPI is really being configured?

Board is the nRF52 52832

Parents
  • Your include files & configuration look OK, from what I can see...

    is there a view option where i can see if the SPI is really being configured?

    In sdk_config.h, you can enable NRFX_SPIM_CONFIG_LOG_ENABLED and set NRFX_SPIM_CONFIG_LOG_LEVEL to Debug to get more detailed logs. Maybe that will give a clue...

    When I do that, I get only 1 additional log line:

    <info> SPIM: Function: nrfx_spim_init, error code: NRF_SUCCESS

Reply
  • Your include files & configuration look OK, from what I can see...

    is there a view option where i can see if the SPI is really being configured?

    In sdk_config.h, you can enable NRFX_SPIM_CONFIG_LOG_ENABLED and set NRFX_SPIM_CONFIG_LOG_LEVEL to Debug to get more detailed logs. Maybe that will give a clue...

    When I do that, I get only 1 additional log line:

    <info> SPIM: Function: nrfx_spim_init, error code: NRF_SUCCESS

Children
No Data
Related