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
  • Hi,

    The error you received corresponds to 0x0BAD0000, which is the default value for NRFX_SUCCESS. What you are missing is the the glue layer that redefines the NRFX error codes to nRF5 SDK error codes.

    Not sure how you was able to compile without warning if you did not include the path to the headers, as nrfx_glue.h should be included by nrfx.h, which again is included by nrfx_spim.h. Unless of course, you provided the path to the template nrfx_glue.h file in modules\nrfx\templates, which should not be used with nRF5 SDK.

    Best regards,
    Jørgen

  • Hey! 
    Yeah, i did have stuff from template (nrfx_config.h) which was doing some bad business there to my sdk_config. So I removed it... and got another error. 

    At the end, I restored from a previous commit and was more careful on getting the includes. SPIM is now working, but I am still unable to use Termite to view the log (just the segger intern  log output).

    if this annoyes me much i will ask in a new ticket;)

    thanks! 

Reply Children
No Data
Related