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.
