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
  • I'd like to re-open this thread.  In our system we are using SPIM3 under SDK15.0 on nRF52840 and it's been working fine with no issues.  But, we start SD140, the first attempt to call nrfx_spim_xfer() will cause a hard fault.  If the SD140 isn't initialized, then everything works perfectly.  SPIM3 has been fully initialized before the SD140 is started.

    Looking at the resource usage document for SD140 6.0.0, it shows SPIM3 as completely open, so this behavior is unexpected.

    Perhaps an issue with interrupts or DMA?

    From sdk_config.h:

    #define NRFX_SPIM3_ENABLED 1
    #define NRFX_SPIM_EXTENDED_ENABLED 0

    CFLAGS += -DNRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED

Reply
  • I'd like to re-open this thread.  In our system we are using SPIM3 under SDK15.0 on nRF52840 and it's been working fine with no issues.  But, we start SD140, the first attempt to call nrfx_spim_xfer() will cause a hard fault.  If the SD140 isn't initialized, then everything works perfectly.  SPIM3 has been fully initialized before the SD140 is started.

    Looking at the resource usage document for SD140 6.0.0, it shows SPIM3 as completely open, so this behavior is unexpected.

    Perhaps an issue with interrupts or DMA?

    From sdk_config.h:

    #define NRFX_SPIM3_ENABLED 1
    #define NRFX_SPIM_EXTENDED_ENABLED 0

    CFLAGS += -DNRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED

Children
  • We also have seen this again, in a different context, but haven't had time to create a simple test program. The anomaly 198 workaround must be enabled to produce the failure.

    Just now I found this in release_notes.txt for SDK 15.3.0, under known issues, there's this warning:

    - The workaround for Anomaly 198 for nRF52840 SPIM3 peripheral that has been implemented in nrfx_spim cannot be used with a SoftDevice.
    Flag NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED must be set to zero.
    The workaround based on a dedicated RAM block for SPIM3 must be used instead.

  • Creating a dedicated transfer buffer for SPIM3 transfers and locating it in RAM3.section1, and having our app RAM start at RAM5.section0 seems to resolve the issue.  I've removed the 198 workaround from CFLAGS.  SD140 and SPIM3 both seem to work now as expected.

    source file:

    uint8_t rx_buf[RX_BUF_SIZE] __attribute__((section(".spim3_safe")));
    uint8_t tx_buf[TX_BUF_SIZE] __attribute__((section(".spim3_safe")));

    .LD file:

    MEMORY
    {
    FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xda000
    RAM_SPIM3 (rwx) : ORIGIN = 0x20007000, LENGTH = 0x03000
    RAM (rwx) : ORIGIN = 0x2000A000, LENGTH = 0x35F00
    RAM_NOINIT (rwx) : ORIGIN = 0x2003FF00, LENGTH = 0x00100
    }

    SECTIONS
    {
    . = ALIGN(4);
    .spim3_safe (NOLOAD) :
    {
    } > RAM_SPIM3
    .mem_section_dummy_ram :
    {
    }
    .log_dynamic_data :
    {
    PROVIDE(__start_log_dynamic_data = .);
    KEEP(*(SORT(.log_dynamic_data*)))
    PROVIDE(__stop_log_dynamic_data = .);
    } > RAM
    .fs_data :
    {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
    } > RAM
    .noinit (NOLOAD) :
    {
    } > RAM_NOINIT

    } INSERT AFTER .data;

Related