This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

zephyr: device tree overlay is very confusing | error: 'DT_INST_0_MICROCHIP_MCP2515_SPI_MAX_FREQUENCY' undeclared here

i'm trying to get samples/drivers/CAN working with the nrf52

apparantly you need to enable CAN explicitly in menuconfig, which is already confusing because   prj.conf has CONFIG_CAN=y , but by default all i get is "CAN: Device driver not found."

after enabling the driver, the device tree overlay doesnt seem to be compiled in

can_mcp2515.c:610:14: error: 'DT_INST_0_MICROCHIP_MCP2515_BUS_NAME' undeclared here (not in a function)

however, the mcp2515-dts.overlay file seems broken, because if i add it via

set(DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/mcp2515-dts.overlay")

in CMakeLists.txt  i get:

nrf52_pca10040.dts.pre.tmp:179.22-187.5: ERROR (phandle_references): /soc/spi@40004000: Reference to non-existent node or label "gpioa"

nrf's are apparantly called gpio0 instead of gpioa, so i changed that, but that just leads to an even more cryptic error

device tree error: zephyr/dts/bindings/can/microchip,mcp2515.yaml (in 'reg'): 'category' from !included file overwritten ('required' replaced with 'optional')

so i edited scripts/dts/edtlib.py and just uncommented that check, which leads me to:

device tree error: 'sjw' is marked as required in 'properties:' in /home/aep/proj/zephyr/zephyrproject/zephyr/dts/bindings/can/microchip,mcp2515.yaml, but does not appear in <Node /soc/spi@40004000/mcp2515@0 in 'nrf52_pca10040.dts.pre.tmp'>

so i after removing the broken property, i finally have a working CAN driver.

Parents Reply Children
Related