NRF54L15: BLE Softdevice and SPIM20?

Hi,

I am using bare metal SDK v1.0.0. On my prototype, I want to use BLE softdevice together with SPIM20 peripheral, physically connected to Port 2. Starting from the BLE example, I have added SPIM20 in my projectconf and commented out the node deletion in bm_nrf54l15dk_nrf54l051015_peripherals.dtsi, because defining a new SPI node in an overlay also didn't work for me. It's building, but on start, the mcu is stuck after some initial output logs. If I comment out the nrfx_spim_init, BLE works just fine. 

This is my bm_nrf54l15dk.overlay:

&lfxo {
    status = "disabled";
};

    &pinctrl {
    /omit-if-no-ref/ spi20_default: spi20_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
        };
    };

    /omit-if-no-ref/ spi20_sleep: spi20_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;
            low-power-enable;
        };
    };
};

&spi20 {
    status="okay";
    pinctrl-0 = <&spi20_default>;
    pinctrl-1 = <&spi20_sleep>;
    pinctrl-names = "default", "sleep";
};

This is my SPI init code:

	nrfx_spim_t spim_instance = NRFX_SPIM_INSTANCE(NRF_SPIM20);

	nrfx_spim_config_t spim_config = NRFX_SPIM_DEFAULT_CONFIG(APP_SPIM_SCK_PIN,
									 APP_SPIM_MOSI_PIN,
									 APP_SPIM_MISO_PIN,
									 APP_SPIM_SS_PIN);

	spim_config.frequency = NRFX_MHZ_TO_HZ(2);
	spim_config.mode = NRF_SPIM_MODE_1;
	spim_config.use_hw_ss = false;
	spim_config.irq_priority = 6;  // Must be 0-3 for SoftDevice compatibility on nRF54L15

	LOG_INF("Initializing SPIM20...");
	err = nrfx_spim_init(&spim_instance, &spim_config, NULL, NULL);
	if (err) {
		if (err == -EBUSY) {
			LOG_INF("Failed to enable SPIM, err %d (instance busy: peripheral conflict)", err);
		} else {
			LOG_INF("Failed to enable SPIM, err %d", err);
		}
		while (true) {
			k_busy_wait(1000 * USEC_PER_MSEC);
		}
	}
	LOG_INF("SPIM20 initialized successfully");

As SPIM21, e.g., works just fine, is there any general restriction on using SPIM20 together with softdevice? How to properly set it up in the overlay file? 

Thanks for you support and let me know if you need any additional information.

Parents
  • Dear Vidar,

    thanks for the quick reply. Unfortunately, this doesn't resolve the issue, as I am using RTT and UART logging was already deactivated. Here is related part of my prj.conf (rest is just from the BLE example): 

    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_BM_UARTE=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_USE_SEGGER_RTT=y
    
    CONFIG_NRFX_SPIM=y

    Do you have other suggestions?

    Thanks,

    Philipp

Reply
  • Dear Vidar,

    thanks for the quick reply. Unfortunately, this doesn't resolve the issue, as I am using RTT and UART logging was already deactivated. Here is related part of my prj.conf (rest is just from the BLE example): 

    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_BM_UARTE=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_USE_SEGGER_RTT=y
    
    CONFIG_NRFX_SPIM=y

    Do you have other suggestions?

    Thanks,

    Philipp

Children
  • Dear Philipp,

    You also have the console which will print the boot banner on startup before the logger is enabled (Note: console is selected by default by the board file). Please try with the following configuration in your project configuration (prj.con):

    CONFIG_LOG=n
    CONFIG_LOG_BACKEND_BM_UARTE=n
    CONFIG_CONSOLE=n
    CONFIG_BM_UARTE_CONSOLE=n
    CONFIG_NCS_BARE_METAL_BOOT_BANNER=n

    You may also look at the .config output to verify what configurations are applied to your build.

    Best regards,

    Vidar

Related