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

nrfx_spim not enabled through sdk_config.h with SPI_ENABLED , NRFX_SPIM_ENABLED as NRFX_SPIM3_ENABLED is missing

Hi, had to modify this file 

SDK nRF5_SDK_15.3.0_59ac345 in file apply_old_config.h

line 818 

(SPI_ENABLED && (NRFX_SPIM0_ENABLED || NRFX_SPIM1_ENABLED || NRFX_SPIM2_ENABLED))

Should be

(SPI_ENABLED && (NRFX_SPIM0_ENABLED || NRFX_SPIM1_ENABLED || NRFX_SPIM2_ENABLED || NRFX_SPIM3_ENABLED))

Parents
  • Hi,

    apply_old_config.h is intended only for use with legacy drivers. SPIM3 is not supported by the legacy driver. If you want to use SPIM3, I would recommend completely removing the legacy SPI_ENABLE config from sdk_config.h and configure the nrfx_spim driver directly using NRFX_SPIM_ENABLE configs.

    Best regards,
    Jørgen

  • I think you misunderstood Einars answer. He is not saying that you should not use nrfx API, only that it is not necessarily required and that you should take care when using it together with the softdevice (as nrfx does not use softdevice APIs for clocks etc.) The softdevice does not use app_timer, app_timer is a SDK library. App_timer does not depend on the legacy driver either, as it use its own custom RTC driver.

    Einar also told you that you can use nrfx driver for SPIM:

    Einar Thorsrud said:

    Nicholas Lee said:

    How "exactly" are we supposed to implement the SPIM, PPI, GPIOTE, and Timer call-back functionality from our original project if we aren't allowed to use the NRFX drivers??

    Provided you stay away from TIMER0 and RTC0 neither of those peripherals have any conflict with the SoftDevice, so you can use the nrfx drivers out of the box. However, you will see that the higher level libraries we provide for SPI transactions. You must remember to use the SoftDevice API (or nrf_drv_timer) if you need to interact with the clocks.

    Best regards,
    Jørgen

  • Einar said the following perfectly clear things against using NRFX directly:

    "In fact, nrfx is a low-level driver layer, and for instance it does not handle the SoftDevice dependencies."

    and

    "Therefore using nrfx directly is not recommended and does not provide any benefits."

    and

    "I am painfully aware of the documentation suggesting that you use the nrfx API direclty. It has been reported internally and will hopefully be fixed at some point."

    Starting with the "Blinky app", I found was completely unable to use the SPIM3 module using nrf libraries, as that hardware does not seem to be supported, (i.e. NRFX_SPIM3_ENABLED  is missing)
    Once an app contains Bluetooth and the SoftCore, then the app_timer gets included which ties the code to the legacy configuration and the file "apply_old_config.h" gets included.

    By default, sdk_config.h includes a definition of SPI_ENABLED, and whether this is set to 0 or 1, the apply_old_config.h file undefines NRFX_SPI_ENABLED, and that prevents customers from using the NRFX module required to actually use the new SPIM3 hardware.
    I consider the use of "#ifdef" in the apply_old_config.h to be a software bug that needs fixing.
    This issue was reported here 10 months ago: https://devzone.nordicsemi.com/f/nordic-q-a/33944/nrfx_spi-instantiation-fails-using-nrfx-why/142878#142878


    This whole issue of two competing sets of drivers, and the massive over-use of macros is a complete mess, and it makes debugging a nightmare.

Reply
  • Einar said the following perfectly clear things against using NRFX directly:

    "In fact, nrfx is a low-level driver layer, and for instance it does not handle the SoftDevice dependencies."

    and

    "Therefore using nrfx directly is not recommended and does not provide any benefits."

    and

    "I am painfully aware of the documentation suggesting that you use the nrfx API direclty. It has been reported internally and will hopefully be fixed at some point."

    Starting with the "Blinky app", I found was completely unable to use the SPIM3 module using nrf libraries, as that hardware does not seem to be supported, (i.e. NRFX_SPIM3_ENABLED  is missing)
    Once an app contains Bluetooth and the SoftCore, then the app_timer gets included which ties the code to the legacy configuration and the file "apply_old_config.h" gets included.

    By default, sdk_config.h includes a definition of SPI_ENABLED, and whether this is set to 0 or 1, the apply_old_config.h file undefines NRFX_SPI_ENABLED, and that prevents customers from using the NRFX module required to actually use the new SPIM3 hardware.
    I consider the use of "#ifdef" in the apply_old_config.h to be a software bug that needs fixing.
    This issue was reported here 10 months ago: https://devzone.nordicsemi.com/f/nordic-q-a/33944/nrfx_spi-instantiation-fails-using-nrfx-why/142878#142878


    This whole issue of two competing sets of drivers, and the massive over-use of macros is a complete mess, and it makes debugging a nightmare.

Children
No Data
Related