SPI device tree setup nRF54L15

Could anyone help me out with this issue? I can't seem to get SPI_DT_SPEC_GET arguments correct. when I hover over the macro it says identifier "__device_dts_ord_DT_N_S_soc_S_peripheral_40000000_S_spi_4a000_BUS_ORD" is undefined but i check the compiled devicetree and the overlay is applied correctly. using nRF54L15 if that helps main:
#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(module);

#define SPI_NODE DT_ALIAS(myspi)

static const struct spi_dt_spec spi = SPI_DT_SPEC_GET(SPI_NODE, (SPI_OP_MODE_MASTER | SPI_MODE_CPHA | SPI_MODE_CPOL | SPI_TRANSFER_LSB), 3);

int main(void)
{
if (!device_is_ready(spi.bus)){
LOG_ERR("SPI bus not ready!");
return 0;
}
}
#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(module);

#define SPI_NODE DT_ALIAS(myspi)

static const struct spi_dt_spec spi = SPI_DT_SPEC_GET(SPI_NODE, (SPI_OP_MODE_MASTER | SPI_MODE_CPHA | SPI_MODE_CPOL | SPI_TRANSFER_LSB), 3);

int main(void)
{
if (!device_is_ready(spi.bus)){
LOG_ERR("SPI bus not ready!");
return 0;
}
}
overlay:
&spi00 {
status = "okay";
pinctrl-0 = <&spi00_default>;
pinctrl-1 = <&spi00_sleep>;
pinctrl-names = "default", "sleep";
max-frequency = <DT_FREQ_M(2)>;
cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
};

&spi00_default {
group1 {
psels = <NRF_PSEL(SPIM_MISO, 2, 4)>, <NRF_PSEL(SPIM_MOSI, 2, 2)>;
};
group2 {
psels = <NRF_PSEL(SPIM_SCK, 2, 1)>;
bias-pull-up;
};
};

/ {
aliases{
myspi = &spi00;
};
};
&spi00 {
status = "okay";
pinctrl-0 = <&spi00_default>;
pinctrl-1 = <&spi00_sleep>;
pinctrl-names = "default", "sleep";
max-frequency = <DT_FREQ_M(2)>;
cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
};

&spi00_default {
group1 {
psels = <NRF_PSEL(SPIM_MISO, 2, 4)>, <NRF_PSEL(SPIM_MOSI, 2, 2)>;
};
group2 {
psels = <NRF_PSEL(SPIM_SCK, 2, 1)>;
bias-pull-up;
};
};

/ {
aliases{
myspi = &spi00;
};
};
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?