Good Morning,
I try to use the microcontroller nrf5340 to control a system of physiological measurements. For that i need to communicate in SPI with differents devices (ADS1298 and AFE4300). Everything is working fine for the ADS1298. But for the AFE4300 i have a problem when i use the function DEVICE_DT_GET(). Here is the beginning of the code in question, up to the device_dt_get() function call, and the corresponding overlay. I have indeed enabled SPI in the prj.conf file.
Beginning of the code :
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
#define LEDEXT6_NODE DT_ALIAS(ledext5)
#define LEDEXT7_NODE DT_ALIAS(ledext5)
#define RESETAFE DT_ALIAS(ledext6)
#define DRDYAFE DT_ALIAS(ledext7)
static const struct gpio_dt_spec resetafe = GPIO_DT_SPEC_GET(RESETAFE, gpios);
static const struct gpio_dt_spec drdyafe = GPIO_DT_SPEC_GET(DRDYAFE, gpios);
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
struct device * spi1_dev = DEVICE_DT_GET(my_spi_master);
struct spi_cs_control spim_cs = {
.gpio = SPI_CS_GPIOS_DT_SPEC_GET(DT_NODELABEL(reg_my_spi_master)),
.delay = 0,
};
overlay :
&pinctrl {
spi_master_default: spi_master_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
<NRF_PSEL(SPIM_MOSI, 0, 7)>,
<NRF_PSEL(SPIM_MISO, 0, 25)>;
};
};
spi_master_sleep: spi_master_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 6)>,
<NRF_PSEL(SPIM_MOSI, 0, 7)>,
<NRF_PSEL(SPIM_MISO, 0, 25)>;
low-power-enable;
};
};
};
my_spi_master: &spi4 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi_master_default>;
pinctrl-1 = <&spi_master_sleep>;
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
reg_my_spi_master: spi-dev-a@0 {
reg = <0>;
};
};