- Edited
I’ve been trying to add support for CANBus to the tracker sample so I can gather some additional data and send it up with the location. I appended this into circuitdojo_feather_nrf9160_ns.overlay:
&spi2 {
status = "okay";
cs-gpios = <&feather_header 5 GPIO_ACTIVE_LOW>; /* CS */
sck-pin = <&feather_header 6 >;
mosi-pin = <&feather_header 7 >;
miso-pin = <&feather_header 8 >;
can1: mcp2515@0 {
compatible = "microchip,mcp2515";
spi-max-frequency = <1000000>;
int-gpios = <&feather_header 4 GPIO_ACTIVE_LOW>;
status = "okay";
label = "CAN_1";
reg = <0x0>;
osc-freq = <8000000>;
bus-speed = <500000>;
sjw = <1>;
prop-seg = <2>;
phase-seg1 = <7>;
phase-seg2 = <6>;
#address-cells = <1>;
#size-cells = <0>;
};
};
/ {
chosen {
zephyr,can-primary = &can1;
};
};
and I added to prj.conf:
CONFIG_CAN=y
CONFIG_CAN_INIT_PRIORITY=80
CONFIG_CAN_MAX_FILTER=5
When I call can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL) I get a NULL back. Does calling get_binding try to connect to the device, or is it just to get a handle? Anyone have any ideas what I might be doing wrong?