Hello, I am currently working with NRF5340-DK dev kit and I want to use 2 SPI devices connected on the same SPI bus OR use 2 different SPI instances, however none of these 2 approaches is working. This is my overlay file when trying to use the same SPI bus for two devices:
&spi4 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi4_default>;
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>,
<&gpio1 10 GPIO_ACTIVE_LOW>;
canbus0:mcp2515@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
status = "okay";
sample-point = <750>;
reg = <0x0>;
osc-freq = <20000000>;
bus-speed = <500000>;
#address-cells = <1>;
#size-cells = <0>;
};
canbus1: mcp2515@1 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
status = "okay";
sample-point = <750>;
reg = <0x1>;
osc-freq = <20000000>;
bus-speed = <500000>;
#address-cells = <1>;
#size-cells = <0>;
};
};
When I try to compile I get this:
devicetree error: pinctrl-names property in /soc/peripheral@50000000/spi@a000 in /home/portilha/ncs/v2.6.99-cs2/zephyr/misc/empty_file.c has 1 strings, expected 2 strings
The other approach was to use SPI4 and SPI3. For SPI4 its all good, however when I try to use the SPI3 pins that I've defined it does not work properly. Is there any problem with the chosen pins? They don´t conflict with any other in use peripheral:
&spi3 {
status = "okay";
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi3_default>;
pinctrl-names = "default";
canbus: mcp2515@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
status = "okay";
sample-point = <750>;
reg = <0x0>;
osc-freq = <20000000>;
bus-speed = <500000>;
#address-cells = <1>;
#size-cells = <0>;
};
};
&pinctrl {
spi4_default: spi4_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
<NRF_PSEL(SPIM_MOSI, 1, 13)>,
<NRF_PSEL(SPIM_MISO, 1, 14)>;
};
};
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
<NRF_PSEL(SPIM_MOSI, 0, 10)>,
<NRF_PSEL(SPIM_MISO, 0, 2)>;
};
};
};
Can anybody help?
BR