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

SDK 15 software crash during SPI session.

Hi

After migration from SDK 14.0.0 to 15.0.0 our FW crashes during SPI session

We use EasyDMA , so we use SPIM driver directly without wrapper  nrf_drv_spi

The crash occurs in spim_xfer  function, immediately after spim_int_enable function calling.

We found some weird workaround. The problem disappears if we add delay in spim_xfer  function, immediately after  nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_START);

It looks like voodoo, so I would like to know what's going on and what's a write way to manage the problem appropriately.

Regards

Parents
  • Hi,

    1. What do you mean by crash? Do you get a hard fault or just some sort of assert? Are you debugging like this?
    2. How long is the delay that you add?
    3. How do you configure the SPIM? 
    4. What kind of interrupt priority does the SPIM use?
    5. Are you using a Softdevice?

     

  • 1. I get a hard fault.  PC  register  in  fault_info is 0x0000064B

    2. The minimum delay I have to add is 120 microseconds.

    3. SPIM configuration is as follows:

    NRFX_SPIM_ENABLED  1
    NRFX_SPIM0_ENABLED  1
    NRFX_SPIM1_ENABLED  1
    NRFX_SPIM2_ENABLED  1
    NRFX_SPIM3_ENABLED  0
    NRFX_SPIM_EXTENDED_ENABLED 0
    NRFX_SPIM_MISO_PULL_CFG    1
    NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY  7
    NRFX_SPIM_CONFIG_LOG_ENABLED 0
    NRFX_SPIM_CONFIG_LOG_LEVEL   3
    NRFX_SPIM_CONFIG_INFO_COLOR  0
    NRFX_SPIM_CONFIG_DEBUG_COLOR 0
    NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0

    p_config parameter of nrfx_spim_init function as follows:

    p_config->sck_pin             =0x13 
    p_config->mosi_pin           =0x14 
    p_config->miso_pin           =0x15 
    p_config->ss_pin               =0xFF 
    p_config->ss_active_high  =0  
    p_config->irq_priority         =0x07 
    p_config->orc                     =0xFF 
    p_config->frequency          =NRF_SPIM_FREQ_4M 
    p_config->mode                 =NRF_SPIM_MODE_0 
    p_config->bit_order            =NRF_SPIM_BIT_ORDER_MSB_FIRST

    4. Interrupt priority is 7

    5. We are using a Softdevice

    Regards

    1. Can you confirm that you are using the nRF52840?
    2. What Softdevice version is this? S140 v6.0.0?
    3. Is this happening on every call to spim_xfer? Or just once in a while?
    4. What else is going on at the time? Are you advertising, in a connection, etc.? Are you using the time slot API?

    The PC indicates that something goes wrong inside the Softdevice. The more context we get, the easier it will be to figure out why it asserts. 

     

  • 1. Yes, we are using the nRF52840

    2. Softdevice version is S140 v6.0.0

    3. This is happening on every call

    4. We still didn't add BLE functionality to our project, so we are not advertising, etc.

  • Does it mean that you have flashed the Softdevice to your device, but not initialized BLE at all? You said above that you are using a Softdevice. 

  • It's true. We've flashed the Softdevice to our device ( in fact it's EB  nRF52840-Preview-DK), but haven't called its API functions and not initialized it. 

    1. Have you tried without the Softdevice?
    2. Can you upload your project? Or at least the SPIM related parts? We can make the case private if you want confidentiality. 
Reply Children
Related