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

known SPIM limits? Or issues with SPIM and segger RTT?

snip

  • Hello, 

    What kind of error code do you get from debugging? Could you please add your code as well? 

    Thanks! 

    Kind regards,
    Øyvind

  • Based on the debug information you have given, and your project, the error seems to come from line 180 (0xB4) in COMP-adxl372_spi.c which gives error_code 17 (0x11). This equals NRF_ERROR_BUSY.

    ret = nrfx_spim_xfer(&spi, &xfer_desc, 0);
    APP_ERROR_CHECK(ret);
    

    /**
     * @brief Function for starting the SPI data transfer.
     *
     * Additional options are provided using the @c flags parameter:
     *
     * - @ref NRFX_SPIM_FLAG_TX_POSTINC and @ref NRFX_SPIM_FLAG_RX_POSTINC<span></span>:
     *   Post-incrementation of buffer addresses. Supported only by SPIM.
     * - @ref NRFX_SPIM_FLAG_HOLD_XFER<span></span>: Driver is not starting the transfer. Use this
     *   flag if the transfer is triggered externally by PPI. Supported only by SPIM. Use
     *   @ref nrfx_spim_start_task_get to get the address of the start task.
     * - @ref NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER<span></span>: No user event handler after transfer
     *   completion. This also means no interrupt at the end of the transfer. Supported only by SPIM.
     *   If @ref NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER is used, the driver does not set the instance into
     *   busy state, so you must ensure that the next transfers are set up when SPIM is not active.
     *   @ref nrfx_spim_end_event_get function can be used to detect end of transfer. Option can be used
     *   together with @ref NRFX_SPIM_FLAG_REPEATED_XFER to prepare a sequence of SPI transfers
     *   without interruptions.
     * - @ref NRFX_SPIM_FLAG_REPEATED_XFER<span></span>: Prepare for repeated transfers. You can set
     *   up a number of transfers that will be triggered externally (for example by PPI). An example is
     *   a TXRX transfer with the options @ref NRFX_SPIM_FLAG_RX_POSTINC,
     *   @ref NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER, and @ref NRFX_SPIM_FLAG_REPEATED_XFER. After the
     *   transfer is set up, a set of transfers can be triggered by PPI that will read, for example,
     *   the same register of an external component and put it into a RAM buffer without any interrupts.
     *   @ref nrfx_spim_end_event_get can be used to get the address of the END event, which can be
     *   used to count the number of transfers. If @ref NRFX_SPIM_FLAG_REPEATED_XFER is used,
     *   the driver does not set the instance into busy state, so you must ensure that the next
     *   transfers are set up when SPIM is not active. Supported only by SPIM.
     *
     * @note Peripherals using EasyDMA (including SPIM) require the transfer buffers
     *       to be placed in the Data RAM region. If this condition is not met,
     *       this function will fail with the error code NRFX_ERROR_INVALID_ADDR.
     *
     * @param p_instance  Pointer to the driver instance structure.
     * @param p_xfer_desc Pointer to the transfer descriptor.
     * @param flags       Transfer options (0 for default settings).
     *
     * @retval NRFX_SUCCESS             If the procedure was successful.
     * @retval NRFX_ERROR_BUSY          If the driver is not ready for a new transfer.
     * @retval NRFX_ERROR_NOT_SUPPORTED If the provided parameters are not supported.
     * @retval NRFX_ERROR_INVALID_ADDR  If the provided buffers are not placed in the Data
     *                                  RAM region.
     */
    nrfx_err_t nrfx_spim_xfer(nrfx_spim_t const * const     p_instance,
                              nrfx_spim_xfer_desc_t const * p_xfer_desc,
                              uint32_t                      flags);

    NRFX_ERROR_BUSY = If the driver is not ready for a new transfer. Which again means you need to check your code.
  • thanks, I found the problem... 

    can we remove or private this thread now please? I'd prefer the code wasn't shared publicly

Related