Re: MCP2515 with nRF52832 using zephyr #nrf52832 #dts


Lawrence King
 

I think you need a few more things turned on in your config file. To figure out what you need turned on I always use the menuconfig tool and diff the old and new .config files, then I take the changes and pit them in my prj.conf file

 

In this case I ran ‘ninja menuconfig’ in the build directory, turned on SPI, then CANBUS, then MCP25625, here is a diff between zephyr/.config.old and zephyr/.config:

 

> CONFIG_SPI=y

678a679,695

> # CONFIG_SPI_ASYNC is not set

> # CONFIG_SPI_SLAVE is not set

> CONFIG_SPI_INIT_PRIORITY=70

> # CONFIG_SPI_LOG_LEVEL_OFF is not set

> # CONFIG_SPI_LOG_LEVEL_ERR is not set

> # CONFIG_SPI_LOG_LEVEL_WRN is not set

> CONFIG_SPI_LOG_LEVEL_INF=y

> # CONFIG_SPI_LOG_LEVEL_DBG is not set

> CONFIG_SPI_LOG_LEVEL=3

> # CONFIG_SPI_0 is not set

> # CONFIG_SPI_1 is not set

> # CONFIG_SPI_2 is not set

> # CONFIG_SPI_3 is not set

> # CONFIG_SPI_4 is not set

> # CONFIG_SPI_5 is not set

> # CONFIG_SPI_6 is not set

> CONFIG_SPI_NRFX=y

749a767,768

> # CONFIG_SPI_NOR is not set

> # CONFIG_SPI_FLASH_W25QXXDV is not set

760c779,797

< # CONFIG_CAN is not set

---

> CONFIG_CAN=y

> # CONFIG_CAN_LOG_LEVEL_OFF is not set

> # CONFIG_CAN_LOG_LEVEL_ERR is not set

> # CONFIG_CAN_LOG_LEVEL_WRN is not set

> CONFIG_CAN_LOG_LEVEL_INF=y

> # CONFIG_CAN_LOG_LEVEL_DBG is not set

> CONFIG_CAN_LOG_LEVEL=3

> CONFIG_CAN_INIT_PRIORITY=80

> CONFIG_CAN_WORKQ_FRAMES_BUF_CNT=4

> CONFIG_CAN_0=y

> CONFIG_CAN_1=y

> CONFIG_CAN_MCP2515=y

> CONFIG_CAN_MCP2515_OSC_FREQ=8000000

> CONFIG_CAN_MCP2515_INT_THREAD_STACK_SIZE=512

> CONFIG_CAN_MCP2515_INT_THREAD_PRIO=2

> CONFIG_CAN_MCP2515_MAX_FILTER=5

> CONFIG_CAN_MCP2515_INIT_PRIORITY=80

> # CONFIG_CAN_LOOPBACK is not set

> # CONFIG_CAN_NET is not set

 

My guess is you are not finding the SPI bus because you haven’t configured it.

 

Lawrence King

Principal Developer

+1(416)627-7302

 

From: users@... <users@...> On Behalf Of christophhintz@...
Sent: Tuesday, November 19, 2019 5:19 AM
To: users@...
Subject: [Zephyr-users] MCP2515 with nRF52832 using zephyr #dts #nrf52832

 

Hi I had a question to setup the MCP2515 driver in the zephyr project.

We made a custom board for the decawave DWM1001 module, which uses a nRF52832 chip. They have a device tree file in the zephyr project for this module, so I started with that device tree and configured it for our setup, which is

NRF52832

MCP25625

P0.14

SPI_CS

P0.22

SPI_MISO

P0.31

SPI_MOSI

P0.30

SPI_SCK

P0.27

CAN_RESET

P0.03

CAN_INT

. I attached the devicetree and project file to this post.
The main project file I am using is the can example from zephyr. I only added the pull up for the CAN_RESET GPIO, which I can confirm works. I am not seeing any messages on the SPI pins, which make me suspect that the overlay is incorrect. I just added the mcp into the spi setup in the overlay, from a shield example, I am not to sure if it is correct and what sjw, prop-seg, phase-seg1 and phase-seg2 mean. Any help or pointers are appreciated. The program stops with debug messages "CAN: Device driver not found.".

Join users@lists.zephyrproject.org to automatically receive all group messages.