We are currently evaluating using the nRF52840 device in conjunction with an MCP2515 to provide CAN to the microcontroller. I have updated both the device tree overlay and the project file to add in the configuration but I am getting compilation errors in the device_tree_fixed.h file.
Overlay Addition (nrf52840dongle_nrf52840.dts)
/ {
aliases {
can1 = &can1_mcp2515;
};
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <31>;
mosi-pin = <30>;
miso-pin = <45>;
cs-gpios = <&gpio0 14 0>;
can1_mcp2515: mcp2515@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&gpio0 3 0>; /* D2 */
status = "okay";
label = "CAN_1";
reg = <0x0>;
osc-freq = <16000000>;
bus-speed = <125000>;
sjw = <1>;
prop-seg = <2>;
phase-seg1 = <7>;
phase-seg2 = <6>;
#address-cells = <1>;
#size-cells = <0>;
};
};
Project Config file (prj.conf)
CONFIG_BT=y CONFIG_BT_OBSERVER=y CONFIG_SPI=y CONFIG_I2C=n CONFIG_SENSOR=y CONFIG_PRINTK=y CONFIG_CAN=y CONFIG_CAN_INIT_PRIORITY=80
main.c
#define CAN1_NODE DT_ALIAS(can1)
However, when I got to compile the code I get the following errorzephyr/include/generated/devicetree_unfixed.h:8158:39: error: 'KDT_N_S_soc_S_spi_40004000_S_mcp2515_0' undeclared (first use in this function); did you mean 'KDT_N_S_soc_S_spi_40004000_S_mcp2515_0_ORD'?
Why is the generated devicetree_unfixed.h missing the auto generated define for the MCP2515 from the device tree?
Thanks,
Lance